From ee5e372c6ea517c9e197d8f71f463297f81d15f5 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 24 Aug 2011 00:10:32 -0300 Subject: [archiso] Add missing 'rm' some files on uninstall Signed-off-by: Gerardo Exequiel Pozzi --- archiso/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archiso/Makefile b/archiso/Makefile index 60632e2..a751acd 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -33,6 +33,8 @@ uninstall: rm -f $(DESTDIR)/lib/initcpio/install/archiso rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd + rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt + rm -f $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt rm -rf $(DESTDIR)/usr/share/archiso/ .PHONY: install install-program install-hooks install-examples install-doc uninstall -- cgit v1.2.2 From 23e1cd01cd28611b48f386e445639b262bdd36cb Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 26 Aug 2011 19:01:30 -0300 Subject: [archiso] Avoid regenerate checksum -> .iso. Also put _is_directory_changed() inside 'if' avoiding premature execution if it returns non-zero. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/mkarchiso | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 6826441..28693b6 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -293,11 +293,13 @@ _mkfs () { command_checksum () { _show_config checksum - _msg_info "Creating checksum file for self-test" - cd "${work_dir}/iso/${install_dir}" - find -type f ! -name checksum.md5 -print0 | xargs -0 md5sum > checksum.md5 - cd ${OLDPWD} - _msg_info "Done!" + if _is_directory_changed "${work_dir}/iso/${install_dir}" "${work_dir}/iso/${install_dir}/checksum.md5"; then + _msg_info "Creating checksum file for self-test" + cd "${work_dir}/iso/${install_dir}" + find -type f ! -name checksum.md5 -print0 | xargs -0 md5sum > checksum.md5 + cd ${OLDPWD} + _msg_info "Done!" + fi } # Create an ISO9660 filesystem from "iso" directory. @@ -308,25 +310,25 @@ command_iso () { _show_config iso - _is_directory_changed "${work_dir}/iso" "${img_name}" - - _msg_info "Creating ISO image..." - local _qflag="" - if [[ ${quiet} == "y" ]]; then - _qflag="-quiet" + if _is_directory_changed "${work_dir}/iso" "${img_name}"; then + _msg_info "Creating ISO image..." + local _qflag="" + if [[ ${quiet} == "y" ]]; then + _qflag="-quiet" + fi + mkisofs ${_qflag} -r -l \ + -b isolinux/isolinux.bin -c isolinux/boot.cat \ + -uid 0 -gid 0 \ + -udf -allow-limited-size -iso-level 3 \ + -input-charset utf-8 -p "prepared by mkarchiso" \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -publisher "${iso_publisher}" \ + -A "${iso_application}" \ + -V "${iso_label}" \ + -o "${img_name}" "${work_dir}/iso/" + isohybrid "${img_name}" + _msg_info "Done! | $(ls -sh ${img_name})" fi - mkisofs ${_qflag} -r -l \ - -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -uid 0 -gid 0 \ - -udf -allow-limited-size -iso-level 3 \ - -input-charset utf-8 -p "prepared by mkarchiso" \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -publisher "${iso_publisher}" \ - -A "${iso_application}" \ - -V "${iso_label}" \ - -o "${img_name}" "${work_dir}/iso/" - isohybrid "${img_name}" - _msg_info "Done! | $(ls -sh ${img_name})" } # Parse aitab and create each filesystem specified on that, and push it in "iso" directory. -- cgit v1.2.2 From 219b43a0bf8ef65c4edc1516f1a408ae8fa3607c Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 26 Aug 2011 20:12:17 -0300 Subject: [archiso] Load module loop in run_hook() Otherwise archiso_loop_mnt will fail. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index c973ffc..2b55a00 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -1,7 +1,6 @@ # Initialize loopback device logic (we using on-demand mode) # args: none _init_loop_dev() { - modprobe loop loop_dev_count=99 loop_dev_range=$(cat /sys/block/loop0/range) loop_dev_minor=$((loop_dev_count*loop_dev_range)) @@ -88,6 +87,8 @@ _verify_checksum() { run_hook() { + modprobe loop + [[ -z "${arch}" ]] && arch="$(uname -m)" [[ -z "${cowspace_size}" ]] && cowspace_size="75%" [[ -z "${copytoram_size}" ]] && copytoram_size="75%" -- cgit v1.2.2 From 8c995ee6573b284dbef4c86515765175fbf0e6ce Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 26 Aug 2011 04:39:03 -0300 Subject: [archiso] Change location of nbd_client.pid Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_nbd | 3 ++- configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index 588e033..3fe988a 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -89,6 +89,7 @@ archiso_pxe_nbd_mount_handler () { msg "::: Disconnect NBD from ${nbdserver} at /dev/nbd0" nbd-client -d /dev/nbd0 else - pidof nbd-client > /run/nbd_client.pid + mkdir -p /run/archiso + pidof nbd-client > /run/archiso/nbd_client.pid fi } diff --git a/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client b/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client index b72f168..60a1192 100644 --- a/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client +++ b/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client @@ -1,6 +1,6 @@ -if [[ -f /run/nbd_client.pid ]]; then +if [[ -f /run/archiso/nbd_client.pid ]]; then omit_kill_nbd_client() { - add_omit_pids $(< /run/nbd_client.pid) + add_omit_pids $(< /run/archiso/nbd_client.pid) } add_hook shutdown_prekillall omit_kill_nbd_client -- cgit v1.2.2 From 14903dfc4579089288e1da82e92fb6eb6b891c66 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 29 Aug 2011 01:45:49 -0300 Subject: [configs/*] Rename $name -> $iso_name, $version -> $iso_version Signed-off-by: Gerardo Exequiel Pozzi --- configs/baseline/build.sh | 6 +++--- configs/releng/build.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index aa75a20..24f301b 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -2,9 +2,9 @@ set -e -u -name=archlinux +iso_name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work @@ -79,7 +79,7 @@ make_prepare() { # Build ISO make_iso() { mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${arch}.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" } if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index e06089a..1f26408 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -2,9 +2,9 @@ set -e -u -name=archlinux +iso_name=archlinux iso_label="ARCH_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work @@ -164,7 +164,7 @@ make_prepare() { make_iso() { local _iso_type=${1} mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${_iso_type}-${arch}.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -208,7 +208,7 @@ make_dual() { s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${name}-${version}-${_iso_type}-dual.iso" + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +298,11 @@ case "${command_name}" in ;; clean_single) rm -rf ${work_dir} - rm -f ${name}-${version}-*-${arch}.iso + rm -f ${iso_name}-${iso_version}-*-${arch}.iso ;; clean_dual) rm -rf ${work_dir}/dual - rm -f ${name}-${version}-*-dual.iso + rm -f ${iso_name}-${iso_version}-*-dual.iso ;; *) echo "Invalid command name '${command_name}'" -- cgit v1.2.2 From ad2385c08263b1edf640da0c9b69bda9995a582f Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 29 Aug 2011 01:45:49 -0300 Subject: [archiso] Use -w instead of cmd , add -o Default (if not specified) -w work -o out. -o is only used by 'iso' command. Adjust build.sh of releng and baseline profile to reflect this change. - work <- $work_dir - out <- $out_dir Signed-off-by: Gerardo Exequiel Pozzi --- archiso/mkarchiso | 37 ++++++++++++++++++++----------------- configs/baseline/build.sh | 11 ++++++----- configs/releng/build.sh | 21 +++++++++++---------- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 28693b6..bd8b7a9 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -11,6 +11,8 @@ export iso_label="ARCH_$(date +%Y%m)" iso_publisher="Arch Linux " iso_application="Arch Linux Live/Rescue CD" install_dir="arch" +work_dir="work" +out_dir="out" # Show an INFO message # $1: message string @@ -104,17 +106,21 @@ _usage () echo " -D Set an install_dir. All files will by located here." echo " Default ${install_dir}" echo " NOTE: Max 8 characters, use only [a-z0-9]" + echo " -w Set the working directory" + echo " Default ${work_dir}" + echo " -o Set the output directory" + echo " Default ${out_dir}" echo " -v Enable verbose output" echo " -h This message" echo " commands:" - echo " create " + echo " create" echo " create a base directory layout to work with" echo " includes all specified packages" - echo " prepare " + echo " prepare" echo " build all images" - echo " checksum " + echo " checksum" echo " make a checksum.md5 for self-test" - echo " iso " + echo " iso " echo " build an iso image from the working dir" exit ${1} } @@ -310,7 +316,8 @@ command_iso () { _show_config iso - if _is_directory_changed "${work_dir}/iso" "${img_name}"; then + if _is_directory_changed "${work_dir}/iso" "${out_dir}/${img_name}"; then + mkdir -p ${out_dir} _msg_info "Creating ISO image..." local _qflag="" if [[ ${quiet} == "y" ]]; then @@ -325,9 +332,9 @@ command_iso () { -publisher "${iso_publisher}" \ -A "${iso_application}" \ -V "${iso_label}" \ - -o "${img_name}" "${work_dir}/iso/" - isohybrid "${img_name}" - _msg_info "Done! | $(ls -sh ${img_name})" + -o "${out_dir}/${img_name}" "${work_dir}/iso/" + isohybrid "${out_dir}/${img_name}" + _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" fi } @@ -406,7 +413,7 @@ if [[ ${EUID} -ne 0 ]]; then _msg_error "This script must be run as root." 1 fi -while getopts 'p:C:L:P:A:D:fvh' arg; do +while getopts 'p:C:L:P:A:D:w:o:vh' arg; do case "${arg}" in p) pkg_list="${pkg_list} ${OPTARG}" ;; C) pacman_conf="${OPTARG}" ;; @@ -414,6 +421,8 @@ while getopts 'p:C:L:P:A:D:fvh' arg; do P) iso_publisher="${OPTARG}" ;; A) iso_application="${OPTARG}" ;; D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; v) quiet="n" ;; h|?) _usage 0 ;; *) @@ -431,12 +440,6 @@ if [[ $# -lt 1 ]]; then fi command_name="${1}" -if [[ $# -lt 2 ]]; then - _msg_error "No working directory specified" 0 - _usage 1 -fi -work_dir="${2}" - case "${command_name}" in create) command_create @@ -448,11 +451,11 @@ case "${command_name}" in command_checksum ;; iso) - if [[ $# -lt 3 ]]; then + if [[ $# -lt 2 ]]; then _msg_error "No image specified" 0 _usage 1 fi - img_name="${3}" + img_name="${2}" command_iso ;; *) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 24f301b..f3e8676 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -8,14 +8,15 @@ iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work +out_dir=out verbose="n" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "syslinux" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "syslinux" create } # Copy mkinitcpio archiso hooks (root-image) @@ -73,13 +74,13 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO make_iso() { - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" } if [[ $verbose == "y" ]]; then diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 1f26408..7660ee9 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -8,19 +8,20 @@ iso_version=$(date +%Y.%m.%d) install_dir=arch arch=$(uname -m) work_dir=work +out_dir=out verbose="n" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create } # Additional packages (root-image) make_packages() { - mkarchiso ${verbose} -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create } # Customize installation (root-image) @@ -156,15 +157,15 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO # args: $1 (core | netinstall) make_iso() { local _iso_type=${1} - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -207,8 +208,8 @@ make_dual() { sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${iso_name}-${iso_version}-${_iso_type}-dual.iso" + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } @@ -298,11 +299,11 @@ case "${command_name}" in ;; clean_single) rm -rf ${work_dir} - rm -f ${iso_name}-${iso_version}-*-${arch}.iso + rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso ;; clean_dual) rm -rf ${work_dir}/dual - rm -f ${iso_name}-${iso_version}-*-dual.iso + rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso ;; *) echo "Invalid command name '${command_name}'" -- cgit v1.2.2 From 48023e336bc95bda974f1e772e209dc07f3b1e05 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 29 Aug 2011 01:45:49 -0300 Subject: [configs/releng] Support configurable build options via command line usage ./build.sh [options] command General options: -N Set an iso filename (prefix) Default: archlinux -V Set an iso version (in filename) Default: 2011.08.18 -L Set an iso label (disk label) Default: ARCH_201108 -D Set an install_dir (directory inside iso) Default: arch -w Set the working directory Default: work -o Set the output directory Default: out -v Enable verbose output -h This help message Commands: build Build selected .iso by and purge Clean working directory except iso/ directory of build clean Clean working directory and .iso file in output directory of build Command options: Valid values 'single' or 'dual' Valid values 'netinstall', 'core' or 'all' Signed-off-by: Gerardo Exequiel Pozzi --- README | 15 +-- configs/releng/build.sh | 239 +++++++++++++++++++++++++++++++++++------------- 2 files changed, 183 insertions(+), 71 deletions(-) diff --git a/README b/README index 97b5f77..88b3243 100644 --- a/README +++ b/README @@ -240,23 +240,24 @@ Note: These steps should be done with 64 bits support. * Enter 32 bits chroot enviroment then build core and netinstall single images. [chroot32] # linux32 mkarchroot -r bash /tmp/chroot32 - [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) + [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32] # cp -r /usr/share/archiso/configs/releng /tmp [chroot32] # cd /tmp/releng - [chroot32] # ./build.sh all_iso_single - [chroot32] # ./build.sh purge_single #optional + [chroot32] # ./build.sh build single all + [chroot32] # ./build.sh purge single # optional step * Enter 64 bits chroot enviroment then build core and netinstall single images. [chroot64] # mkarchroot -r bash /tmp/chroot64 - [chroot64] # mknod /dev/loop1064 b 7 1064 #assumed loop.max_part=0 (by default) + [chroot64] # mknod /dev/loop1064 b 7 1064 # assumed loop.max_part=0 (by default) [chroot64] # cp -r /usr/share/archiso/configs/releng /tmp [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_single - [chroot64] # ./build.sh purge_single #optional + [chroot64] # ./build.sh build single all + [chroot64] # ./build.sh purge single # optional step * Build core and netinstall dual images from any of the chroot enviroments. [host64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_dual + [chroot64] # ./build.sh build dual all + [chroot64] # ./build.sh purge dual # optional step diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 7660ee9..feac4a8 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -9,7 +9,7 @@ install_dir=arch arch=$(uname -m) work_dir=work out_dir=out -verbose="n" +verbose="" script_path=$(readlink -f ${0%/*}) @@ -214,13 +214,82 @@ make_dual() { fi } +purge_single () +{ + if [[ -d ${work_dir} ]]; then + find ${work_dir} -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/iso -prune \ + | xargs rm -rf + fi +} + +purge_dual () +{ + if [[ -d ${work_dir}/dual ]]; then + find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/dual/iso -prune \ + | xargs rm -rf + fi +} + +clean_single () +{ + rm -rf ${work_dir} + rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso +} +clean_dual () +{ + rm -rf ${work_dir}/dual + rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso +} + +make_common_single() { + make_basefs + make_packages + make_customize_root_image + make_setup_mkinitcpio + make_boot + make_syslinux + make_isolinux + make_lib_modules + make_usr_share + make_aitab $1 + make_prepare $1 + make_iso $1 +} _usage () { - echo "usage ${0##*/} net_iso_single | core_iso_single | all_iso_single | purge_single | clean_single" - echo " net_iso_dual | core_iso_dual | all_iso_dual | purge_dual | clean_dual" + echo "usage ${0} [options] command " + echo + echo " General options:" + echo " -N Set an iso filename (prefix)" + echo " Default: ${iso_name}" + echo " -V Set an iso version (in filename)" + echo " Default: ${iso_version}" + echo " -L Set an iso label (disk label)" + echo " Default: ${iso_label}" + echo " -D Set an install_dir (directory inside iso)" + echo " Default: ${install_dir}" + echo " -w Set the working directory" + echo " Default: ${work_dir}" + echo " -o Set the output directory" + echo " Default: ${out_dir}" + echo " -v Enable verbose output" + echo " -h This help message" echo + echo " Commands:" + echo " build " + echo " Build selected .iso by and " + echo " purge " + echo " Clean working directory except iso/ directory of build " + echo " clean " + echo " Clean working directory and .iso file in output directory of build " + echo + echo " Command options:" + echo " Valid values 'single' or 'dual'" + echo " Valid values 'netinstall', 'core' or 'all'" exit ${1} } @@ -229,81 +298,123 @@ if [[ ${EUID} -ne 0 ]]; then _usage 1 fi +while getopts 'N:V:L:D:w:o:vh' arg; do + case "${arg}" in + N) iso_name="${OPTARG}" ;; + V) iso_version="${OPTARG}" ;; + L) iso_label="${OPTARG}" ;; + D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; + v) verbose="-v" ;; + h|?) _usage 0 ;; + *) + _msg_error "Invalid argument '${arg}'" 0 + _usage 1 + ;; + esac +done + +shift $((OPTIND - 1)) + if [[ $# -lt 1 ]]; then echo "No command specified" _usage 1 fi command_name="${1}" -if [[ ${verbose} == "y" ]]; then - verbose="-v" -else - verbose="" +if [[ $# -lt 2 ]]; then + echo "No command mode specified" + _usage 1 fi +command_mode="${2}" -if [[ ${command_name} =~ single ]]; then - work_dir=${work_dir}/${arch} +if [[ ${command_name} == "build" ]]; then + if [[ $# -lt 3 ]]; then + echo "No build type specified" + _usage 1 + fi +command_type="${3}" fi -make_common_single() { - make_basefs - make_packages - make_customize_root_image - make_setup_mkinitcpio - make_boot - make_syslinux - make_isolinux - make_lib_modules - make_usr_share - make_aitab $1 - make_prepare $1 - make_iso $1 -} +if [[ ${command_mode} == "single" ]]; then + work_dir=${work_dir}/${arch} +fi case "${command_name}" in - net_iso_single) - make_common_single netinstall - ;; - core_iso_single) - make_core_repo - make_common_single core - ;; - all_iso_single) - make_common_single netinstall - make_core_repo - make_common_single core - ;; - net_iso_dual) - make_dual netinstall - ;; - core_iso_dual) - make_dual core - ;; - all_iso_dual) - make_dual netinstall - make_dual core - ;; - purge_single) - if [[ -d ${work_dir} ]]; then - find ${work_dir} -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/iso -prune \ - | xargs rm -rf - fi - ;; - purge_dual) - if [[ -d ${work_dir}/dual ]]; then - find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/dual/iso -prune \ - | xargs rm -rf - fi + build) + case "${command_mode}" in + single) + case "${command_type}" in + netinstall) + make_common_single netinstall + ;; + core) + make_core_repo + make_common_single core + ;; + all) + make_common_single netinstall + make_core_repo + make_common_single core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + dual) + case "${command_type}" in + netinstall) + make_dual netinstall + ;; + core) + make_dual core + ;; + all) + make_dual netinstall + make_dual core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + *) + echo "Invalid build mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_single) - rm -rf ${work_dir} - rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso + purge) + case "${command_mode}" in + single) + purge_single + ;; + dual) + purge_dual + ;; + *) + echo "Invalid purge mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_dual) - rm -rf ${work_dir}/dual - rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso + clean) + case "${command_mode}" in + single) + clean_single + ;; + dual) + clean_dual + ;; + *) + echo "Invalid clean mode '${command_mode}'" + _usage 1 + ;; + esac ;; *) echo "Invalid command name '${command_name}'" -- cgit v1.2.2 From 14743f4202eeffca4d80105c7e7ad91bc0af4e88 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 29 Aug 2011 01:47:57 -0300 Subject: [archiso] Switch from cdrkit to libisoburn * Preparing terrain for UEFI support. * Also make isohybrid hack in one step. * Removed UDF layer, since xorriso does not support it. * Removed unsupported options by xorriso (-uid/-gid/-allow-limited-size) * Removed option already default in xorriso (-input-charset utf-8) Signed-off-by: Gerardo Exequiel Pozzi --- README | 9 ++++----- archiso/mkarchiso | 12 +++++++----- configs/baseline/build.sh | 1 + configs/releng/build.sh | 1 + 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README b/README index 88b3243..9c49946 100644 --- a/README +++ b/README @@ -101,8 +101,7 @@ if nothing is specified on command line. ** For mkarchiso script needs these packages (build host): + devtools for mkarchroot + squashfs-tools for mksquashfs - + syslinux for isohybrid - + cdrkit for mkisofs + + libisoburn for xorriso ** For these hooks needs these packages (on target root-image) * archiso @@ -189,7 +188,7 @@ When make your custom boot-pendrive, you need to copy /arch directory to it. [chroot] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist * Install aditional packages needed for mkarchiso. - [chroot] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot] # pacman -S devtools squashfs-tools libisoburn * Build a basic iso. [chroot] # cp -r /usr/share/archiso/configs/baseline /tmp @@ -213,7 +212,7 @@ Note: These steps should be done with 64 bits support. [host64] # linux32 mkarchroot /tmp/chroot32 base [host64] # linux32 mkarchroot -r bash /tmp/chroot32 [chroot32] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist - [chroot32] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot32] # pacman -S devtools squashfs-tools libisoburn [chroot32] # exit * Prepare a 64 bits chroot enviroment. @@ -221,7 +220,7 @@ Note: These steps should be done with 64 bits support. [host64] # mkarchroot /tmp/chroot64 base [host64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist - [chroot64] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot64] # pacman -S devtools squashfs-tools libisoburn [chroot64] # exit * Install archiso on both chroots. diff --git a/archiso/mkarchiso b/archiso/mkarchiso index bd8b7a9..6fb5d06 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -313,6 +313,9 @@ command_iso () { if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then _msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1 fi + if [[ ! -f "${work_dir}/iso/isolinux/isohdpfx.bin" ]]; then + _msg_error "The file '${work_dir}/iso/isolinux/isohdpfx.bin' does not exist." 1 + fi _show_config iso @@ -323,17 +326,16 @@ command_iso () { if [[ ${quiet} == "y" ]]; then _qflag="-quiet" fi - mkisofs ${_qflag} -r -l \ + xorriso -as mkisofs ${_qflag} -r -l \ -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -uid 0 -gid 0 \ - -udf -allow-limited-size -iso-level 3 \ - -input-charset utf-8 -p "prepared by mkarchiso" \ + -iso-level 3 \ -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \ + -p "prepared by mkarchiso" \ -publisher "${iso_publisher}" \ -A "${iso_application}" \ -V "${iso_label}" \ -o "${out_dir}/${img_name}" "${work_dir}/iso/" - isohybrid "${out_dir}/${img_name}" _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" fi } diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index f3e8676..b7d2b7b 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -60,6 +60,7 @@ make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ : > ${work_dir}/build.${FUNCNAME} fi } diff --git a/configs/releng/build.sh b/configs/releng/build.sh index feac4a8..e2ee1f9 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -96,6 +96,7 @@ make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ : > ${work_dir}/build.${FUNCNAME} fi } -- cgit v1.2.2 From a55fc14e24d6ed07961766e36fd45331bbeea7bc Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 29 Aug 2011 15:27:03 -0300 Subject: [archiso] Integrate omit_kill_nbd_client logic in hook. This makes archiso_pxe_nbd functionallity full-independient from archiso profiles (configs/*). Signed-off-by: Gerardo Exequiel Pozzi --- archiso/Makefile | 2 ++ archiso/archiso_pxe_nbd | 6 ++++++ archiso/hooks/archiso_pxe_nbd | 1 + archiso/install/archiso_pxe_nbd | 2 ++ configs/releng/build.sh | 1 + .../releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client | 8 -------- 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 archiso/archiso_pxe_nbd delete mode 100644 configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client diff --git a/archiso/Makefile b/archiso/Makefile index a751acd..4e8291e 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -12,6 +12,7 @@ install-hooks: # hooks/install are needed by mkinitcpio install -D -m 644 hooks/archiso $(DESTDIR)/lib/initcpio/hooks/archiso install -D -m 644 install/archiso $(DESTDIR)/lib/initcpio/install/archiso + install -D -m 644 archiso_pxe_nbd $(DESTDIR)/lib/initcpio/archiso_pxe_nbd install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt @@ -31,6 +32,7 @@ uninstall: rm -f $(DESTDIR)/usr/bin/testiso rm -f $(DESTDIR)/lib/initcpio/hooks/archiso rm -f $(DESTDIR)/lib/initcpio/install/archiso + rm -f $(DESTDIR)/lib/initcpio/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt diff --git a/archiso/archiso_pxe_nbd b/archiso/archiso_pxe_nbd new file mode 100644 index 0000000..e6b9872 --- /dev/null +++ b/archiso/archiso_pxe_nbd @@ -0,0 +1,6 @@ +omit_kill_nbd_client() { + add_omit_pids $(< /run/archiso/nbd_client.pid) +} + +add_hook shutdown_prekillall omit_kill_nbd_client +add_hook single_prekillall omit_kill_nbd_client diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index 3fe988a..e3e27e7 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -91,5 +91,6 @@ archiso_pxe_nbd_mount_handler () { else mkdir -p /run/archiso pidof nbd-client > /run/archiso/nbd_client.pid + cp /archiso_pxe_nbd ${newroot}/etc/rc.d/functions.d/ fi } diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index c8ba1a4..69a12ce 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -14,6 +14,8 @@ build () add_binary "/usr/sbin/nbd-client" "/bin/nbd-client" add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" + + add_file "/lib/initcpio/archiso_pxe_nbd" "/archiso_pxe_nbd" } help () diff --git a/configs/releng/build.sh b/configs/releng/build.sh index e2ee1f9..fa7d13c 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -47,6 +47,7 @@ make_setup_mkinitcpio() { cp /lib/initcpio/hooks/${_hook} ${work_dir}/root-image/lib/initcpio/hooks cp /lib/initcpio/install/${_hook} ${work_dir}/root-image/lib/initcpio/install done + cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio : > ${work_dir}/build.${FUNCNAME} fi } diff --git a/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client b/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client deleted file mode 100644 index 60a1192..0000000 --- a/configs/releng/root-image/etc/rc.d/functions.d/omit_kill_nbd_client +++ /dev/null @@ -1,8 +0,0 @@ -if [[ -f /run/archiso/nbd_client.pid ]]; then - omit_kill_nbd_client() { - add_omit_pids $(< /run/archiso/nbd_client.pid) - } - - add_hook shutdown_prekillall omit_kill_nbd_client - add_hook single_prekillall omit_kill_nbd_client -fi -- cgit v1.2.2 From 8ea61d2b2815b1afdf855af5f0f1d6a93c438fc7 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 30 Aug 2011 23:21:11 -0300 Subject: [archiso] Cleanup archiso install hook. * These files was added during developement stage of dm-snapshot branch of archiso. Never was used, sinse archiso works directly with dmsetup and with device nodes in /dev/mapper/ * Added 11-dm-initramfs.rules to keep dm info about nodes persistent in udev db across initramfs/real-root. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/install/archiso | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/archiso/install/archiso b/archiso/install/archiso index 514c011..89642f0 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -15,14 +15,12 @@ build () add_binary /lib/udev/cdrom_id add_binary /sbin/blockdev - add_binary /sbin/lvm add_binary /sbin/dmsetup add_file /lib/udev/rules.d/60-cdrom_id.rules add_file /lib/udev/rules.d/10-dm.rules - add_file /lib/udev/rules.d/13-dm-disk.rules add_file /lib/udev/rules.d/95-dm-notify.rules - add_file /lib/udev/rules.d/11-dm-lvm.rules + add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules SCRIPT="archiso" } -- cgit v1.2.2 From cb619dfae12f13ba8e70427d518489f478338a59 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 30 Aug 2011 23:46:56 -0300 Subject: [configs/releng] Replace wget with pacman for make_core_repo() Fix: FS#18959 - download_repos.sh does not report tcp timeouts and such * Always use pacman cache. Previously pacman cache was used if package already exists on it, now is also used to download pkg on it. Finally copy all packages from cache with cp and make core.db. * Using pacman, we can sure that package integrity is right. * Always get a [core] package, in case of [testing] enabled. * Now works when mirror is: Server = file:// ;) Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/build.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/configs/releng/build.sh b/configs/releng/build.sh index fa7d13c..3f6df8d 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -121,26 +121,23 @@ make_usr_share() { # Make [core] repository, keep "any" pkgs in a separate fs (makes more "dual-iso" friendly) make_core_repo() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _url _urls _pkg_name _cached_pkg _dst + local _url _urls _pkg_name _cached_pkg _dst _pkgs mkdir -p ${work_dir}/repo-core-any mkdir -p ${work_dir}/repo-core-${arch} pacman -Sy - _urls=$(pacman -Sddp $(comm -2 -3 <(pacman -Sql core | sort ) <(grep -v ^# ${script_path}/core.exclude.${arch} | sort))) + _pkgs=$(comm -2 -3 <(pacman -Sql core | sort | sed 's@^@core/@') \ + <(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@')) + _urls=$(pacman -Sddp ${_pkgs}) + pacman -Swdd --noconfirm ${_pkgs} for _url in ${_urls}; do _pkg_name=${_url##*/} _cached_pkg=/var/cache/pacman/pkg/${_pkg_name} _dst=${work_dir}/repo-core-${arch}/${_pkg_name} - if [[ ! -e ${_dst} ]]; then - if [[ -e ${_cached_pkg} ]]; then - cp -v "${_cached_pkg}" "${_dst}" - else - wget -nv "${_url}" -O "${_dst}" - fi - fi - repo-add -q ${work_dir}/repo-core-${arch}/core.db.tar.gz ${work_dir}/repo-core-${arch}/${_pkg_name} - if [[ ${_pkg_name} =~ any.pkg ]]; then - mv "${_dst}" ${work_dir}/repo-core-any/${_pkg_name} - ln -sf ../any/${_pkg_name} ${work_dir}/repo-core-${arch}/${_pkg_name} + cp ${_cached_pkg} ${_dst} + repo-add -q ${work_dir}/repo-core-${arch}/core.db.tar.gz ${_dst} + if [[ ${_pkg_name} == *any.pkg.tar* ]]; then + mv ${_dst} ${work_dir}/repo-core-any/${_pkg_name} + ln -sf ../any/${_pkg_name} ${_dst} fi done : > ${work_dir}/build.${FUNCNAME} -- cgit v1.2.2 From 1dcf439c30bac6485965a0cd899de74db2f2ef39 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 3 Oct 2011 21:12:56 -0300 Subject: [archiso] Create /etc/mtab as symlink. This is now supported since util-linux pkg enable it. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/mkarchiso | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 6fb5d06..e434bb2 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -201,9 +201,9 @@ _cleanup () { if [[ -d "${work_dir}/root-image/tmp" ]]; then find "${work_dir}/root-image/tmp" -mindepth 1 -delete fi - # Delete etc/mtab if not is a symlink. + # Create etc/mtab if not is a symlink. if [[ ! -L "${work_dir}/root-image/etc/mtab" ]]; then - rm -f "${work_dir}/root-image/etc/mtab" + ln -sf "/proc/self/mounts" "${work_dir}/root-image/etc/mtab" fi } -- cgit v1.2.2 From bfef0bc1eb397dd2a2f8a67460df78fe7ab3a964 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 12 Oct 2011 14:40:19 -0300 Subject: [archiso] Unify -> Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_nbd | 4 ++-- configs/baseline/build.sh | 2 +- .../releng/root-image/etc/rc.d/functions.d/automated_script | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index e3e27e7..cc21c2b 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -8,10 +8,10 @@ run_hook () { if [ -n "${BOOTIF}" ]; then bootif_mac=${BOOTIF#01-} bootif_mac=${bootif_mac//-/:} - bootif_dev=$(grep -l $bootif_mac /sys/class/net/*/address) + bootif_dev=$(grep -l ${bootif_mac} /sys/class/net/*/address) bootif_dev=${bootif_dev#/sys/class/net/} bootif_dev=${bootif_dev%/address} - ip="$ip::$bootif_dev" + ip="${ip}::${bootif_dev}" fi # setup network and save some values diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index b7d2b7b..ab7a88e 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -84,7 +84,7 @@ make_iso() { mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" } -if [[ $verbose == "y" ]]; then +if [[ ${verbose} == "y" ]]; then verbose="-v" else verbose="" diff --git a/configs/releng/root-image/etc/rc.d/functions.d/automated_script b/configs/releng/root-image/etc/rc.d/functions.d/automated_script index 7a35acb..b89ad9e 100644 --- a/configs/releng/root-image/etc/rc.d/functions.d/automated_script +++ b/configs/releng/root-image/etc/rc.d/functions.d/automated_script @@ -1,16 +1,16 @@ automated_script () { script="$(kernel_cmdline script)" - if [[ -n "$script" ]]; then + if [[ -n "${script}" ]]; then stat_busy "Configuring $script" - if [[ "$script" =~ ^http:// || "$script" =~ ^ftp:// ]]; then - wget "$script" -q -O /tmp/startup_script >/dev/null + if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then + wget "${script}" -q -O /tmp/startup_script >/dev/null rt=$? else - cp "$script" /tmp/startup_script + cp "${script}" /tmp/startup_script rt=$? fi - if [ $rt -eq 0 ]; then + if [ ${rt} -eq 0 ]; then chmod +x /tmp/startup_script echo -e '\nif [ $(tty) = "/dev/tty1" ]; then\n /tmp/startup_script\nfi\n' >> /root/.bash_profile stat_done -- cgit v1.2.2 From 51db47e74bb5209bb242d99e6d69b1f683dd3085 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 14 Oct 2011 22:46:45 -0300 Subject: [archiso] disable progress bar in mksquashfs Signed-off-by: Gerardo Exequiel Pozzi --- archiso/mkarchiso | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index e434bb2..5d77128 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -223,9 +223,9 @@ _mksfs () { _msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..." local _seconds=${SECONDS} if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" &> /dev/null + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress &> /dev/null else - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress fi _seconds=$((SECONDS - _seconds)) printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60)) -- cgit v1.2.2 From 9c22cf9450d68422ff39381eec9b7272bbbcc3a1 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 21 Oct 2011 00:23:35 -0300 Subject: [configs/releng] Add gptfdisk to live enviroment. Image size in MiB: old -- new -- iso 679 -> 693 core-dual 374 -> 381 core-i686 380 -> 387 core-x86_64 309 -> 323 netinstall-dual 182 -> 189 netinstall-i686 185 -> 192 netinstall-x86_64 Was requested: mailing-list and bugtracker. Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/packages.i686 | 1 + configs/releng/packages.x86_64 | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 27db22c..5083750 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -12,6 +12,7 @@ dnsutils dosfstools elinks gnu-netcat +gptfdisk hdparm inetutils ipw2100-fw diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 27db22c..5083750 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -12,6 +12,7 @@ dnsutils dosfstools elinks gnu-netcat +gptfdisk hdparm inetutils ipw2100-fw -- cgit v1.2.2 From 18d7493530819aec50164d1c306beae40e6b9513 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 22 Oct 2011 00:53:54 -0300 Subject: [configs/releng] Disable pacman progress bar during core-repo download Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 3f6df8d..cdbbfa0 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -128,7 +128,7 @@ make_core_repo() { _pkgs=$(comm -2 -3 <(pacman -Sql core | sort | sed 's@^@core/@') \ <(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@')) _urls=$(pacman -Sddp ${_pkgs}) - pacman -Swdd --noconfirm ${_pkgs} + pacman -Swdd --noprogressbar --noconfirm ${_pkgs} for _url in ${_urls}; do _pkg_name=${_url##*/} _cached_pkg=/var/cache/pacman/pkg/${_pkg_name} -- cgit v1.2.2 From 91e11c30f46094bcc7352f42e11799f662b6b689 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:17 -0300 Subject: [archiso] Add a new function _mnt_dev(), use it for mounting archisodevice. Separate this code from main mount hook, and make it more generic. _mnt_dev(device, mountpoint, flags) -> wait for device and mount, launch a shell if something goes wrong. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 71 +++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 2b55a00..1ef6e95 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -76,6 +76,44 @@ _mnt_sfs() { fi } +# args: device, mountpoint, flags +_mnt_dev() { + local dev="${1}" + local mnt="${2}" + local flg="${3}" + + local fstype fserror + + msg ":: Mounting '${dev}' to '${mnt}'" + + while ! poll_device "${dev}" 30; do + echo "ERROR: '${dev}' device did not show up after 30 seconds..." + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + done + + fstype=$(blkid -o value -s TYPE -p "${dev}" 2> /dev/null) + if [[ -n "${fstype}" ]]; then + if mount ${flg} -t "${fstype}" "${dev}" "${mnt}"; then + msg ":: Device '${dev}' mounted successfully." + fserror=0 + else + echo "ERROR; Failed to mount '${dev}' (FS is ${fstype})" + fserror=1 + fi + else + echo "ERROR: '${dev}' found, but the filesystem type is unknown." + fserror=1 + fi + + if [[ ${fserror} -eq 1 ]]; then + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + fi +} + _verify_checksum() { local _status cd "/bootmnt/${archisobasedir}" @@ -85,7 +123,6 @@ _verify_checksum() { return ${_status} } - run_hook() { modprobe loop @@ -109,38 +146,12 @@ run_hook() { # args: /path/to/newroot archiso_mount_handler() { local newroot="${1}" - local fstype fserror _init_loop_dev - msg ":: Waiting for boot device..." - while ! poll_device "${archisodevice}" 30; do - echo "ERROR: boot device didn't show up after 30 seconds..." - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" - launch_interactive_shell - done - - fstype=$(blkid -o value -s TYPE -p "${archisodevice}" 2> /dev/null) - if [[ -n "${fstype}" ]]; then - if mount -r -t "${fstype}" "${archisodevice}" /bootmnt; then - if [[ -f "${aitab}" ]]; then - msg ":: Mounted archiso volume successfully." - fserror=0 - else - echo "ERROR: Mounting was successful, but the '${aitab}' file does not exist." - fserror=1 - fi - else - echo "ERROR; Failed to mount '${archisodevice}' (FS is ${fstype})" - fserror=1 - fi - else - echo "ERROR: '${archisodevice}' found, but the filesystem type is unknown." - fserror=1 - fi - - if [[ ${fserror} -eq 1 ]]; then + _mnt_dev "${archisodevice}" "/bootmnt" "-r" + if [[ ! -f "${aitab}" ]]; then + echo "ERROR: '${aitab}' file does not exist." echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell -- cgit v1.2.2 From e2055835fda3d2c99378231e4595472bf28631c4 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:17 -0300 Subject: [archiso] Allow persistent cow dm-snapshots. Add some options to control where all COW files will be located. Until this moment all files are located in a tmpfs filesystem. Now is posible to set a device via a filesystem label or device node plus a directory, where all these files will be stored. All dm-snapshot devices will be persistent by default, but this can be changed if wanted. Take care, a filesystem that does not support sparse files maybe is not the best choice for COW files, because they are created with the same size (is apparent) like the read-only device (the image.fs inside .sfs). Of course sooner or later, depending on use, these files actually end up being as big as the read-only device. KNOW-ISSUE: On shutdown in step "Unmounting Filesystems" will [FAIL], all filesystem except $cow_device, will be unmounted/remounted-ro. For this reason this change needs an archiso_shutdown hook, thats unmount all block devices used by archiso. (Work in progress) Signed-off-by: Gerardo Exequiel Pozzi --- README | 10 +++++++++ archiso/hooks/archiso | 57 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/README b/README index 9c49946..8f59be3 100644 --- a/README +++ b/README @@ -35,6 +35,16 @@ INDEX performs a self-test of all files inside ${install_dir}, and continue booting if ok. Default: (unset) +* cow_label= Set the filesystem label where COW (dm-snapshot) + files must be stored. + Default: (unset) +* cow_device= Set the device node where COW (dm-snapshot) files + must be stored. + Default: (unset) or "/dev/disk/by-label/${cow_label}" +* cow_directory= Set a directory inside ${cow_device}. + Default: "/persistent_${archisolabel}/${arch}" +* cow_persistent= Set if snapshots are persistent "P" or non-persistent "N". + Default: "N" (if no ${cow_device} is used) otherwise "P". * cowspace_size= Set the size of tmpfs /cowspace. This space is used for Copy-On-Write files of dm-snapshot. (directory not visible outside initramfs) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 1ef6e95..4b512ef 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -38,11 +38,27 @@ _mnt_fs() { ro_dev_size=$(blockdev --getsz ${ro_dev}) ro_dev_fs_type=$(blkid -o value -s TYPE -p ${ro_dev} 2> /dev/null) - dd of="/cowspace/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + + if [[ "${cow_persistent}" == "P" ]]; then + if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow', using as persistent." + else + msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as persistent." + dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + fi + else + if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." + rm -f "/cowspace/${cow_directory}/${img_name}.cow" + fi + msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." + dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + fi + _next_loop_dev - rw_dev=$(_make_loop_dev "/cowspace/${img_name}.cow") + rw_dev=$(_make_loop_dev "/cowspace/${cow_directory}/${img_name}.cow") - echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} N 8" | dmsetup create ${dm_snap_name} + echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${mnt}'" if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${mnt}" ; then @@ -132,11 +148,24 @@ run_hook() { [[ -z "${archisobasedir}" ]] && archisobasedir="arch" [[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch" [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" + if [[ -z "${aitab}" ]]; then aitab="/bootmnt/${archisobasedir}/aitab" else aitab="/bootmnt/${aitab}" fi + + if [[ -n "${cow_label}" ]]; then + cow_device="/dev/disk/by-label/${cow_label}" + [[ -z "${cow_persistent}" ]] && cow_persistent="P" + elif [[ -n "${cow_device}" ]]; then + [[ -z "${cow_persistent}" ]] && cow_persistent="P" + else + cow_persistent="N" + fi + + [[ -z "${cow_directory}" ]] && cow_directory="persistent_${archisolabel}/${arch}" + # set mount handler for archiso mount_handler="archiso_mount_handler" } @@ -149,7 +178,12 @@ archiso_mount_handler() { _init_loop_dev - _mnt_dev "${archisodevice}" "/bootmnt" "-r" + if [[ "${archisodevice}" -ef "${cow_device}" ]]; then + _mnt_dev "${archisodevice}" "/bootmnt" + else + _mnt_dev "${archisodevice}" "/bootmnt" "-r" + fi + if [[ ! -f "${aitab}" ]]; then echo "ERROR: '${aitab}' file does not exist." echo " Falling back to interactive prompt" @@ -174,14 +208,17 @@ archiso_mount_handler() { fi if [[ "${copytoram}" == "y" ]]; then - msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..." + msg ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}" mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram - msg "done." fi - msg -n ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." - mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace - msg "done." + if [[ -n "${cow_device}" ]]; then + _mnt_dev "${cow_device}" "/cowspace" + else + msg ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." + mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace + fi + mkdir -p "/cowspace/${cow_directory}" local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do @@ -202,7 +239,7 @@ archiso_mount_handler() { if [[ "${copytoram}" == "y" ]]; then umount /bootmnt else - mkdir "${newroot}/bootmnt" + mkdir -p "${newroot}/bootmnt" mount --bind /bootmnt "${newroot}/bootmnt" fi } -- cgit v1.2.2 From 90fb8ea480dd2cc475963c0f29a412c9366c3f98 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:17 -0300 Subject: [archiso] Mount all fs on /run/archiso instead of / This allow to take control again of these mountpoints outside initramfs. (i.e: on deinitramfs stage at shutdown for unmount it) Signed-off-by: Gerardo Exequiel Pozzi --- README | 4 +-- archiso/hooks/archiso | 66 +++++++++++++++++++++------------------- archiso/hooks/archiso_loop_mnt | 5 +-- archiso/install/archiso | 4 --- archiso/install/archiso_loop_mnt | 2 +- 5 files changed, 40 insertions(+), 41 deletions(-) diff --git a/README b/README index 8f59be3..16c318f 100644 --- a/README +++ b/README @@ -47,13 +47,11 @@ INDEX Default: "N" (if no ${cow_device} is used) otherwise "P". * cowspace_size= Set the size of tmpfs /cowspace. This space is used for Copy-On-Write files of dm-snapshot. - (directory not visible outside initramfs) Size is in bytes (suffix with "k", "m" and "g") or in percentage of available RAM. Default: "75%" -* copytoram_size= Set the size of tmpfs /cowpytoram. This space is used for +* copytoram_size= Set the size of tmpfs. This space is used for copy of all SquashFS images used, if copytoram=y. - (directory not visible outside initramfs) Size is in bytes (suffix with "k", "m" and "g") or in percentage of available RAM. Default: "75%" diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 4b512ef..e4872e2 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -40,23 +40,23 @@ _mnt_fs() { if [[ "${cow_persistent}" == "P" ]]; then - if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then - msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow', using as persistent." + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow', using as persistent." else - msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as persistent." - dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null fi else - if [[ -f "/cowspace/${cow_directory}/${img_name}.cow" ]]; then - msg ":: Found '/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." - rm -f "/cowspace/${cow_directory}/${img_name}.cow" + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." + rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" fi - msg ":: Creating '/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." - dd of="/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null fi _next_loop_dev - rw_dev=$(_make_loop_dev "/cowspace/${cow_directory}/${img_name}.cow") + rw_dev=$(_make_loop_dev "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} @@ -77,11 +77,11 @@ _mnt_sfs() { if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." - if ! cp "${img}" "/copytoram/${img_fullname}" ; then - echo "ERROR: while copy '${img}' to '/copytoram/${img_fullname}'" + if ! cp "${img}" "/run/archiso/copytoram/${img_fullname}" ; then + echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'" launch_interactive_shell fi - img="/copytoram/${img_fullname}" + img="/run/archiso/copytoram/${img_fullname}" msg "done." fi _next_loop_dev @@ -100,6 +100,8 @@ _mnt_dev() { local fstype fserror + mkdir -p "${mnt}" + msg ":: Mounting '${dev}' to '${mnt}'" while ! poll_device "${dev}" 30; do @@ -132,7 +134,7 @@ _mnt_dev() { _verify_checksum() { local _status - cd "/bootmnt/${archisobasedir}" + cd "/run/archiso/bootmnt/${archisobasedir}" md5sum -c checksum.md5 > /checksum.log 2>&1 _status=$? cd "${OLDPWD}" @@ -150,9 +152,9 @@ run_hook() { [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" if [[ -z "${aitab}" ]]; then - aitab="/bootmnt/${archisobasedir}/aitab" + aitab="/run/archiso/bootmnt/${archisobasedir}/aitab" else - aitab="/bootmnt/${aitab}" + aitab="/run/archiso/bootmnt/${aitab}" fi if [[ -n "${cow_label}" ]]; then @@ -179,9 +181,9 @@ archiso_mount_handler() { _init_loop_dev if [[ "${archisodevice}" -ef "${cow_device}" ]]; then - _mnt_dev "${archisodevice}" "/bootmnt" + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" else - _mnt_dev "${archisodevice}" "/bootmnt" "-r" + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" fi if [[ ! -f "${aitab}" ]]; then @@ -192,7 +194,7 @@ archiso_mount_handler() { fi if [[ "${checksum}" == "y" ]]; then - if [[ -f "/bootmnt/${archisobasedir}/checksum.md5" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.md5" ]]; then msg -n ":: Self-test requested, please wait..." if _verify_checksum; then msg "done. Checksum is OK, continue booting." @@ -208,17 +210,19 @@ archiso_mount_handler() { fi if [[ "${copytoram}" == "y" ]]; then - msg ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}" - mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram + msg ":: Mounting /run/archiso/copytoram (tmpfs) filesystem, size=${copytoram_size}" + mkdir -p /run/archiso/copytoram + mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/archiso/copytoram fi if [[ -n "${cow_device}" ]]; then - _mnt_dev "${cow_device}" "/cowspace" + _mnt_dev "${cow_device}" "/run/archiso/cowspace" else - msg ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." - mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace + msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." + mkdir -p /run/archiso/cowspace + mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /run/archiso/cowspace fi - mkdir -p "/cowspace/${cow_directory}" + mkdir -p "/run/archiso/cowspace/${cow_directory}" local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do @@ -226,21 +230,21 @@ archiso_mount_handler() { [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then if [[ "${aitab_sfs_comp}" != "none" ]]; then - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/sfs/${aitab_img}" - _mnt_fs "/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" + _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" else - _mnt_fs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" + _mnt_fs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" fi else - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi done < "${aitab}" if [[ "${copytoram}" == "y" ]]; then - umount /bootmnt + umount /run/archiso/bootmnt else mkdir -p "${newroot}/bootmnt" - mount --bind /bootmnt "${newroot}/bootmnt" + mount --bind /run/archiso/bootmnt "${newroot}/bootmnt" fi } diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 13f8743..18419e3 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -20,9 +20,10 @@ archiso_loop_mount_handler () { msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}" FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null) if [ -n "${FSTYPE}" ]; then - if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then + mkdir -p /run/archiso/img_dev + if mount -r -t "${FSTYPE}" ${img_dev} /run/archiso/img_dev > /dev/null 2>&1; then _dev_loop=$(losetup -f) - losetup ${_dev_loop} /img_dev/${img_loop} + losetup ${_dev_loop} /run/archiso/img_dev/${img_loop} fi fi diff --git a/archiso/install/archiso b/archiso/install/archiso index 89642f0..d32c8ab 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -9,10 +9,6 @@ build () BINARIES="" FILES="" - add_dir /cowspace - add_dir /copytoram - add_dir /bootmnt - add_binary /lib/udev/cdrom_id add_binary /sbin/blockdev add_binary /sbin/dmsetup diff --git a/archiso/install/archiso_loop_mnt b/archiso/install/archiso_loop_mnt index 2c8d6f2..886cbb8 100644 --- a/archiso/install/archiso_loop_mnt +++ b/archiso/install/archiso_loop_mnt @@ -6,7 +6,7 @@ build () BINARIES="" FILES="" - add_dir /img_dev + SCRIPT="archiso_loop_mnt" } -- cgit v1.2.2 From 908551ef02771d370436b44c42db2c32a74e4a88 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:17 -0300 Subject: [archiso] Add support for img_label= and allow img_dev same as cow_dev * Support img_label= * Allow use img_dev= as cow_device= * Use new function _mnt_dev() from archiso. * Check for error while setting loopback device. Signed-off-by: Gerardo Exequiel Pozzi --- README | 4 +++- archiso/hooks/archiso_loop_mnt | 35 +++++++++++++++++------------------ 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README b/README index 16c318f..8a808cf 100644 --- a/README +++ b/README @@ -79,8 +79,10 @@ INDEX ** hooks/archiso_loop_mnt -* img_dev= Device where archiso-image.iso reside. +* img_label= Set the filesystem label where archiso-image.iso. Default: (unset) +* img_dev= Device where archiso-image.iso reside. + Default: (unset) or "/dev/disk/by-label/${img_label}" * img_loop= Full path where archiso-image.iso is located on ${img_dev} Default: (unset) diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 18419e3..c1b25df 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -1,7 +1,8 @@ # vim: set ft=sh: run_hook () { - if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then + [[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}" + if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then mount_handler="archiso_loop_mount_handler" fi } @@ -9,30 +10,28 @@ run_hook () { archiso_loop_mount_handler () { newroot="${1}" - msg ":: Waiting for boot device..." - while ! poll_device ${img_dev} 30; do - echo "ERROR: boot device didn't show up after 30 seconds..." + msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" + if [[ "${img_dev}" -ef "${cow_device}" ]]; then + _mnt_dev "${img_dev}" "/run/archiso/img_dev" + else + _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" + fi + + _dev_loop=$(losetup -f) + if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then + echo "ERROR: Setting loopback device '${_dev_loop}'" + echo " for file '/run/archiso/img_dev/${img_loop}'" echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell - done - - msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}" - FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null) - if [ -n "${FSTYPE}" ]; then - mkdir -p /run/archiso/img_dev - if mount -r -t "${FSTYPE}" ${img_dev} /run/archiso/img_dev > /dev/null 2>&1; then - _dev_loop=$(losetup -f) - losetup ${_dev_loop} /run/archiso/img_dev/${img_loop} - fi fi archiso_mount_handler ${newroot} - if [ "${copytoram}" = "y" ]; then - msg "::: Deataching loop device ${_dev_loop}" + if [[ "${copytoram}" == "y" ]]; then losetup -d ${_dev_loop} - msg "::: Unmounting ${img_dev}" - umount ${img_dev} + umount /run/archiso/img_dev + else + echo ${_dev_loop} > /run/archiso/img_dev_loop fi } -- cgit v1.2.2 From 59ad1113d9ba60153f0c056711856e7440cc20bb Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 23 Oct 2011 21:24:18 -0300 Subject: [archiso] Add archiso_shutdown hook. STATUS: Working (std boot, loop_mnt, pxe) with copytoram=[y|n]. NEEDS: initscript > 2011.07.3, mkinitcpio > 0.7.2, mkinitcpio-busybox > 1.18.5-1 Purpose: we need this for propertly unmount $cow_device, used for persistent dm-snapshot devices. This hook is based on work from Tom Gundersen[#1], but adapted for archiso things (specially the shutdown script) [#1] http://mailman.archlinux.org/pipermail/arch-projects/2011-July/001549.html [#2] http://projects.archlinux.org/initscripts.git/commit/?id=1fa7b4b453e96533ae1db3630031285e5fc302b3 [#3] http://mailman.archlinux.org/pipermail/arch-projects/2011-August/001749.html Signed-off-by: Gerardo Exequiel Pozzi --- README | 3 ++- archiso/Makefile | 6 ++++++ archiso/archiso_shutdown | 43 ++++++++++++++++++++++++++++++++++++++++ archiso/hooks/archiso_shutdown | 22 ++++++++++++++++++++ archiso/install/archiso_shutdown | 13 ++++++++++++ configs/releng/build.sh | 3 ++- configs/releng/mkinitcpio.conf | 2 +- 7 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 archiso/archiso_shutdown create mode 100644 archiso/hooks/archiso_shutdown create mode 100644 archiso/install/archiso_shutdown diff --git a/README b/README index 8a808cf..4588042 100644 --- a/README +++ b/README @@ -121,7 +121,8 @@ if nothing is specified on command line. * archiso_pxe_nbd + mkinitcpio-nfs-utils for ipconfig + nbd for nbd-client - +* archiso_shutdown + + (none) *** Image types generated by mkarchiso. diff --git a/archiso/Makefile b/archiso/Makefile index 4e8291e..aa137b8 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -12,6 +12,9 @@ install-hooks: # hooks/install are needed by mkinitcpio install -D -m 644 hooks/archiso $(DESTDIR)/lib/initcpio/hooks/archiso install -D -m 644 install/archiso $(DESTDIR)/lib/initcpio/install/archiso + install -D -m 755 archiso_shutdown $(DESTDIR)/lib/initcpio/archiso_shutdown + install -D -m 644 hooks/archiso_shutdown $(DESTDIR)/lib/initcpio/hooks/archiso_shutdown + install -D -m 644 install/archiso_shutdown $(DESTDIR)/lib/initcpio/install/archiso_shutdown install -D -m 644 archiso_pxe_nbd $(DESTDIR)/lib/initcpio/archiso_pxe_nbd install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd @@ -32,6 +35,9 @@ uninstall: rm -f $(DESTDIR)/usr/bin/testiso rm -f $(DESTDIR)/lib/initcpio/hooks/archiso rm -f $(DESTDIR)/lib/initcpio/install/archiso + rm -f $(DESTDIR)/lib/initcpio/archiso_shutdown + rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_shutdown + rm -f $(DESTDIR)/lib/initcpio/install/archiso_shutdown rm -f $(DESTDIR)/lib/initcpio/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown new file mode 100644 index 0000000..de1197e --- /dev/null +++ b/archiso/archiso_shutdown @@ -0,0 +1,43 @@ +#!/bin/sh + +# /oldroot depends on things inside /oldroot/run/archiso... +mkdir /oldrun +mount --move /oldroot/run /oldrun + +# Unmount all mounts now. +umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r) + +# Remove all dm-snapshot devices. +dmsetup remove_all + +# Remove all loopback devices made for dm-snapshots devices +# other misc loops like used for pure squashfs images +# and unmount/detach *.fs.sfs images. +for _lup in $(ls -r /dev/loop[1-9][0-9][0-9]); do + if ! losetup -d ${_lup} 2> /dev/null; then + umount -d ${_lup} + fi +done + +# Unmount the space used to store *.cow. +umount /oldrun/archiso/cowspace + +# Unmount boot device if needed (no copytoram=y used) +if [[ ! -d /oldrun/archiso/copytoram ]]; then + umount /oldrun/archiso/bootmnt + # Detach img_loop= and unmount img_dev= (archiso_loop_mnt hook) + if [[ -f /oldrun/archiso/img_dev_loop ]]; then + losetup -d $(cat /oldrun/archiso/img_dev_loop) + umount /oldrun/archiso/img_dev + fi + if [[ -f /oldrun/archiso/nbd_client.pid ]]; then + nbd-client -d /dev/nbd0 + fi +fi + +# reboot / poweroff / halt, depending on the argument passed by init +# if something invalid is passed, we halt +case "$1" in + reboot|poweroff|halt) "$1" -f ;; + *) halt -f;; +esac diff --git a/archiso/hooks/archiso_shutdown b/archiso/hooks/archiso_shutdown new file mode 100644 index 0000000..1cc6e0e --- /dev/null +++ b/archiso/hooks/archiso_shutdown @@ -0,0 +1,22 @@ +run_hook () +{ + msg -n ":: Creating shutdown ramfs..." + + mkdir -p /run/initramfs/usr/bin + mkdir /run/initramfs/usr/sbin + mkdir /run/initramfs/bin + mkdir /run/initramfs/sbin + mkdir /run/initramfs/lib + cp /bin/busybox /run/initramfs/bin/ + cp /lib/ld-* /run/initramfs/lib/ + cp /lib/lib* /run/initramfs/lib/ + cp /sbin/dmsetup /run/initramfs/sbin/ + if [[ -x /bin/nbd-client ]]; then + cp /bin/nbd-client /run/initramfs/bin/ + fi + + chroot /run/initramfs /bin/busybox --install + cp /shutdown /run/initramfs/ + + msg "done." +} diff --git a/archiso/install/archiso_shutdown b/archiso/install/archiso_shutdown new file mode 100644 index 0000000..49dfc8c --- /dev/null +++ b/archiso/install/archiso_shutdown @@ -0,0 +1,13 @@ +build() { + SCRIPT="archiso_shutdown" + add_binary /lib/initcpio/archiso_shutdown /shutdown +} + +help () { + cat < ${work_dir}/build.${FUNCNAME} fi diff --git a/configs/releng/mkinitcpio.conf b/configs/releng/mkinitcpio.conf index df833eb..f6b846c 100644 --- a/configs/releng/mkinitcpio.conf +++ b/configs/releng/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev memdisk archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput" +HOOKS="base udev memdisk archiso_shutdown archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput" COMPRESSION="xz" -- cgit v1.2.2 From 469b5b2c5824dfe5960ef7ad0a836fa949039613 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 5 Nov 2011 21:03:35 -0300 Subject: [archiso] install hook cleanups * Remove IDE stuff. * Remove modules that can be added via relevant hooks. * Replace sata with virtio in baseline profile. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/install/archiso | 6 +----- configs/baseline/mkinitcpio.conf | 2 +- configs/releng/mkinitcpio.conf | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/archiso/install/archiso b/archiso/install/archiso index d32c8ab..0bb0d0f 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -1,10 +1,6 @@ build () { - MODULES="cdrom ide-cd_mod ide-core ide-generic loop dm-mod dm-snapshot squashfs isofs $(all_modules '/kernel/fs' | grep -v "nls")" - MODULES="${MODULES} $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - MODULES="${MODULES} usb_storage sd_mod sr_mod" - MODULES="${MODULES} virtio_pci virtio_blk" - MODULES=$(echo ${MODULES}) #trim whitespace + MODULES="cdrom loop dm-snapshot" BINARIES="" FILES="" diff --git a/configs/baseline/mkinitcpio.conf b/configs/baseline/mkinitcpio.conf index 389ec51..a1aafa8 100644 --- a/configs/baseline/mkinitcpio.conf +++ b/configs/baseline/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev archiso sata filesystems" +HOOKS="base udev archiso virtio filesystems" COMPRESSION="xz" diff --git a/configs/releng/mkinitcpio.conf b/configs/releng/mkinitcpio.conf index f6b846c..72e6b2a 100644 --- a/configs/releng/mkinitcpio.conf +++ b/configs/releng/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev memdisk archiso_shutdown archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput" +HOOKS="base udev memdisk archiso_shutdown archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata virtio usb fw pcmcia filesystems usbinput" COMPRESSION="xz" -- cgit v1.2.2 From 7ab83b857125c46a1a891ea62c9610345ff77e2a Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 15 Nov 2011 19:37:10 -0300 Subject: [hooks/archiso_pxe_nbd] Remove grep usage Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_nbd | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index cc21c2b..cdf4392 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -1,6 +1,6 @@ # vim: set ft=sh: run_hook () { - local line i address netmask gateway dns0 dns1 rootserver rootpath filename + local line i net_mac bootif_mac bootif_dev address netmask gateway dns0 dns1 rootserver rootpath filename : > /ip_opts @@ -8,9 +8,14 @@ run_hook () { if [ -n "${BOOTIF}" ]; then bootif_mac=${BOOTIF#01-} bootif_mac=${bootif_mac//-/:} - bootif_dev=$(grep -l ${bootif_mac} /sys/class/net/*/address) - bootif_dev=${bootif_dev#/sys/class/net/} - bootif_dev=${bootif_dev%/address} + for i in /sys/class/net/*/address; do + read net_mac < ${i} + if [ "${bootif_mac}" == "${net_mac}" ]; then + bootif_dev=${i#/sys/class/net/} + bootif_dev=${bootif_dev%/address} + break + fi + done ip="${ip}::${bootif_dev}" fi -- cgit v1.2.2 From da813e5b9ded288764708b651b24a8be08cd9629 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 15 Nov 2011 22:28:53 -0300 Subject: [hooks/archiso_pxe_nbd] Refactor, remove sed usage. * ipconfig cmd writes a file in /tmp that is ready for direct evaluation. We can use this instead of parsing the output, to do this some variable renames are needed. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_nbd | 50 +++++++++-------------------------------- archiso/install/archiso_pxe_nbd | 2 ++ 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index cdf4392..be3db28 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -1,8 +1,12 @@ # vim: set ft=sh: run_hook () { - local line i net_mac bootif_mac bootif_dev address netmask gateway dns0 dns1 rootserver rootpath filename - - : > /ip_opts + local line i net_mac bootif_mac bootif_dev + # These variables will be parsed from /tmp/net-*.conf generated by ipconfig + local DEVICE + local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1 + local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH + local filename + # /tmp/net-*.conf if [ -n "${ip}" ]; then if [ -n "${BOOTIF}" ]; then @@ -20,45 +24,11 @@ run_hook () { fi # setup network and save some values - ipconfig "ip=${ip}" | while read line; do - # echo ":: ${line}" - if [ "${line#"IP-Config:"}" != "${line}" ]; then - continue - fi - line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')" - for i in ${line}; do - case "${i}" in - address=*) - echo "${i}" >> /ip_opts - ;; - netmask=*) - echo "${i}" >> /ip_opts - ;; - gateway=*) - echo "${i}" >> /ip_opts - ;; - dns0=*) - echo "${i}" >> /ip_opts - ;; - dns1=*) - echo "${i}" >> /ip_opts - ;; - rootserver=*) - echo "${i}" >> /ip_opts - ;; - rootpath=*) - echo "${i}" >> /ip_opts - ;; - esac - done - done - - . /ip_opts + ipconfig "ip=${ip}" - echo "IP-Config: ${address}/${netmask}" - echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}" + . /tmp/net-*.conf - nbdserver=${rootserver} + nbdserver=${ROOTSERVER} [[ -z "${archiso_nbd_name}" ]] && archiso_nbd_name="archiso" diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index 69a12ce..c26648c 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -12,6 +12,8 @@ build () FILES="" SCRIPT="archiso_pxe_nbd" + add_dir /tmp + add_binary "/usr/sbin/nbd-client" "/bin/nbd-client" add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" -- cgit v1.2.2 From 54d2e0336aa299a2134a9c030e1c270381b5edde Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 16 Nov 2011 23:16:38 -0300 Subject: [configs/releng] Remove inetutils from packages.* Is in {base} since 1.8-4. Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/packages.i686 | 1 - configs/releng/packages.x86_64 | 1 - 2 files changed, 2 deletions(-) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 5083750..7b66e41 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -14,7 +14,6 @@ elinks gnu-netcat gptfdisk hdparm -inetutils ipw2100-fw ipw2200-fw irssi diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 5083750..7b66e41 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -14,7 +14,6 @@ elinks gnu-netcat gptfdisk hdparm -inetutils ipw2100-fw ipw2200-fw irssi -- cgit v1.2.2 From baf0ae0013618f56f53ab94e55b83b0a1efc88f6 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 16 Nov 2011 21:35:46 -0300 Subject: [archiso] Do not bind mount on /bootmnt Boot media is already available in /run/archiso/bootmnt if no copytoram is used. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 3 --- 1 file changed, 3 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index e4872e2..ae17d40 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -242,9 +242,6 @@ archiso_mount_handler() { if [[ "${copytoram}" == "y" ]]; then umount /run/archiso/bootmnt - else - mkdir -p "${newroot}/bootmnt" - mount --bind /run/archiso/bootmnt "${newroot}/bootmnt" fi } -- cgit v1.2.2 From e135003c13aef15abc78562a3ab17fa41c0330cc Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 10:35:05 -0300 Subject: [archiso] simplify _mnt_dev() (mount is now from util-linux) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index ae17d40..5d9e5df 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -98,8 +98,6 @@ _mnt_dev() { local mnt="${2}" local flg="${3}" - local fstype fserror - mkdir -p "${mnt}" msg ":: Mounting '${dev}' to '${mnt}'" @@ -111,21 +109,10 @@ _mnt_dev() { launch_interactive_shell done - fstype=$(blkid -o value -s TYPE -p "${dev}" 2> /dev/null) - if [[ -n "${fstype}" ]]; then - if mount ${flg} -t "${fstype}" "${dev}" "${mnt}"; then - msg ":: Device '${dev}' mounted successfully." - fserror=0 - else - echo "ERROR; Failed to mount '${dev}' (FS is ${fstype})" - fserror=1 - fi + if mount "${flg}" "${dev}" "${mnt}"; then + msg ":: Device '${dev}' mounted successfully." else - echo "ERROR: '${dev}' found, but the filesystem type is unknown." - fserror=1 - fi - - if [[ ${fserror} -eq 1 ]]; then + echo "ERROR; Failed to mount '${dev}'" echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell -- cgit v1.2.2 From e03ed816e09cfbc0d7edaaf437c277574bf9104f Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 10:35:05 -0300 Subject: [archiso] Use different logic when archisodevice == cow_device * Now bootmnt/img_dev is always a ro-mount, and cowspace is first ro-mount then rw-mount. * Fix a "hidden" bug: at the time of test [[ -ef ]], if devices nodes are not ready, such test will fail then archisodevice will mounted ro and when cow_device is mounted to be rw it fails. (I recently suffered this on a machine with slow USB) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 9 +++------ archiso/hooks/archiso_loop_mnt | 6 +----- archiso/install/archiso | 3 +++ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 5d9e5df..f446bd2 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -167,11 +167,7 @@ archiso_mount_handler() { _init_loop_dev - if [[ "${archisodevice}" -ef "${cow_device}" ]]; then - _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" - else - _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" - fi + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" if [[ ! -f "${aitab}" ]]; then echo "ERROR: '${aitab}' file does not exist." @@ -203,7 +199,8 @@ archiso_mount_handler() { fi if [[ -n "${cow_device}" ]]; then - _mnt_dev "${cow_device}" "/run/archiso/cowspace" + _mnt_dev "${cow_device}" "/run/archiso/cowspace" "-r" + mount -o remount,rw "/run/archiso/cowspace" else msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." mkdir -p /run/archiso/cowspace diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index c1b25df..e52dc69 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -11,11 +11,7 @@ archiso_loop_mount_handler () { newroot="${1}" msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" - if [[ "${img_dev}" -ef "${cow_device}" ]]; then - _mnt_dev "${img_dev}" "/run/archiso/img_dev" - else - _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" - fi + _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" _dev_loop=$(losetup -f) if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then diff --git a/archiso/install/archiso b/archiso/install/archiso index 0bb0d0f..7984c53 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -14,6 +14,9 @@ build () add_file /lib/udev/rules.d/95-dm-notify.rules add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules + # Add an empty fstab to avoid mount warning when -o remount is used (this should go to install/base) + : > "$BUILDROOT/etc/fstab" + SCRIPT="archiso" } -- cgit v1.2.2 From f097724080a48e880728bcf8c57ef4a5433fbe44 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 10:35:05 -0300 Subject: [archiso] Only accepts aitab inside Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index f446bd2..839be9b 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -141,7 +141,7 @@ run_hook() { if [[ -z "${aitab}" ]]; then aitab="/run/archiso/bootmnt/${archisobasedir}/aitab" else - aitab="/run/archiso/bootmnt/${aitab}" + aitab="/run/archiso/bootmnt/${archisobasedir}/${aitab}" fi if [[ -n "${cow_label}" ]]; then -- cgit v1.2.2 From 334db092b52e78a68d012ce2fa453ec243943c64 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 10:35:05 -0300 Subject: [archiso] Check if /run/archiso/bootmnt is a mountpoint. In this way allow to mount /run/archiso/bootmnt from another hook, but still use the logic from the main mount_hook, skipping only this mount. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 2 +- archiso/install/archiso | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 839be9b..d03914a 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -167,7 +167,7 @@ archiso_mount_handler() { _init_loop_dev - _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" + mountpoint -q "/run/archiso/bootmnt" || _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" if [[ ! -f "${aitab}" ]]; then echo "ERROR: '${aitab}' file does not exist." diff --git a/archiso/install/archiso b/archiso/install/archiso index 7984c53..3b4e223 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -8,6 +8,7 @@ build () add_binary /lib/udev/cdrom_id add_binary /sbin/blockdev add_binary /sbin/dmsetup + add_binary /bin/mountpoint add_file /lib/udev/rules.d/60-cdrom_id.rules add_file /lib/udev/rules.d/10-dm.rules -- cgit v1.2.2 From 40965461a4a730881a153432e66521734b1b965c Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 10:35:05 -0300 Subject: [configs/*] chroot to root-image for initramfs build Avoid issues with -b BASEDIR (*). We became independent of the mkinitcpio version of the build environment. (*) For example of a recent issue: http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002202.html http://mailman.archlinux.org/pipermail/arch-projects/2011-November/002205.html Signed-off-by: Gerardo Exequiel Pozzi --- configs/baseline/build.sh | 8 +++----- configs/releng/build.sh | 41 ++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index ab7a88e..36cab15 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -24,6 +24,7 @@ make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install + cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf : > ${work_dir}/build.${FUNCNAME} fi } @@ -32,11 +33,8 @@ make_setup_mkinitcpio() { make_boot() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} - mkinitcpio \ - -c ${script_path}/mkinitcpio.conf \ - -b ${work_dir}/root-image \ - -k /boot/vmlinuz-linux \ - -g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${work_dir}/root-image + cp ${work_dir}/root-image/boot/archiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img cp ${work_dir}/root-image/boot/vmlinuz-linux ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz : > ${work_dir}/build.${FUNCNAME} fi diff --git a/configs/releng/build.sh b/configs/releng/build.sh index ba5cd2a..0859a17 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -24,21 +24,6 @@ make_packages() { mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create } -# Customize installation (root-image) -make_customize_root_image() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - cp -af ${script_path}/root-image ${work_dir} - chmod 750 ${work_dir}/root-image/etc/sudoers.d - chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel - mkdir -p ${work_dir}/root-image/etc/pacman.d - wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/ - sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist - chroot ${work_dir}/root-image /usr/sbin/locale-gen - chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" arch - : > ${work_dir}/build.${FUNCNAME} - fi -} - # Copy mkinitcpio archiso hooks (root-image) make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then @@ -49,6 +34,7 @@ make_setup_mkinitcpio() { done cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio + cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf : > ${work_dir}/build.${FUNCNAME} fi } @@ -59,11 +45,8 @@ make_boot() { local _src=${work_dir}/root-image local _dst_boot=${work_dir}/iso/${install_dir}/boot mkdir -p ${_dst_boot}/${arch} - mkinitcpio \ - -c ${script_path}/mkinitcpio.conf \ - -b ${_src} \ - -k /boot/vmlinuz-linux \ - -g ${_dst_boot}/${arch}/archiso.img + mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${_src} + mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING @@ -103,6 +86,22 @@ make_isolinux() { fi } +# Customize installation (root-image) +# NOTE: mkarchroot should not be executed after this function is executed, otherwise will overwrites some custom files. +make_customize_root_image() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + cp -af ${script_path}/root-image ${work_dir} + chmod 750 ${work_dir}/root-image/etc/sudoers.d + chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel + mkdir -p ${work_dir}/root-image/etc/pacman.d + wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/ + sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist + chroot ${work_dir}/root-image /usr/sbin/locale-gen + chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" arch + : > ${work_dir}/build.${FUNCNAME} + fi +} + # Split out /lib/modules from root-image (makes more "dual-iso" friendly) make_lib_modules() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then @@ -247,11 +246,11 @@ clean_dual () make_common_single() { make_basefs make_packages - make_customize_root_image make_setup_mkinitcpio make_boot make_syslinux make_isolinux + make_customize_root_image make_lib_modules make_usr_share make_aitab $1 -- cgit v1.2.2 From 1edaf15cef3420484d1dfbf08de43fe8d800ab64 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Split archiso_pxe_nbd in two hooks. One hook only setup the network device (archiso_pxe_common) the other setup the NBD client (archiso_pxe_nbd). New bootparam: archiso_pxe_srv=IP Allow to set an IP different from the PXE server. Signed-off-by: Gerardo Exequiel Pozzi --- README | 10 +++++++-- archiso/Makefile | 4 ++++ archiso/hooks/archiso_pxe_common | 34 ++++++++++++++++++++++++++++ archiso/hooks/archiso_pxe_nbd | 45 ++++++++------------------------------ archiso/install/archiso_pxe_common | 24 ++++++++++++++++++++ archiso/install/archiso_pxe_nbd | 9 -------- configs/releng/build.sh | 2 +- configs/releng/mkinitcpio.conf | 2 +- 8 files changed, 81 insertions(+), 49 deletions(-) create mode 100644 archiso/hooks/archiso_pxe_common create mode 100644 archiso/install/archiso_pxe_common diff --git a/README b/README index 4588042..0dd2179 100644 --- a/README +++ b/README @@ -63,7 +63,7 @@ INDEX Default: (architecture of running kernel) -** hooks/archiso_pxe_nbd +** hooks/archiso_pxe_common * ip= This parameter is setup automatically by PXELINUX when option "IPAPPEND" is set to 1 or 2 in config. @@ -73,8 +73,13 @@ INDEX when option "IPAPPEND" is set to 2 or 3 in config. BOOTIF= Default: (set via PXELINUX) + +** hooks/archiso_pxe_nbd + * archiso_nbd_name= Set NBD export name used by the server. Default: archiso +* archiso_nbd_srv= Set an IP address where NBD reside. + Default: "${pxeserver}" (The Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Add archiso_pxe_curl hook Its add support for downloading the ISO image via HTTP/FTP with curl or download *.sfs files. The files are downloaded on /run/archiso/curlspace (tmpfs) and setup a loop dev from it (like in archiso_loop_mnt) in the ISO case, or just do a bind mount to /run/archiso/bootmnt in the other case. This hook must be located after archiso_pxe_nbd in mkinitcpio.conf, in that way NBD is the default. New bootparm: * archiso_curl_url=(first form) archiso_curl_url=http://192.168.0.7/archlinux/iso/archlinux.iso (absolute form) Use an absolute URL. Fetch the entire ISO archiso_curl_url=ftp://${pxeserver}/archlinux/iso/archlinux.iso (relative form) Use the as IP the same server where PXE reside. Fetch the entire ISO * archiso_curl_url=(second form) archiso_curl_url=http://192.168.0.7/archlinux/iso/unpacked (absolute form) Use an absolute URL. Where unpacked (an example name) is a directory where ${archisobasedir} ("arch" by default) is located with all *.sfs. This fetch only needed files. archiso_curl_url=ftp://${pxeserver}/archlinux/iso/unpacked (relative form) Use the as IP the same server where PXE reside. Where unpacked (an example name) is a directory where ${archisobasedir} ("arch" by default) is located with all *.sfs. This fetch only needed files. * curlspace_size= Set a size for a tmpfs filesystem where files are downloaded. Signed-off-by: Gerardo Exequiel Pozzi --- README | 15 ++++++++ archiso/Makefile | 4 +++ archiso/hooks/archiso_pxe_curl | 75 ++++++++++++++++++++++++++++++++++++++++ archiso/install/archiso_pxe_curl | 18 ++++++++++ configs/releng/build.sh | 4 +-- configs/releng/mkinitcpio.conf | 2 +- configs/releng/packages.i686 | 1 - configs/releng/packages.x86_64 | 1 - 8 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 archiso/hooks/archiso_pxe_curl create mode 100644 archiso/install/archiso_pxe_curl diff --git a/README b/README index 0dd2179..dede082 100644 --- a/README +++ b/README @@ -74,6 +74,7 @@ INDEX BOOTIF= Default: (set via PXELINUX) + ** hooks/archiso_pxe_nbd * archiso_nbd_name= Set NBD export name used by the server. @@ -82,6 +83,18 @@ INDEX Default: "${pxeserver}" (The Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Add PXE NFS support It add support for using *.sfs images via NFS. It must be located after archiso_pxe_nbd in mkinitcpio.conf, in that way NBD is the default. New boot parameters: archiso_nfs_srv=IP:/path Set the NFS IP and path. Accepts ${pxeserver} as IP. archiso_nfs_opt= Sets NFS mount opts (comma separated) Defaults to: port = as given by server portmap daemon rsize = 1024 wsize = 1024 timeo = 7 retrans = 3 acregmin = 3 acregmax = 60 acdirmin = 30 acdirmax = 60 flags = hard, nointr, noposix, cto, ac :: Running Hook [archiso_pxe_common] IP-Config: eth0 hardware address 52:54:00:12:34:57 mtu 1500 IP-Config: eth0 guessed broadcast address 192.168.0.255 IP-Config: eth0 guessed nameserver address 192.168.0.218 IP-Config: eth0 complete (from 192.168.0.218): address: 192.168.0.90 broadcast: 192.168.0.255 netmask: 255.255.255.0 gateway: 192.168.0.218 dns0 : 192.168.0.218 dns1 : 0.0.0.0 rootserver: 192.168.0.218 rootpath: filename : :: Running Hook [archiso_pxe_nbd] :: Running Hook [archiso_pxe_curl] :: Running Hook [archiso_pxe_nfs] :: Mounting '192.168.0.77:/mnt/iso' ... 192.168.0.77:/mnt/iso/ on /run/archiso/bootmnt type nfs (rw,relatime,vers=3,rsize=524288,wsize=524288,namlen=255,hard,nolock,proto=tcp,port=65535,timeo=7,retrans=3,sec=sys,local_lock=all,addr=192.168.0.77) ... My /etc/exports /mnt/iso 192.168.0.90(ro,no_subtree_check,no_root_squash) --- README | 22 ++++++++++++++++++++++ archiso/Makefile | 4 ++++ archiso/hooks/archiso_pxe_nfs | 26 ++++++++++++++++++++++++++ archiso/install/archiso_pxe_nfs | 14 ++++++++++++++ configs/releng/build.sh | 2 +- configs/releng/mkinitcpio.conf | 2 +- 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 archiso/hooks/archiso_pxe_nfs create mode 100644 archiso/install/archiso_pxe_nfs diff --git a/README b/README index dede082..59c1724 100644 --- a/README +++ b/README @@ -95,6 +95,26 @@ INDEX Default: "75%" +** hooks/archiso_pxe_nfs + +* archiso_nfs_srv= Set the NFS-IP:/path of the server + In the IP part if ${pxeserver} is used, PXE IP will be used. + Default: (unset) +* archiso_nfs_opt= Set NFS mount options separated by comma. + Default: (unset, see below) + These are the implicit options: + port = as given by server portmap daemon + rsize = 1024 + wsize = 1024 + timeo = 7 + retrans = 3 + acregmin = 3 + acregmax = 60 + acdirmin = 30 + acdirmax = 60 + flags = hard, nointr, noposix, cto, ac + + ** hooks/archiso_loop_mnt * img_label= Set the filesystem label where archiso-image.iso. @@ -142,6 +162,8 @@ if nothing is specified on command line. + nbd for nbd-client * archiso_pxe_curl + curl for curl +* archiso_pxe_nfs + + mkinitcpio-nfs-utils for nfsmount * archiso_shutdown + (none) diff --git a/archiso/Makefile b/archiso/Makefile index 0dbbbf8..11aff53 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -22,6 +22,8 @@ install-hooks: install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd install -D -m 644 hooks/archiso_pxe_curl $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl install -D -m 644 install/archiso_pxe_curl $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl + install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs + install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt @@ -49,6 +51,8 @@ uninstall: rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl + rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs + rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt rm -f $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt rm -rf $(DESTDIR)/usr/share/archiso/ diff --git a/archiso/hooks/archiso_pxe_nfs b/archiso/hooks/archiso_pxe_nfs new file mode 100644 index 0000000..a053672 --- /dev/null +++ b/archiso/hooks/archiso_pxe_nfs @@ -0,0 +1,26 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_nfs_srv}" ]]; then + + archiso_nfs_srv=$(eval echo ${archiso_nfs_srv}) + [[ -n "${archiso_nfs_opt}" ]] && archiso_nfs_opt="-o ${archiso_nfs_opt}" + + mount_handler="archiso_nfs_mount_handler" + fi +} + +archiso_nfs_mount_handler() { + newroot="${1}" + mkdir -p "/run/archiso/bootmnt" + msg ":: Mounting '${archiso_nfs_srv}'" + # Do not put "${archiso_nfs_opt}" nfsmount fails! + if ! nfsmount ${archiso_nfs_opt} "${archiso_nfs_srv}" "/run/archiso/bootmnt"; then + echo "ERROR: Mounting '${archiso_nfs_srv}'" + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + fi + + archiso_mount_handler ${newroot} +} diff --git a/archiso/install/archiso_pxe_nfs b/archiso/install/archiso_pxe_nfs new file mode 100644 index 0000000..52be9f3 --- /dev/null +++ b/archiso/install/archiso_pxe_nfs @@ -0,0 +1,14 @@ +# vim: set ft=sh: + +build() { + MODULES="nfs" + SCRIPT="archiso_pxe_nfs" + + add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount" +} + +help() { + cat < Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Add DNS resolver support to archiso_pxe_common [ramfs /]# cat /etc/resolv.conf nameserver 192.168.0.77 [ramfs /]# curl -O http://releng.archlinux.org/pxeboot/README % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1129 100 1129 0 0 2191 0 --:--:-- --:--:-- --:--:-- 4589 [ramfs /]# Do not "add_binary /lib/libnss_dns.so.2", because will add libnss_dns-VERSION.so.2 as libnss_dns.so.2 Is not an issue will work (nobody links directly to VERSION), but is not nice. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_common | 8 ++++++++ archiso/install/archiso_pxe_common | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/archiso/hooks/archiso_pxe_common b/archiso/hooks/archiso_pxe_common index cf9fce8..febb503 100644 --- a/archiso/hooks/archiso_pxe_common +++ b/archiso/hooks/archiso_pxe_common @@ -30,5 +30,13 @@ run_hook () { . /tmp/net-*.conf pxeserver=${ROOTSERVER} + + # setup DNS resolver + if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then + echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf + fi + if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then + echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf + fi fi } diff --git a/archiso/install/archiso_pxe_common b/archiso/install/archiso_pxe_common index ebf908e..7dc1ebb 100644 --- a/archiso/install/archiso_pxe_common +++ b/archiso/install/archiso_pxe_common @@ -11,9 +11,18 @@ build () FILES="" SCRIPT="archiso_pxe_common" + # Add here for now, but this should go to "install/base". add_dir /tmp + add_dir /etc add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" + + # Add hosts support files+dns + add_symlink $(readlink /lib/libnss_files.so.2) /lib/libnss_files.so.2 + add_binary $(readlink -f /lib/libnss_files.so.2) + add_symlink $(readlink /lib/libnss_dns.so.2) /lib/libnss_dns.so.2 + add_binary $(readlink -f /lib/libnss_dns.so.2) + echo "hosts: files dns" > $BUILDROOT/etc/nsswitch.conf } help () -- cgit v1.2.2 From 0411fc90bbece254373808fb02ed2e3ce9d75758 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [configs/releng] Make all syslinux bootloaders works with the sames configs. * In that way, we have unified directory scheme among {pxe,sys,ext,iso}linux, sharing the same directory structure and config files. * Also enable IPAPPEND (will show a warning message about unknown directive in non-pxelinux before menu) NEW: * Rename syslinux*.cfg -> archiso*.cfg * Now syslinux.cfg is only a "loadconfig" trick like we are doing for isolinux * All paths are now relative to %INSTALL_DIR% ($archisobasedir) (Default: /arch/) Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/build.sh | 10 ++-- configs/releng/isolinux/isolinux.cfg | 4 +- configs/releng/syslinux.dual/archiso.cfg | 12 ++++ configs/releng/syslinux.dual/archiso_32only.cfg | 3 + configs/releng/syslinux.dual/archiso_arch32.cfg | 10 ++++ configs/releng/syslinux.dual/archiso_arch64.cfg | 10 ++++ configs/releng/syslinux.dual/archiso_both.cfg | 4 ++ configs/releng/syslinux.dual/archiso_head.cfg | 28 +++++++++ configs/releng/syslinux.dual/archiso_tail.cfg | 29 ++++++++++ configs/releng/syslinux.dual/syslinux.cfg | 15 ++--- configs/releng/syslinux.dual/syslinux_32only.cfg | 3 - configs/releng/syslinux.dual/syslinux_arch32.cfg | 11 ---- configs/releng/syslinux.dual/syslinux_arch64.cfg | 11 ---- configs/releng/syslinux.dual/syslinux_both.cfg | 4 -- configs/releng/syslinux.dual/syslinux_head.cfg | 28 --------- configs/releng/syslinux.dual/syslinux_tail.cfg | 29 ---------- configs/releng/syslinux/archiso.cfg | 69 ++++++++++++++++++++++ configs/releng/syslinux/syslinux.cfg | 73 ++---------------------- 18 files changed, 181 insertions(+), 172 deletions(-) create mode 100644 configs/releng/syslinux.dual/archiso.cfg create mode 100644 configs/releng/syslinux.dual/archiso_32only.cfg create mode 100644 configs/releng/syslinux.dual/archiso_arch32.cfg create mode 100644 configs/releng/syslinux.dual/archiso_arch64.cfg create mode 100644 configs/releng/syslinux.dual/archiso_both.cfg create mode 100644 configs/releng/syslinux.dual/archiso_head.cfg create mode 100644 configs/releng/syslinux.dual/archiso_tail.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_32only.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_arch32.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_arch64.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_both.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_head.cfg delete mode 100644 configs/releng/syslinux.dual/syslinux_tail.cfg create mode 100644 configs/releng/syslinux/archiso.cfg diff --git a/configs/releng/build.sh b/configs/releng/build.sh index aebf04a..28181c6 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -60,9 +60,11 @@ make_syslinux() { local _src_syslinux=${work_dir}/root-image/usr/lib/syslinux local _dst_syslinux=${work_dir}/iso/${install_dir}/boot/syslinux mkdir -p ${_dst_syslinux} - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g; - s|%ARCH%|${arch}|g" ${script_path}/syslinux/syslinux.cfg > ${_dst_syslinux}/syslinux.cfg + for _cfg in ${script_path}/syslinux/*.cfg; do + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g; + s|%ARCH%|${arch}|g" ${_cfg} > ${_dst_syslinux}/${_cfg##*/} + done cp ${script_path}/syslinux/splash.png ${_dst_syslinux} cp ${_src_syslinux}/*.c32 ${_dst_syslinux} cp ${_src_syslinux}/*.com ${_dst_syslinux} @@ -188,7 +190,7 @@ make_dual() { cp -a -l -f ${_src_one} ${work_dir}/dual cp -a -l -n ${_src_two} ${work_dir}/dual rm -f ${work_dir}/dual/iso/${install_dir}/aitab - rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/syslinux.cfg + rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/*.cfg if [[ ${_iso_type} == "core" ]]; then if [[ ! -e ${work_dir}/dual/iso/${install_dir}/any/repo-core-any.sfs || ! -e ${work_dir}/dual/iso/${install_dir}/i686/repo-core-i686.sfs || diff --git a/configs/releng/isolinux/isolinux.cfg b/configs/releng/isolinux/isolinux.cfg index e7bbaa4..1040d3f 100644 --- a/configs/releng/isolinux/isolinux.cfg +++ b/configs/releng/isolinux/isolinux.cfg @@ -1,5 +1,5 @@ DEFAULT loadconfig LABEL loadconfig - CONFIG /%INSTALL_DIR%/boot/syslinux/syslinux.cfg - APPEND /%INSTALL_DIR%/boot/syslinux/ + CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg + APPEND /%INSTALL_DIR%/ diff --git a/configs/releng/syslinux.dual/archiso.cfg b/configs/releng/syslinux.dual/archiso.cfg new file mode 100644 index 0000000..9994e43 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso.cfg @@ -0,0 +1,12 @@ +DEFAULT choose +PROMPT 0 + +LABEL choose +KERNEL boot/syslinux/ifcpu64.c32 +APPEND have64 -- nohave64 + +LABEL have64 +CONFIG boot/syslinux/archiso_both.cfg + +LABEL nohave64 +CONFIG boot/syslinux/archiso_32only.cfg diff --git a/configs/releng/syslinux.dual/archiso_32only.cfg b/configs/releng/syslinux.dual/archiso_32only.cfg new file mode 100644 index 0000000..e0cad88 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_32only.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_arch32.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_arch32.cfg b/configs/releng/syslinux.dual/archiso_arch32.cfg new file mode 100644 index 0000000..e7c7e23 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_arch32.cfg @@ -0,0 +1,10 @@ +LABEL arch32 +TEXT HELP +Boot the Arch Linux (i686) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_arch64.cfg b/configs/releng/syslinux.dual/archiso_arch64.cfg new file mode 100644 index 0000000..aee7bb0 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_arch64.cfg @@ -0,0 +1,10 @@ +LABEL arch64 +TEXT HELP +Boot the Arch Linux (x86_64) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_both.cfg b/configs/releng/syslinux.dual/archiso_both.cfg new file mode 100644 index 0000000..493ee81 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_both.cfg @@ -0,0 +1,4 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_arch32.cfg +INCLUDE boot/syslinux/archiso_arch64.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_head.cfg b/configs/releng/syslinux.dual/archiso_head.cfg new file mode 100644 index 0000000..929872e --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_head.cfg @@ -0,0 +1,28 @@ +SERIAL 0 38400 +DEFAULT boot/syslinux/vesamenu.c32 +PROMPT 0 +MENU TITLE Arch Linux +MENU BACKGROUND boot/syslinux/splash.png +TIMEOUT 3000 + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 7 +MENU VSHIFT 10 +MENU TIMEOUTROW 13 +MENU TABMSGROW 11 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux.dual/archiso_tail.cfg b/configs/releng/syslinux.dual/archiso_tail.cfg new file mode 100644 index 0000000..a2040d1 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_tail.cfg @@ -0,0 +1,29 @@ +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +COM32 boot/syslinux/chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +LINUX boot/memtest + +# http://hdt-project.org/ +LABEL hdt +MENU LABEL Hardware Information (HDT) +COM32 boot/syslinux/hdt.c32 +APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz + +LABEL reboot +MENU LABEL Reboot +COM32 boot/syslinux/reboot.c32 + +LABEL poweroff +MENU LABEL Power Off +COMBOOT boot/syslinux/poweroff.com + +ONTIMEOUT arch32 diff --git a/configs/releng/syslinux.dual/syslinux.cfg b/configs/releng/syslinux.dual/syslinux.cfg index ac92998..1040d3f 100644 --- a/configs/releng/syslinux.dual/syslinux.cfg +++ b/configs/releng/syslinux.dual/syslinux.cfg @@ -1,12 +1,5 @@ -DEFAULT choose -PROMPT 0 +DEFAULT loadconfig -LABEL choose -KERNEL ifcpu64.c32 -APPEND have64 -- nohave64 - -LABEL have64 -CONFIG syslinux_both.cfg - -LABEL nohave64 -CONFIG syslinux_32only.cfg +LABEL loadconfig + CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg + APPEND /%INSTALL_DIR%/ diff --git a/configs/releng/syslinux.dual/syslinux_32only.cfg b/configs/releng/syslinux.dual/syslinux_32only.cfg deleted file mode 100644 index c7a452d..0000000 --- a/configs/releng/syslinux.dual/syslinux_32only.cfg +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDE syslinux_head.cfg -INCLUDE syslinux_arch32.cfg -INCLUDE syslinux_tail.cfg diff --git a/configs/releng/syslinux.dual/syslinux_arch32.cfg b/configs/releng/syslinux.dual/syslinux_arch32.cfg deleted file mode 100644 index 9b4030e..0000000 --- a/configs/releng/syslinux.dual/syslinux_arch32.cfg +++ /dev/null @@ -1,11 +0,0 @@ -LABEL arch32 -TEXT HELP -Boot the Arch Linux (i686) live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (i686) -LINUX /%INSTALL_DIR%/boot/i686/vmlinuz -INITRD /%INSTALL_DIR%/boot/i686/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -# Next line should be uncommented when prepare enviroment to boot from PXE. -#IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/syslinux_arch64.cfg b/configs/releng/syslinux.dual/syslinux_arch64.cfg deleted file mode 100644 index 6cc644d..0000000 --- a/configs/releng/syslinux.dual/syslinux_arch64.cfg +++ /dev/null @@ -1,11 +0,0 @@ -LABEL arch64 -TEXT HELP -Boot the Arch Linux (x86_64) live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (x86_64) -LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz -INITRD /%INSTALL_DIR%/boot/x86_64/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -# Next line should be uncommented when prepare enviroment to boot from PXE. -#IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/syslinux_both.cfg b/configs/releng/syslinux.dual/syslinux_both.cfg deleted file mode 100644 index 9cd1584..0000000 --- a/configs/releng/syslinux.dual/syslinux_both.cfg +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDE syslinux_head.cfg -INCLUDE syslinux_arch32.cfg -INCLUDE syslinux_arch64.cfg -INCLUDE syslinux_tail.cfg diff --git a/configs/releng/syslinux.dual/syslinux_head.cfg b/configs/releng/syslinux.dual/syslinux_head.cfg deleted file mode 100644 index f46ba78..0000000 --- a/configs/releng/syslinux.dual/syslinux_head.cfg +++ /dev/null @@ -1,28 +0,0 @@ -SERIAL 0 38400 -DEFAULT vesamenu.c32 -PROMPT 0 -MENU TITLE Arch Linux -MENU BACKGROUND splash.png -TIMEOUT 3000 - -MENU WIDTH 78 -MENU MARGIN 4 -MENU ROWS 7 -MENU VSHIFT 10 -MENU TIMEOUTROW 13 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW 29 - -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu - -MENU COLOR border 30;44 #40ffffff #a0000000 std -MENU COLOR title 1;36;44 #9033ccff #a0000000 std -MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all -MENU COLOR unsel 37;44 #50ffffff #a0000000 std -MENU COLOR help 37;40 #c0ffffff #a0000000 std -MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std -MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std -MENU COLOR msg07 37;40 #90ffffff #a0000000 std -MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux.dual/syslinux_tail.cfg b/configs/releng/syslinux.dual/syslinux_tail.cfg deleted file mode 100644 index 7dd1270..0000000 --- a/configs/releng/syslinux.dual/syslinux_tail.cfg +++ /dev/null @@ -1,29 +0,0 @@ -LABEL existing -TEXT HELP -Boot an existing operating system. Press TAB to edit the disk and partition -number to boot. -ENDTEXT -MENU LABEL Boot existing OS -COM32 chain.c32 -APPEND hd0 0 - -# http://www.memtest.org/ -LABEL memtest -MENU LABEL Run Memtest86+ (RAM test) -LINUX /%INSTALL_DIR%/boot/memtest - -# http://hdt-project.org/ -LABEL hdt -MENU LABEL Hardware Information (HDT) -COM32 hdt.c32 -APPEND modules_alias=hdt/modalias.gz pciids=hdt/pciids.gz - -LABEL reboot -MENU LABEL Reboot -COM32 reboot.c32 - -LABEL poweroff -MENU LABEL Power Off -COMBOOT poweroff.com - -ONTIMEOUT arch32 diff --git a/configs/releng/syslinux/archiso.cfg b/configs/releng/syslinux/archiso.cfg new file mode 100644 index 0000000..e508bcc --- /dev/null +++ b/configs/releng/syslinux/archiso.cfg @@ -0,0 +1,69 @@ +SERIAL 0 38400 +DEFAULT boot/syslinux/vesamenu.c32 +PROMPT 0 +MENU TITLE Arch Linux +MENU BACKGROUND boot/syslinux/splash.png +TIMEOUT 3000 + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 6 +MENU VSHIFT 10 +MENU TIMEOUTROW 13 +MENU TABMSGROW 11 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std + +LABEL arch +TEXT HELP +Boot the Arch Linux live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +IPAPPEND 3 + +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +COM32 boot/syslinux/chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +LINUX boot/memtest + +# http://hdt-project.org/ +LABEL hdt +MENU LABEL Hardware Information (HDT) +COM32 boot/syslinux/hdt.c32 +APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz + +LABEL reboot +MENU LABEL Reboot +COM32 boot/syslinux/reboot.c32 + +LABEL poweroff +MENU LABEL Power Off +COMBOOT boot/syslinux/poweroff.com + +ONTIMEOUT arch diff --git a/configs/releng/syslinux/syslinux.cfg b/configs/releng/syslinux/syslinux.cfg index 7762278..1040d3f 100644 --- a/configs/releng/syslinux/syslinux.cfg +++ b/configs/releng/syslinux/syslinux.cfg @@ -1,70 +1,5 @@ -SERIAL 0 38400 -DEFAULT vesamenu.c32 -PROMPT 0 -MENU TITLE Arch Linux -MENU BACKGROUND splash.png -TIMEOUT 3000 +DEFAULT loadconfig -MENU WIDTH 78 -MENU MARGIN 4 -MENU ROWS 6 -MENU VSHIFT 10 -MENU TIMEOUTROW 13 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW 29 - -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu - -MENU COLOR border 30;44 #40ffffff #a0000000 std -MENU COLOR title 1;36;44 #9033ccff #a0000000 std -MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all -MENU COLOR unsel 37;44 #50ffffff #a0000000 std -MENU COLOR help 37;40 #c0ffffff #a0000000 std -MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std -MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std -MENU COLOR msg07 37;40 #90ffffff #a0000000 std -MENU COLOR tabmsg 31;40 #30ffffff #00000000 std - -LABEL arch -TEXT HELP -Boot the Arch Linux live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux -LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz -INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -# Next line should be uncommented when prepare enviroment to boot from PXE. -#IPAPPEND 3 - -LABEL existing -TEXT HELP -Boot an existing operating system. Press TAB to edit the disk and partition -number to boot. -ENDTEXT -MENU LABEL Boot existing OS -COM32 chain.c32 -APPEND hd0 0 - -# http://www.memtest.org/ -LABEL memtest -MENU LABEL Run Memtest86+ (RAM test) -LINUX /%INSTALL_DIR%/boot/memtest - -# http://hdt-project.org/ -LABEL hdt -MENU LABEL Hardware Information (HDT) -COM32 hdt.c32 -APPEND modules_alias=hdt/modalias.gz pciids=hdt/pciids.gz - -LABEL reboot -MENU LABEL Reboot -COM32 reboot.c32 - -LABEL poweroff -MENU LABEL Power Off -COMBOOT poweroff.com - -ONTIMEOUT arch +LABEL loadconfig + CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg + APPEND /%INSTALL_DIR%/ -- cgit v1.2.2 From cd359bc37a23bdfdb751883f33f6972229648cf7 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Checksum only aitab and *.sfs (per architecture) We are currently checksuming all files inside $archisobasedir (aitab, *sfs, kernel/initramfs and boot/syslinux related files) this is stored in one file only. Its works good for now, but I think we only need to checksum only aitab and *.sfs if they are needed. Currently if you boot a dual-iso in i686, also checksum is done for *.sfs of x86_64. Not a big issue, this just take a bit more time. The real issue is when booting via PXE with HTTP/FTP methods, since they download only aitab and needed *.sfs files, can not use directly the only one file where checksums are stored. This patch does: (1) Do not checksum syslinux related files, anyway you are already reach initramfs stage. (2) Do not checksum kernel/initramfs files, for the same as (1) (3) Two checksum.${arch}.md5 for each i686 and x86_64 for only aitab and *.sfs. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 8 ++++---- archiso/mkarchiso | 24 +++++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index d03914a..e4ed52b 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -122,7 +122,7 @@ _mnt_dev() { _verify_checksum() { local _status cd "/run/archiso/bootmnt/${archisobasedir}" - md5sum -c checksum.md5 > /checksum.log 2>&1 + md5sum -c checksum.${arch}.md5 > /tmp/checksum.${arch}.log 2>&1 _status=$? cd "${OLDPWD}" return ${_status} @@ -177,17 +177,17 @@ archiso_mount_handler() { fi if [[ "${checksum}" == "y" ]]; then - if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.md5" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.${arch}.md5" ]]; then msg -n ":: Self-test requested, please wait..." if _verify_checksum; then msg "done. Checksum is OK, continue booting." else echo "ERROR: one or more files are corrupted" - echo "see /checksum.log for details" + echo "see /tmp/checksum.${arch}.log for details" launch_interactive_shell fi else - echo "ERROR: checksum=y option specified but checksum.md5 not found" + echo "ERROR: checksum=y option specified but checksum.${arch}.md5 not found" launch_interactive_shell fi fi diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 5d77128..fed953e 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -299,13 +299,23 @@ _mkfs () { command_checksum () { _show_config checksum - if _is_directory_changed "${work_dir}/iso/${install_dir}" "${work_dir}/iso/${install_dir}/checksum.md5"; then - _msg_info "Creating checksum file for self-test" - cd "${work_dir}/iso/${install_dir}" - find -type f ! -name checksum.md5 -print0 | xargs -0 md5sum > checksum.md5 - cd ${OLDPWD} - _msg_info "Done!" - fi + local _chk_arch + + for _chk_arch in i686 x86_64; do + if _is_directory_changed "${work_dir}/iso/${install_dir}" "${work_dir}/iso/${install_dir}/checksum.${_chk_arch}.md5"; then + _msg_info "Creating checksum file for self-test (${_chk_arch})" + cd "${work_dir}/iso/${install_dir}" + if [[ -d "${_chk_arch}" ]]; then + md5sum aitab > checksum.${_chk_arch}.md5 + find ${_chk_arch} -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5 + if [[ -d "any" ]]; then + find any -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5 + fi + fi + cd ${OLDPWD} + _msg_info "Done!" + fi + done } # Create an ISO9660 filesystem from "iso" directory. -- cgit v1.2.2 From 5b9eba924d0e700ba9023e5f73bcccc5f8ee28c8 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 28 Nov 2011 12:28:03 -0300 Subject: [archiso] Add checksum support to pxe_curl Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_pxe_curl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/archiso/hooks/archiso_pxe_curl b/archiso/hooks/archiso_pxe_curl index 7a553ad..80315bc 100644 --- a/archiso/hooks/archiso_pxe_curl +++ b/archiso/hooks/archiso_pxe_curl @@ -55,6 +55,10 @@ archiso_pxe_curl_mount_handler () { fi done < "${_aitab_file}" + if [[ "${checksum}" == "y" ]]; then + _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "${archisobasedir}" + fi + mkdir -p "/run/archiso/bootmnt" mount -o bind /run/archiso/curlspace /run/archiso/bootmnt else -- cgit v1.2.2 From f3a3526ab01ceea9cf84828c44a718a46f6311ee Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Tue, 29 Nov 2011 09:39:30 -0300 Subject: [archiso] Fix libnss symlinks. Otherwise does not work. 22100 Nov 29 09:29 ./lib/libnss_dns-2.14.1.so 20 Nov 29 09:29 ./lib/libnss_dns.so.2 -> libnss_dns-2.14.1.so 46732 Nov 29 09:29 ./lib/libnss_files-2.14.1.so 22 Nov 29 09:29 ./lib/libnss_files.so.2 -> libnss_files-2.14.1.so Looks like my test was made before introducing symlinks and using directly libnss_dns-$VERSION.so.2 as libnss_dns.so.2. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/install/archiso_pxe_common | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archiso/install/archiso_pxe_common b/archiso/install/archiso_pxe_common index 7dc1ebb..ce54f7a 100644 --- a/archiso/install/archiso_pxe_common +++ b/archiso/install/archiso_pxe_common @@ -18,9 +18,9 @@ build () add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" # Add hosts support files+dns - add_symlink $(readlink /lib/libnss_files.so.2) /lib/libnss_files.so.2 + add_symlink /lib/libnss_files.so.2 $(readlink /lib/libnss_files.so.2) add_binary $(readlink -f /lib/libnss_files.so.2) - add_symlink $(readlink /lib/libnss_dns.so.2) /lib/libnss_dns.so.2 + add_symlink /lib/libnss_dns.so.2 $(readlink /lib/libnss_dns.so.2) add_binary $(readlink -f /lib/libnss_dns.so.2) echo "hosts: files dns" > $BUILDROOT/etc/nsswitch.conf } -- cgit v1.2.2 From cd91ad28b04dd5f07f5f6cc0b3b59f92d902326d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Tue, 29 Nov 2011 13:26:13 +0100 Subject: Add common KMS modules to the releng initramfs image. On machines with common graphics chipsets (radeon, intel, nvidia), enable KMS early. Downloading images from a remote server can take time, better view the status with a nice resolution. --- archiso/Makefile | 2 ++ archiso/install/archiso_kms | 14 ++++++++++++++ configs/releng/mkinitcpio.conf | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 archiso/install/archiso_kms diff --git a/archiso/Makefile b/archiso/Makefile index 11aff53..a073adf 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -26,6 +26,7 @@ install-hooks: install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt + install -D -m 644 install/archiso_kms $(DESTDIR)/lib/initcpio/install/archiso_kms install-examples: # install examples @@ -55,6 +56,7 @@ uninstall: rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt rm -f $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt + rm -f $(DESTDIR)/lib/initcpio/install/archiso_kms rm -rf $(DESTDIR)/usr/share/archiso/ .PHONY: install install-program install-hooks install-examples install-doc uninstall diff --git a/archiso/install/archiso_kms b/archiso/install/archiso_kms new file mode 100644 index 0000000..6566049 --- /dev/null +++ b/archiso/install/archiso_kms @@ -0,0 +1,14 @@ +#!/bin/bash + +build() { + MODULES="radeon nouveau i915 via-agp sis-agp intel-agp" + if [[ $(uname -m) == i686 ]]; then + MODULES+=" amd64-agp ati-agp sworks-agp ali-agp amd-k7-agp nvidia-agp efficeon-agp" + fi +} + +help() { + cat << HELPEOF +Adds all common KMS drivers to the initramfs image. +HELPEOF +} diff --git a/configs/releng/mkinitcpio.conf b/configs/releng/mkinitcpio.conf index 8d77dee..5570ed6 100644 --- a/configs/releng/mkinitcpio.conf +++ b/configs/releng/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_curl archiso_pxe_nfs pata scsi sata virtio usb fw pcmcia filesystems usbinput" +HOOKS="base udev memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_curl archiso_pxe_nfs archiso_kms pata scsi sata virtio usb fw pcmcia filesystems usbinput" COMPRESSION="xz" -- cgit v1.2.2 From d97553d8c6d0266abda2ae50fd74fb200752b3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20B=C3=A4chler?= Date: Tue, 29 Nov 2011 14:36:04 +0100 Subject: actually copy the archiso_kms hook to workdir --- configs/releng/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 28181c6..1251c79 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -32,6 +32,7 @@ make_setup_mkinitcpio() { cp /lib/initcpio/hooks/${_hook} ${work_dir}/root-image/lib/initcpio/hooks cp /lib/initcpio/install/${_hook} ${work_dir}/root-image/lib/initcpio/install done + cp /lib/initcpio/install/archiso_kms ${work_dir}/root-image/lib/initcpio/install cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf -- cgit v1.2.2 From 7c83ce219a8e27cbe46319bce6a608b60cfe53db Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 2 Dec 2011 00:44:02 -0300 Subject: [configs/releng] Split syslinux cfgs in single arch, like in dual arch Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/syslinux/archiso.cfg | 72 ++------------------------------ configs/releng/syslinux/archiso_head.cfg | 28 +++++++++++++ configs/releng/syslinux/archiso_sys.cfg | 10 +++++ configs/releng/syslinux/archiso_tail.cfg | 29 +++++++++++++ 4 files changed, 70 insertions(+), 69 deletions(-) create mode 100644 configs/releng/syslinux/archiso_head.cfg create mode 100644 configs/releng/syslinux/archiso_sys.cfg create mode 100644 configs/releng/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso.cfg b/configs/releng/syslinux/archiso.cfg index e508bcc..1228355 100644 --- a/configs/releng/syslinux/archiso.cfg +++ b/configs/releng/syslinux/archiso.cfg @@ -1,69 +1,3 @@ -SERIAL 0 38400 -DEFAULT boot/syslinux/vesamenu.c32 -PROMPT 0 -MENU TITLE Arch Linux -MENU BACKGROUND boot/syslinux/splash.png -TIMEOUT 3000 - -MENU WIDTH 78 -MENU MARGIN 4 -MENU ROWS 6 -MENU VSHIFT 10 -MENU TIMEOUTROW 13 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW 29 - -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu - -MENU COLOR border 30;44 #40ffffff #a0000000 std -MENU COLOR title 1;36;44 #9033ccff #a0000000 std -MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all -MENU COLOR unsel 37;44 #50ffffff #a0000000 std -MENU COLOR help 37;40 #c0ffffff #a0000000 std -MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std -MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std -MENU COLOR msg07 37;40 #90ffffff #a0000000 std -MENU COLOR tabmsg 31;40 #30ffffff #00000000 std - -LABEL arch -TEXT HELP -Boot the Arch Linux live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux -LINUX boot/%ARCH%/vmlinuz -INITRD boot/%ARCH%/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -IPAPPEND 3 - -LABEL existing -TEXT HELP -Boot an existing operating system. Press TAB to edit the disk and partition -number to boot. -ENDTEXT -MENU LABEL Boot existing OS -COM32 boot/syslinux/chain.c32 -APPEND hd0 0 - -# http://www.memtest.org/ -LABEL memtest -MENU LABEL Run Memtest86+ (RAM test) -LINUX boot/memtest - -# http://hdt-project.org/ -LABEL hdt -MENU LABEL Hardware Information (HDT) -COM32 boot/syslinux/hdt.c32 -APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz - -LABEL reboot -MENU LABEL Reboot -COM32 boot/syslinux/reboot.c32 - -LABEL poweroff -MENU LABEL Power Off -COMBOOT boot/syslinux/poweroff.com - -ONTIMEOUT arch +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_arch.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg new file mode 100644 index 0000000..d9dee2e --- /dev/null +++ b/configs/releng/syslinux/archiso_head.cfg @@ -0,0 +1,28 @@ +SERIAL 0 38400 +DEFAULT boot/syslinux/vesamenu.c32 +PROMPT 0 +MENU TITLE Arch Linux +MENU BACKGROUND boot/syslinux/splash.png +TIMEOUT 3000 + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 6 +MENU VSHIFT 10 +MENU TIMEOUTROW 13 +MENU TABMSGROW 11 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux/archiso_sys.cfg b/configs/releng/syslinux/archiso_sys.cfg new file mode 100644 index 0000000..1326db8 --- /dev/null +++ b/configs/releng/syslinux/archiso_sys.cfg @@ -0,0 +1,10 @@ +LABEL arch +TEXT HELP +Boot the Arch Linux live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% +IPAPPEND 3 diff --git a/configs/releng/syslinux/archiso_tail.cfg b/configs/releng/syslinux/archiso_tail.cfg new file mode 100644 index 0000000..984aace --- /dev/null +++ b/configs/releng/syslinux/archiso_tail.cfg @@ -0,0 +1,29 @@ +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +COM32 boot/syslinux/chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +LINUX boot/memtest + +# http://hdt-project.org/ +LABEL hdt +MENU LABEL Hardware Information (HDT) +COM32 boot/syslinux/hdt.c32 +APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz + +LABEL reboot +MENU LABEL Reboot +COM32 boot/syslinux/reboot.c32 + +LABEL poweroff +MENU LABEL Power Off +COMBOOT boot/syslinux/poweroff.com + +ONTIMEOUT arch -- cgit v1.2.2 From 7cb67d42fa7784e97648d7eb81f1947c82e8024d Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 2 Dec 2011 00:44:02 -0300 Subject: [configs/*] syslinux: Use UI instead of DEFAULT for *menu.c32 * UI is more correct than DEFAULT for simple menu system. * Remove TIMEOUT * Remove PROMPT 0, this is the default value. Signed-off-by: Gerardo Exequiel Pozzi --- configs/baseline/syslinux/syslinux.cfg | 6 +----- configs/releng/syslinux.dual/archiso_head.cfg | 5 +---- configs/releng/syslinux.dual/archiso_tail.cfg | 2 -- configs/releng/syslinux/archiso_head.cfg | 5 +---- configs/releng/syslinux/archiso_tail.cfg | 2 -- 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/configs/baseline/syslinux/syslinux.cfg b/configs/baseline/syslinux/syslinux.cfg index 5ae9823..df63af6 100644 --- a/configs/baseline/syslinux/syslinux.cfg +++ b/configs/baseline/syslinux/syslinux.cfg @@ -1,12 +1,8 @@ -DEFAULT menu.c32 -PROMPT 0 +UI menu.c32 MENU TITLE Arch Linux -TIMEOUT 300 LABEL arch MENU LABEL Arch Linux LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% - -ONTIMEOUT arch diff --git a/configs/releng/syslinux.dual/archiso_head.cfg b/configs/releng/syslinux.dual/archiso_head.cfg index 929872e..91d6e21 100644 --- a/configs/releng/syslinux.dual/archiso_head.cfg +++ b/configs/releng/syslinux.dual/archiso_head.cfg @@ -1,15 +1,12 @@ SERIAL 0 38400 -DEFAULT boot/syslinux/vesamenu.c32 -PROMPT 0 +UI boot/syslinux/vesamenu.c32 MENU TITLE Arch Linux MENU BACKGROUND boot/syslinux/splash.png -TIMEOUT 3000 MENU WIDTH 78 MENU MARGIN 4 MENU ROWS 7 MENU VSHIFT 10 -MENU TIMEOUTROW 13 MENU TABMSGROW 11 MENU CMDLINEROW 11 MENU HELPMSGROW 16 diff --git a/configs/releng/syslinux.dual/archiso_tail.cfg b/configs/releng/syslinux.dual/archiso_tail.cfg index a2040d1..a55548c 100644 --- a/configs/releng/syslinux.dual/archiso_tail.cfg +++ b/configs/releng/syslinux.dual/archiso_tail.cfg @@ -25,5 +25,3 @@ COM32 boot/syslinux/reboot.c32 LABEL poweroff MENU LABEL Power Off COMBOOT boot/syslinux/poweroff.com - -ONTIMEOUT arch32 diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg index d9dee2e..508373d 100644 --- a/configs/releng/syslinux/archiso_head.cfg +++ b/configs/releng/syslinux/archiso_head.cfg @@ -1,15 +1,12 @@ SERIAL 0 38400 -DEFAULT boot/syslinux/vesamenu.c32 -PROMPT 0 +UI boot/syslinux/vesamenu.c32 MENU TITLE Arch Linux MENU BACKGROUND boot/syslinux/splash.png -TIMEOUT 3000 MENU WIDTH 78 MENU MARGIN 4 MENU ROWS 6 MENU VSHIFT 10 -MENU TIMEOUTROW 13 MENU TABMSGROW 11 MENU CMDLINEROW 11 MENU HELPMSGROW 16 diff --git a/configs/releng/syslinux/archiso_tail.cfg b/configs/releng/syslinux/archiso_tail.cfg index 984aace..a55548c 100644 --- a/configs/releng/syslinux/archiso_tail.cfg +++ b/configs/releng/syslinux/archiso_tail.cfg @@ -25,5 +25,3 @@ COM32 boot/syslinux/reboot.c32 LABEL poweroff MENU LABEL Power Off COMBOOT boot/syslinux/poweroff.com - -ONTIMEOUT arch -- cgit v1.2.2 From 3df0be6a228745e9ea3102ede4fb865089d73b15 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 2 Dec 2011 00:44:02 -0300 Subject: [archiso] Do not use PXE NBD as default. * Now we have more than one PXE boot methods. * archiso_ndb_srv= accepts special ${pxeserver} parameter like in others PXE hooks. * This allows to setup network from initramfs without forcing using a special PXE hook. * Update README Signed-off-by: Gerardo Exequiel Pozzi --- README | 6 +++++- archiso/hooks/archiso_pxe_curl | 2 ++ archiso/hooks/archiso_pxe_nbd | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README b/README index 59c1724..53dabd0 100644 --- a/README +++ b/README @@ -3,7 +3,10 @@ INDEX * Boot parameters (initramfs stage) * hooks/archiso + * hooks/archiso_pxe_common * hooks/archiso_pxe_nbd + * hooks/archiso_pxe_curl + * hooks/archiso_pxe_nfs * hooks/archiso_loop_mnt * Boot parameters (only for configs/releng) * etc/rc.conf @@ -80,7 +83,8 @@ INDEX * archiso_nbd_name= Set NBD export name used by the server. Default: archiso * archiso_nbd_srv= Set an IP address where NBD reside. - Default: "${pxeserver}" (The Date: Fri, 2 Dec 2011 00:44:02 -0300 Subject: [configs/releng] Use whichsys.c32 to determine bootloader type * In that way we can have two differents syslinux menus depending if booting from PXE or from non-PXE. Some file renames are made to keep things ordered: archiso_pxe* all things related to PXELINUX archiso_sys* all things related to SYSLINUX *_inc.cfg only contains INCLUDE directive * By default NBD PXE option is selected for booting on timeout. * As (NDB/NFS/HTTP/FTP) server is used the same IP from pxeserver. Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/syslinux.dual/archiso.cfg | 17 ++++----- configs/releng/syslinux.dual/archiso_32only.cfg | 3 -- configs/releng/syslinux.dual/archiso_arch32.cfg | 10 ----- configs/releng/syslinux.dual/archiso_arch64.cfg | 10 ----- configs/releng/syslinux.dual/archiso_both.cfg | 4 -- configs/releng/syslinux.dual/archiso_head.cfg | 6 +-- configs/releng/syslinux.dual/archiso_pxe32.cfg | 43 ++++++++++++++++++++++ configs/releng/syslinux.dual/archiso_pxe64.cfg | 43 ++++++++++++++++++++++ .../releng/syslinux.dual/archiso_pxe_32_inc.cfg | 3 ++ .../releng/syslinux.dual/archiso_pxe_both_inc.cfg | 4 ++ .../releng/syslinux.dual/archiso_pxe_choose.cfg | 11 ++++++ configs/releng/syslinux.dual/archiso_sys32.cfg | 9 +++++ configs/releng/syslinux.dual/archiso_sys64.cfg | 9 +++++ .../releng/syslinux.dual/archiso_sys_32_inc.cfg | 3 ++ .../releng/syslinux.dual/archiso_sys_both_inc.cfg | 4 ++ .../releng/syslinux.dual/archiso_sys_choose.cfg | 11 ++++++ configs/releng/syslinux/archiso.cfg | 14 +++++-- configs/releng/syslinux/archiso_head.cfg | 6 +-- configs/releng/syslinux/archiso_pxe.cfg | 43 ++++++++++++++++++++++ configs/releng/syslinux/archiso_pxe_inc.cfg | 3 ++ configs/releng/syslinux/archiso_sys.cfg | 1 - configs/releng/syslinux/archiso_sys_inc.cfg | 3 ++ 22 files changed, 214 insertions(+), 46 deletions(-) delete mode 100644 configs/releng/syslinux.dual/archiso_32only.cfg delete mode 100644 configs/releng/syslinux.dual/archiso_arch32.cfg delete mode 100644 configs/releng/syslinux.dual/archiso_arch64.cfg delete mode 100644 configs/releng/syslinux.dual/archiso_both.cfg create mode 100644 configs/releng/syslinux.dual/archiso_pxe32.cfg create mode 100644 configs/releng/syslinux.dual/archiso_pxe64.cfg create mode 100644 configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg create mode 100644 configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg create mode 100644 configs/releng/syslinux.dual/archiso_pxe_choose.cfg create mode 100644 configs/releng/syslinux.dual/archiso_sys32.cfg create mode 100644 configs/releng/syslinux.dual/archiso_sys64.cfg create mode 100644 configs/releng/syslinux.dual/archiso_sys_32_inc.cfg create mode 100644 configs/releng/syslinux.dual/archiso_sys_both_inc.cfg create mode 100644 configs/releng/syslinux.dual/archiso_sys_choose.cfg create mode 100644 configs/releng/syslinux/archiso_pxe.cfg create mode 100644 configs/releng/syslinux/archiso_pxe_inc.cfg create mode 100644 configs/releng/syslinux/archiso_sys_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso.cfg b/configs/releng/syslinux.dual/archiso.cfg index 9994e43..d1817af 100644 --- a/configs/releng/syslinux.dual/archiso.cfg +++ b/configs/releng/syslinux.dual/archiso.cfg @@ -1,12 +1,11 @@ -DEFAULT choose -PROMPT 0 +DEFAULT select -LABEL choose -KERNEL boot/syslinux/ifcpu64.c32 -APPEND have64 -- nohave64 +LABEL select +COM32 boot/syslinux/whichsys.c32 +APPEND -pxe- pxe -sys- sys -iso- sys -LABEL have64 -CONFIG boot/syslinux/archiso_both.cfg +LABEL pxe +CONFIG boot/syslinux/archiso_pxe_choose.cfg -LABEL nohave64 -CONFIG boot/syslinux/archiso_32only.cfg +LABEL sys +CONFIG boot/syslinux/archiso_sys_choose.cfg diff --git a/configs/releng/syslinux.dual/archiso_32only.cfg b/configs/releng/syslinux.dual/archiso_32only.cfg deleted file mode 100644 index e0cad88..0000000 --- a/configs/releng/syslinux.dual/archiso_32only.cfg +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDE boot/syslinux/archiso_head.cfg -INCLUDE boot/syslinux/archiso_arch32.cfg -INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_arch32.cfg b/configs/releng/syslinux.dual/archiso_arch32.cfg deleted file mode 100644 index e7c7e23..0000000 --- a/configs/releng/syslinux.dual/archiso_arch32.cfg +++ /dev/null @@ -1,10 +0,0 @@ -LABEL arch32 -TEXT HELP -Boot the Arch Linux (i686) live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (i686) -LINUX boot/i686/vmlinuz -INITRD boot/i686/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_arch64.cfg b/configs/releng/syslinux.dual/archiso_arch64.cfg deleted file mode 100644 index aee7bb0..0000000 --- a/configs/releng/syslinux.dual/archiso_arch64.cfg +++ /dev/null @@ -1,10 +0,0 @@ -LABEL arch64 -TEXT HELP -Boot the Arch Linux (x86_64) live medium. It allows you to install Arch Linux or -perform system maintenance. -ENDTEXT -MENU LABEL Boot Arch Linux (x86_64) -LINUX boot/x86_64/vmlinuz -INITRD boot/x86_64/archiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_both.cfg b/configs/releng/syslinux.dual/archiso_both.cfg deleted file mode 100644 index 493ee81..0000000 --- a/configs/releng/syslinux.dual/archiso_both.cfg +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDE boot/syslinux/archiso_head.cfg -INCLUDE boot/syslinux/archiso_arch32.cfg -INCLUDE boot/syslinux/archiso_arch64.cfg -INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_head.cfg b/configs/releng/syslinux.dual/archiso_head.cfg index 91d6e21..6514c42 100644 --- a/configs/releng/syslinux.dual/archiso_head.cfg +++ b/configs/releng/syslinux.dual/archiso_head.cfg @@ -5,10 +5,10 @@ MENU BACKGROUND boot/syslinux/splash.png MENU WIDTH 78 MENU MARGIN 4 -MENU ROWS 7 +MENU ROWS 8 MENU VSHIFT 10 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 +MENU TABMSGROW 14 +MENU CMDLINEROW 14 MENU HELPMSGROW 16 MENU HELPMSGENDROW 29 diff --git a/configs/releng/syslinux.dual/archiso_pxe32.cfg b/configs/releng/syslinux.dual/archiso_pxe32.cfg new file mode 100644 index 0000000..56820d9 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe32.cfg @@ -0,0 +1,43 @@ +LABEL arch32_nbd +TEXT HELP +Boot the Arch Linux (i686) live medium (Using NBD). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) (NBD) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch32_nfs +TEXT HELP +Boot the Arch Linux (i686) live medium (Using NFS). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) (NFS) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch32_http +TEXT HELP +Boot the Arch Linux (i686) live medium (Using HTTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) (HTTP) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=http://${pxeserver}/ +IPAPPEND 3 + +LABEL arch32_ftp +TEXT HELP +Boot the Arch Linux (i686) live medium (Using FTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) (FTP) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=ftp://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_pxe64.cfg b/configs/releng/syslinux.dual/archiso_pxe64.cfg new file mode 100644 index 0000000..762fbc1 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe64.cfg @@ -0,0 +1,43 @@ +LABEL arch64_nbd +TEXT HELP +Boot the Arch Linux (x86_64) live medium (Using NBD). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) (NBD) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch64_nfs +TEXT HELP +Boot the Arch Linux (x86_64) live medium (Using NFS). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) (NFS) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch64_http +TEXT HELP +Boot the Arch Linux (x86_64) live medium (Using HTTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) (HTTP) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=http://${pxeserver}/ +IPAPPEND 3 + +LABEL arch64_ftp +TEXT HELP +Boot the Arch Linux (x86_64) live medium (Using FTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) (FTP) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=ftp://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg b/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg new file mode 100644 index 0000000..e4115df --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe32.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg b/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg new file mode 100644 index 0000000..324523e --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg @@ -0,0 +1,4 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe32.cfg +INCLUDE boot/syslinux/archiso_pxe64.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_choose.cfg b/configs/releng/syslinux.dual/archiso_pxe_choose.cfg new file mode 100644 index 0000000..6296065 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_choose.cfg @@ -0,0 +1,11 @@ +DEFAULT choose + +LABEL choose +COM32 boot/syslinux/ifcpu64.c32 +APPEND have64 -- nohave64 + +LABEL have64 +CONFIG boot/syslinux/archiso_pxe_both_inc.cfg + +LABEL nohave64 +CONFIG boot/syslinux/archiso_pxe_32_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys32.cfg b/configs/releng/syslinux.dual/archiso_sys32.cfg new file mode 100644 index 0000000..261579e --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys32.cfg @@ -0,0 +1,9 @@ +LABEL arch32 +TEXT HELP +Boot the Arch Linux (i686) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) +LINUX boot/i686/vmlinuz +INITRD boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux.dual/archiso_sys64.cfg b/configs/releng/syslinux.dual/archiso_sys64.cfg new file mode 100644 index 0000000..eb89813 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys64.cfg @@ -0,0 +1,9 @@ +LABEL arch64 +TEXT HELP +Boot the Arch Linux (x86_64) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg b/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg new file mode 100644 index 0000000..9e37093 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys32.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg b/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg new file mode 100644 index 0000000..4ed6b39 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg @@ -0,0 +1,4 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys32.cfg +INCLUDE boot/syslinux/archiso_sys64.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_choose.cfg b/configs/releng/syslinux.dual/archiso_sys_choose.cfg new file mode 100644 index 0000000..24c597a --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_choose.cfg @@ -0,0 +1,11 @@ +DEFAULT choose + +LABEL choose +COM32 boot/syslinux/ifcpu64.c32 +APPEND have64 -- nohave64 + +LABEL have64 +CONFIG boot/syslinux/archiso_sys_both_inc.cfg + +LABEL nohave64 +CONFIG boot/syslinux/archiso_sys_32_inc.cfg diff --git a/configs/releng/syslinux/archiso.cfg b/configs/releng/syslinux/archiso.cfg index 1228355..126fc77 100644 --- a/configs/releng/syslinux/archiso.cfg +++ b/configs/releng/syslinux/archiso.cfg @@ -1,3 +1,11 @@ -INCLUDE boot/syslinux/archiso_head.cfg -INCLUDE boot/syslinux/archiso_arch.cfg -INCLUDE boot/syslinux/archiso_tail.cfg +DEFAULT select + +LABEL select +COM32 boot/syslinux/whichsys.c32 +APPEND -pxe- pxe -sys- sys -iso- sys + +LABEL pxe +CONFIG boot/syslinux/archiso_pxe_inc.cfg + +LABEL sys +CONFIG boot/syslinux/archiso_sys_inc.cfg diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg index 508373d..6514c42 100644 --- a/configs/releng/syslinux/archiso_head.cfg +++ b/configs/releng/syslinux/archiso_head.cfg @@ -5,10 +5,10 @@ MENU BACKGROUND boot/syslinux/splash.png MENU WIDTH 78 MENU MARGIN 4 -MENU ROWS 6 +MENU ROWS 8 MENU VSHIFT 10 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 +MENU TABMSGROW 14 +MENU CMDLINEROW 14 MENU HELPMSGROW 16 MENU HELPMSGENDROW 29 diff --git a/configs/releng/syslinux/archiso_pxe.cfg b/configs/releng/syslinux/archiso_pxe.cfg new file mode 100644 index 0000000..78e494d --- /dev/null +++ b/configs/releng/syslinux/archiso_pxe.cfg @@ -0,0 +1,43 @@ +LABEL arch_nbd +TEXT HELP +Boot the Arch Linux live medium (Using NBD). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (NBD) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch_nfs +TEXT HELP +Boot the Arch Linux live medium (Using NFS). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (NFS) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch_http +TEXT HELP +Boot the Arch Linux live medium (Using HTTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (HTTP) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=http://${pxeserver}/ +IPAPPEND 3 + +LABEL arch_ftp +TEXT HELP +Boot the Arch Linux live medium (Using FTP). It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (FTP) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_curl_url=ftp://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux/archiso_pxe_inc.cfg b/configs/releng/syslinux/archiso_pxe_inc.cfg new file mode 100644 index 0000000..b2b6887 --- /dev/null +++ b/configs/releng/syslinux/archiso_pxe_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso_sys.cfg b/configs/releng/syslinux/archiso_sys.cfg index 1326db8..35303db 100644 --- a/configs/releng/syslinux/archiso_sys.cfg +++ b/configs/releng/syslinux/archiso_sys.cfg @@ -7,4 +7,3 @@ MENU LABEL Boot Arch Linux LINUX boot/%ARCH%/vmlinuz INITRD boot/%ARCH%/archiso.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -IPAPPEND 3 diff --git a/configs/releng/syslinux/archiso_sys_inc.cfg b/configs/releng/syslinux/archiso_sys_inc.cfg new file mode 100644 index 0000000..56c6a17 --- /dev/null +++ b/configs/releng/syslinux/archiso_sys_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys.cfg +INCLUDE boot/syslinux/archiso_tail.cfg -- cgit v1.2.2 From 87e84261c99b8bfabf3f64ad24599d77c9a262a2 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 2 Dec 2011 22:08:52 -0300 Subject: [configs/releng] Make syslinux.cfg (loadconfig) with relative paths. We are only using these files only for SYSLINUX bootloader that supports ".." as directories. ISOLINUX jumps to archiso.cfg via isolinux.cfg PXELINUX goes directly to archiso.cfg via DHCP configuration. Suggested by Thomas. Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/syslinux.dual/syslinux.cfg | 4 ++-- configs/releng/syslinux/syslinux.cfg | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configs/releng/syslinux.dual/syslinux.cfg b/configs/releng/syslinux.dual/syslinux.cfg index 1040d3f..3ee98de 100644 --- a/configs/releng/syslinux.dual/syslinux.cfg +++ b/configs/releng/syslinux.dual/syslinux.cfg @@ -1,5 +1,5 @@ DEFAULT loadconfig LABEL loadconfig - CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg - APPEND /%INSTALL_DIR%/ + CONFIG archiso.cfg + APPEND ../../ diff --git a/configs/releng/syslinux/syslinux.cfg b/configs/releng/syslinux/syslinux.cfg index 1040d3f..3ee98de 100644 --- a/configs/releng/syslinux/syslinux.cfg +++ b/configs/releng/syslinux/syslinux.cfg @@ -1,5 +1,5 @@ DEFAULT loadconfig LABEL loadconfig - CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg - APPEND /%INSTALL_DIR%/ + CONFIG archiso.cfg + APPEND ../../ -- cgit v1.2.2 From 10d42b18b885c8f1a2fa3b8829457ef1265d259f Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 2 Dec 2011 22:15:56 -0300 Subject: [configs/releng] Add darkhttpd to packages.* Simple way to enable self-PXE-server live-enviroment with HTTP. dnsmasq --port=0 \ --enable-tftp \ --tftp-root=/run/archiso/bootmnt \ --dhcp-range=192.168.0.2,192.168.0.254,86400 \ --dhcp-boot=/arch/boot/syslinux/gpxelinux.0 \ --dhcp-option-force=209,boot/syslinux/archiso.cfg \ --dhcp-option-force=210,/arch/ darkhttpd /run/archiso/bootmnt Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/packages.i686 | 1 + configs/releng/packages.x86_64 | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 1f5075f..ab5bfc9 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -2,6 +2,7 @@ aif b43-fwcutter btrfs-progs-unstable crda +darkhttpd ddrescue dhclient dialog diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 1f5075f..ab5bfc9 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -2,6 +2,7 @@ aif b43-fwcutter btrfs-progs-unstable crda +darkhttpd ddrescue dhclient dialog -- cgit v1.2.2 From 305bca4692ed9741a425a8c77f81ef50aaa8fc39 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 3 Dec 2011 11:22:03 -0300 Subject: [archiso] Cleanup: Remove *.fs support. This was useful to me during development of dm-snapshot support to create very quickly isos without wating for SquashFS compression. Is time to remove this, I think the is no practical usage, and make the code a bit more simple. Signed-off-by: Gerardo Exequiel Pozzi --- README | 8 -------- archiso/hooks/archiso | 8 ++------ archiso/hooks/archiso_pxe_curl | 6 +----- archiso/mkarchiso | 20 +++++--------------- 4 files changed, 8 insertions(+), 34 deletions(-) diff --git a/README b/README index 53dabd0..9de113d 100644 --- a/README +++ b/README @@ -178,10 +178,6 @@ if nothing is specified on command line. * image-name.fs.sfs SquashFS with only one file inside (image-name.fs), which is an image of some type of filesystem (ext4, ext3, ext2, xfs), all files reside on it. -* image-name.fs Like image-name.fs.sfs but without SquashFS. - (For testing purposes only. The option copytoram - for archiso hook does not have any effect on these images) - *** File format for aitab. @@ -196,7 +192,6 @@ It consists of some fields which define the behaviour of images. Mount point. Architecture { i686 | x86_64 | any }. SquashFS compression type { gzip | lzo | xz }. - A special value of "none" denotes no usage of SquashFS. Set the filesystem type of the image { ext4 | ext3 | ext2 | xfs }. A special value of "none" denotes no usage of a filesystem. In that case all files are pushed directly to SquashFS filesystem. @@ -207,9 +202,6 @@ It consists of some fields which define the behaviour of images. This is an estimation, and calculated in a simple way. Space used + 10% (estimated for metadata overhead) + desired % -Note: Some combinations are invalid, example: sfs_comp=none and fs_type=none - - *** Why the /isolinux and /arch/boot/syslinux directories? diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index e4ed52b..202325f 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -213,12 +213,8 @@ archiso_mount_handler() { [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then - if [[ "${aitab_sfs_comp}" != "none" ]]; then - _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" - _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" - else - _mnt_fs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" - fi + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" + _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" else _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi diff --git a/archiso/hooks/archiso_pxe_curl b/archiso/hooks/archiso_pxe_curl index 27deee9..858bacb 100644 --- a/archiso/hooks/archiso_pxe_curl +++ b/archiso/hooks/archiso_pxe_curl @@ -47,11 +47,7 @@ archiso_pxe_curl_mount_handler () { [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then - if [[ "${aitab_sfs_comp}" != "none" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "${archisobasedir}/${aitab_arch}" - else - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${archisobasedir}/${aitab_arch}" - fi + _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "${archisobasedir}/${aitab_arch}" else _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${archisobasedir}/${aitab_arch}" fi diff --git a/archiso/mkarchiso b/archiso/mkarchiso index fed953e..b3aa5cd 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -363,25 +363,15 @@ command_prepare () { if [[ ${_aitab_img} =~ ^# ]]; then continue fi - if [[ ${_aitab_sfs_comp} == "none" && ${_aitab_fs_type} == "none" ]]; then - _msg_error "In aitab, both fields 'sfs_comp' and 'fs_type' are set to none for '${_aitab_img}' image" 1 - fi local _src="${work_dir}/${_aitab_img}" local _dst="${work_dir}/iso/${install_dir}/${_aitab_arch}" mkdir -p "${_dst}" if [[ ${_aitab_fs_type} != "none" ]]; then - if [[ ${_aitab_sfs_comp} != "none" ]]; then - if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then - _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} - _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} - mv "${_src}.fs.sfs" "${_dst}" - rm "${_src}.fs" - fi - else - if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs"; then - _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} - mv "${work_dir}/${_aitab_img}.fs" "${_dst}" - fi + if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then + _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} + _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} + mv "${_src}.fs.sfs" "${_dst}" + rm "${_src}.fs" fi else if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then -- cgit v1.2.2 From 92dbba6c110a39bec4654415c9957e173fdec28a Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 3 Dec 2011 17:45:45 -0300 Subject: [archiso] Cleanup: pxe_curl: Remove download-iso-loopback support. This was the first implementation that downloads the complete ISO, but now we have the posibility of download only needed *.sfs files. Signed-off-by: Gerardo Exequiel Pozzi --- README | 7 +++--- archiso/hooks/archiso_pxe_curl | 54 +++++++++++++++--------------------------- 2 files changed, 22 insertions(+), 39 deletions(-) diff --git a/README b/README index 9de113d..c8f7331 100644 --- a/README +++ b/README @@ -89,10 +89,9 @@ INDEX ** hooks/archiso_pxe_curl -* archiso_curl_url= Set an HTTP/FTP URL of an ISO file (first form), - or a path (must end with /) where ${archisobasedir} - is found with all *.sfs files (second form). - In the IP part if ${pxeserver} is used, PXE IP will be used. +* archiso_curl_url= Set an HTTP/FTP URL (must end with /) where ${archisobasedir} + is found with all *.sfs files. + In the IP/domain part if ${pxeserver} is used, use PXE IP. Default: (unset) * curlspace_size= Set the size of tmpfs of "curlspace" where the specified ISO image or *.sfs files are downloaded. diff --git a/archiso/hooks/archiso_pxe_curl b/archiso/hooks/archiso_pxe_curl index 858bacb..8f3711c 100644 --- a/archiso/hooks/archiso_pxe_curl +++ b/archiso/hooks/archiso_pxe_curl @@ -13,13 +13,13 @@ run_hook() { # Fetch a file with CURL # # $1 URL -# $2 Destination directory inside curlspace +# $2 Destination directory inside curlspace/${archisobasedir} _curl_get() { local _url="${1}" local _dst="${2}" msg ":: Downloading '${_url}'" - if ! curl -f -o "/run/archiso/curlspace/${_dst}/${_url##*/}" --create-dirs "${_url}"; then + if ! curl -f -o "/run/archiso/curlspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then echo "ERROR: Downloading '${_url}'" echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" @@ -34,44 +34,28 @@ archiso_pxe_curl_mount_handler () { mkdir -p "/run/archiso/curlspace" mount -t tmpfs -o size="${curlspace_size}",mode=0755 curlspace "/run/archiso/curlspace" - # Check if URL ends in / - if [[ "${archiso_curl_url}" != "${archiso_curl_url%/}" ]]; then + local _aitab_url="${archiso_curl_url}${aitab#/run/archiso/bootmnt/}" + local _aitab_file="/run/archiso/curlspace/${aitab#/run/archiso/bootmnt/}" - local _aitab_url="${archiso_curl_url}${aitab#/run/archiso/bootmnt/}" - local _aitab_file="/run/archiso/curlspace/${aitab#/run/archiso/bootmnt/}" + _curl_get "${_aitab_url}" "/" - _curl_get "${_aitab_url}" "${archisobasedir}" - - local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size - while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do - [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue - [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue - if [[ "${aitab_fs_type}" != "none" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "${archisobasedir}/${aitab_arch}" - else - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${archisobasedir}/${aitab_arch}" - fi - done < "${_aitab_file}" - - if [[ "${checksum}" == "y" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "${archisobasedir}" + local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size + while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do + [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue + [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue + if [[ "${aitab_fs_type}" != "none" ]]; then + _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" + else + _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" fi + done < "${_aitab_file}" - mkdir -p "/run/archiso/bootmnt" - mount -o bind /run/archiso/curlspace /run/archiso/bootmnt - else - local _dev_loop + if [[ "${checksum}" == "y" ]]; then + _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "/" + fi - _curl_get "${archiso_curl_url}" "/" + mkdir -p "/run/archiso/bootmnt" + mount -o bind /run/archiso/curlspace /run/archiso/bootmnt - _dev_loop=$(losetup -f) - if ! losetup "${_dev_loop}" "/run/archiso/curlspace/${archiso_curl_url##*/}"; then - echo "ERROR: Setting loopback device '${_dev_loop}'" - echo " for file '/run/archiso/curlspace/${archiso_curl_url##*/}'" - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" - launch_interactive_shell - fi - fi archiso_mount_handler ${newroot} } -- cgit v1.2.2 From 9ca157c14073f672effb6e13f9f2c0413fe42008 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sat, 3 Dec 2011 18:08:57 -0300 Subject: [archiso] archiso_pxe_curl rename to archiso_pxe_http Signed-off-by: Gerardo Exequiel Pozzi --- README | 6 ++-- archiso/Makefile | 8 +++--- archiso/hooks/archiso_pxe_curl | 61 ---------------------------------------- archiso/hooks/archiso_pxe_http | 61 ++++++++++++++++++++++++++++++++++++++++ archiso/install/archiso_pxe_curl | 18 ------------ archiso/install/archiso_pxe_http | 18 ++++++++++++ configs/releng/build.sh | 2 +- configs/releng/mkinitcpio.conf | 2 +- 8 files changed, 88 insertions(+), 88 deletions(-) delete mode 100644 archiso/hooks/archiso_pxe_curl create mode 100644 archiso/hooks/archiso_pxe_http delete mode 100644 archiso/install/archiso_pxe_curl create mode 100644 archiso/install/archiso_pxe_http diff --git a/README b/README index c8f7331..19fdf46 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ INDEX * hooks/archiso * hooks/archiso_pxe_common * hooks/archiso_pxe_nbd - * hooks/archiso_pxe_curl + * hooks/archiso_pxe_http * hooks/archiso_pxe_nfs * hooks/archiso_loop_mnt * Boot parameters (only for configs/releng) @@ -87,7 +87,7 @@ INDEX Default: (unset) -** hooks/archiso_pxe_curl +** hooks/archiso_pxe_http * archiso_curl_url= Set an HTTP/FTP URL (must end with /) where ${archisobasedir} is found with all *.sfs files. @@ -163,7 +163,7 @@ if nothing is specified on command line. + mkinitcpio-nfs-utils for ipconfig * archiso_pxe_nbd + nbd for nbd-client -* archiso_pxe_curl +* archiso_pxe_http + curl for curl * archiso_pxe_nfs + mkinitcpio-nfs-utils for nfsmount diff --git a/archiso/Makefile b/archiso/Makefile index a073adf..cf7cd05 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -20,8 +20,8 @@ install-hooks: install -D -m 644 install/archiso_pxe_common $(DESTDIR)/lib/initcpio/install/archiso_pxe_common install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd - install -D -m 644 hooks/archiso_pxe_curl $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl - install -D -m 644 install/archiso_pxe_curl $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl + install -D -m 644 hooks/archiso_pxe_http $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_http + install -D -m 644 install/archiso_pxe_http $(DESTDIR)/lib/initcpio/install/archiso_pxe_http install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt @@ -50,8 +50,8 @@ uninstall: rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_common rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_curl - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_curl + rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_http + rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_http rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt diff --git a/archiso/hooks/archiso_pxe_curl b/archiso/hooks/archiso_pxe_curl deleted file mode 100644 index 8f3711c..0000000 --- a/archiso/hooks/archiso_pxe_curl +++ /dev/null @@ -1,61 +0,0 @@ -# vim: set ft=sh: - -run_hook() { - if [[ -n "${ip}" && -n "${archiso_curl_url}" ]]; then - - archiso_curl_url=$(eval echo ${archiso_curl_url}) - [[ -z "${curlspace_size}" ]] && curlspace_size="75%" - - mount_handler="archiso_pxe_curl_mount_handler" - fi -} - -# Fetch a file with CURL -# -# $1 URL -# $2 Destination directory inside curlspace/${archisobasedir} -_curl_get() { - local _url="${1}" - local _dst="${2}" - - msg ":: Downloading '${_url}'" - if ! curl -f -o "/run/archiso/curlspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then - echo "ERROR: Downloading '${_url}'" - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" - launch_interactive_shell - fi -} - -archiso_pxe_curl_mount_handler () { - newroot="${1}" - - msg ":: Mounting /run/archiso/curlspace (tmpfs) filesystem, size='${curlspace_size}'" - mkdir -p "/run/archiso/curlspace" - mount -t tmpfs -o size="${curlspace_size}",mode=0755 curlspace "/run/archiso/curlspace" - - local _aitab_url="${archiso_curl_url}${aitab#/run/archiso/bootmnt/}" - local _aitab_file="/run/archiso/curlspace/${aitab#/run/archiso/bootmnt/}" - - _curl_get "${_aitab_url}" "/" - - local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size - while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do - [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue - [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue - if [[ "${aitab_fs_type}" != "none" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" - else - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" - fi - done < "${_aitab_file}" - - if [[ "${checksum}" == "y" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "/" - fi - - mkdir -p "/run/archiso/bootmnt" - mount -o bind /run/archiso/curlspace /run/archiso/bootmnt - - archiso_mount_handler ${newroot} -} diff --git a/archiso/hooks/archiso_pxe_http b/archiso/hooks/archiso_pxe_http new file mode 100644 index 0000000..7149013 --- /dev/null +++ b/archiso/hooks/archiso_pxe_http @@ -0,0 +1,61 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_curl_url}" ]]; then + + archiso_curl_url=$(eval echo ${archiso_curl_url}) + [[ -z "${curlspace_size}" ]] && curlspace_size="75%" + + mount_handler="archiso_pxe_http_mount_handler" + fi +} + +# Fetch a file with CURL +# +# $1 URL +# $2 Destination directory inside curlspace/${archisobasedir} +_curl_get() { + local _url="${1}" + local _dst="${2}" + + msg ":: Downloading '${_url}'" + if ! curl -f -o "/run/archiso/curlspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then + echo "ERROR: Downloading '${_url}'" + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + fi +} + +archiso_pxe_http_mount_handler () { + newroot="${1}" + + msg ":: Mounting /run/archiso/curlspace (tmpfs) filesystem, size='${curlspace_size}'" + mkdir -p "/run/archiso/curlspace" + mount -t tmpfs -o size="${curlspace_size}",mode=0755 curlspace "/run/archiso/curlspace" + + local _aitab_url="${archiso_curl_url}${aitab#/run/archiso/bootmnt/}" + local _aitab_file="/run/archiso/curlspace/${aitab#/run/archiso/bootmnt/}" + + _curl_get "${_aitab_url}" "/" + + local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size + while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do + [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue + [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue + if [[ "${aitab_fs_type}" != "none" ]]; then + _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" + else + _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" + fi + done < "${_aitab_file}" + + if [[ "${checksum}" == "y" ]]; then + _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "/" + fi + + mkdir -p "/run/archiso/bootmnt" + mount -o bind /run/archiso/curlspace /run/archiso/bootmnt + + archiso_mount_handler ${newroot} +} diff --git a/archiso/install/archiso_pxe_curl b/archiso/install/archiso_pxe_curl deleted file mode 100644 index a9342ae..0000000 --- a/archiso/install/archiso_pxe_curl +++ /dev/null @@ -1,18 +0,0 @@ -# vim: set ft=sh: - -build () -{ - MODULES="" - BINARIES="" - FILES="" - SCRIPT="archiso_pxe_curl" - - add_binary "/usr/bin/curl" -} - -help () -{ -cat< Date: Sat, 3 Dec 2011 18:20:43 -0300 Subject: [archiso] Rename archiso_curl_url= to archiso_http_srv= Also rename curlspace_size= to archiso_http_spc= Signed-off-by: Gerardo Exequiel Pozzi --- README | 5 ++--- archiso/hooks/archiso_pxe_http | 28 +++++++++++++------------- archiso/install/archiso_pxe_http | 2 +- configs/releng/syslinux.dual/archiso_head.cfg | 2 +- configs/releng/syslinux.dual/archiso_pxe32.cfg | 13 +----------- configs/releng/syslinux.dual/archiso_pxe64.cfg | 13 +----------- configs/releng/syslinux/archiso_head.cfg | 2 +- configs/releng/syslinux/archiso_pxe.cfg | 13 +----------- 8 files changed, 22 insertions(+), 56 deletions(-) diff --git a/README b/README index 19fdf46..d23ade7 100644 --- a/README +++ b/README @@ -89,12 +89,11 @@ INDEX ** hooks/archiso_pxe_http -* archiso_curl_url= Set an HTTP/FTP URL (must end with /) where ${archisobasedir} +* archiso_http_srv= Set an HTTP URL (must end with /) where ${archisobasedir} is found with all *.sfs files. In the IP/domain part if ${pxeserver} is used, use PXE IP. Default: (unset) -* curlspace_size= Set the size of tmpfs of "curlspace" where the specified - ISO image or *.sfs files are downloaded. +* archiso_http_spc= Set the size of tmpfs where *.sfs files are downloaded. Default: "75%" diff --git a/archiso/hooks/archiso_pxe_http b/archiso/hooks/archiso_pxe_http index 7149013..ae56210 100644 --- a/archiso/hooks/archiso_pxe_http +++ b/archiso/hooks/archiso_pxe_http @@ -1,10 +1,10 @@ # vim: set ft=sh: run_hook() { - if [[ -n "${ip}" && -n "${archiso_curl_url}" ]]; then + if [[ -n "${ip}" && -n "${archiso_http_srv}" ]]; then - archiso_curl_url=$(eval echo ${archiso_curl_url}) - [[ -z "${curlspace_size}" ]] && curlspace_size="75%" + archiso_http_srv=$(eval echo ${archiso_http_srv}) + [[ -z "${archiso_http_spc}" ]] && archiso_http_spc="75%" mount_handler="archiso_pxe_http_mount_handler" fi @@ -13,13 +13,13 @@ run_hook() { # Fetch a file with CURL # # $1 URL -# $2 Destination directory inside curlspace/${archisobasedir} +# $2 Destination directory inside httpspace/${archisobasedir} _curl_get() { local _url="${1}" local _dst="${2}" msg ":: Downloading '${_url}'" - if ! curl -f -o "/run/archiso/curlspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then + if ! curl -f -o "/run/archiso/httpspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then echo "ERROR: Downloading '${_url}'" echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" @@ -30,12 +30,12 @@ _curl_get() { archiso_pxe_http_mount_handler () { newroot="${1}" - msg ":: Mounting /run/archiso/curlspace (tmpfs) filesystem, size='${curlspace_size}'" - mkdir -p "/run/archiso/curlspace" - mount -t tmpfs -o size="${curlspace_size}",mode=0755 curlspace "/run/archiso/curlspace" + msg ":: Mounting /run/archiso/httpspace (tmpfs) filesystem, size='${archiso_http_spc}'" + mkdir -p "/run/archiso/httpspace" + mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace" - local _aitab_url="${archiso_curl_url}${aitab#/run/archiso/bootmnt/}" - local _aitab_file="/run/archiso/curlspace/${aitab#/run/archiso/bootmnt/}" + local _aitab_url="${archiso_http_srv}${aitab#/run/archiso/bootmnt/}" + local _aitab_file="/run/archiso/httpspace/${aitab#/run/archiso/bootmnt/}" _curl_get "${_aitab_url}" "/" @@ -44,18 +44,18 @@ archiso_pxe_http_mount_handler () { [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" + _curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" else - _curl_get "${archiso_curl_url}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" + _curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" fi done < "${_aitab_file}" if [[ "${checksum}" == "y" ]]; then - _curl_get "${archiso_curl_url}${archisobasedir}/checksum.${arch}.md5" "/" + _curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/" fi mkdir -p "/run/archiso/bootmnt" - mount -o bind /run/archiso/curlspace /run/archiso/bootmnt + mount -o bind /run/archiso/httpspace /run/archiso/bootmnt archiso_mount_handler ${newroot} } diff --git a/archiso/install/archiso_pxe_http b/archiso/install/archiso_pxe_http index 9731732..a636f3b 100644 --- a/archiso/install/archiso_pxe_http +++ b/archiso/install/archiso_pxe_http @@ -13,6 +13,6 @@ build () help () { cat< Date: Fri, 16 Dec 2011 16:27:17 -0300 Subject: [archiso] update testiso Signed-off-by: Gerardo Exequiel Pozzi --- archiso/testiso | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/archiso/testiso b/archiso/testiso index 75bedc9..71e85e1 100755 --- a/archiso/testiso +++ b/archiso/testiso @@ -1,6 +1,6 @@ #!/bin/bash -if [ $# -eq 0 ]; then +if [[ $# -eq 0 ]]; then echo "usage: testiso [id|ic|sd|sc|vd|vc]" echo echo "id boot .iso as IDE disk" @@ -8,7 +8,7 @@ if [ $# -eq 0 ]; then echo "sd boot .iso as SCSI disk" echo "sc boot .iso as SCSI cd-rom" echo "vd boot .iso as virtio disk" - echo "vc boot .iso as virtio cd-rom" +# echo "vc boot .iso as virtio cd-rom" exit 1 fi @@ -18,9 +18,9 @@ case "${2}" in sd) IF="scsi"; MEDIA="disk";; sc) IF="scsi"; MEDIA="cdrom";; vd) IF="virtio"; MEDIA="disk";; - vc) IF="virtio"; MEDIA="cdrom";; +# vc) IF="virtio"; MEDIA="cdrom";; *) IF="scsi"; MEDIA="cdrom";; esac -echo qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on -qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on +echo qemu-system-x86_64 -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on +qemu-system-x86_64 -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on -- cgit v1.2.2 From 197cf4327aa20f74eb4d63b3185aee38363026be Mon Sep 17 00:00:00 2001 From: jamesm-sitegen Date: Thu, 5 Jan 2012 17:58:12 -0300 Subject: [archiso] README: Fixed a tiny issue We are not inside the chroots until we are chrooted ;-) Signed-off-by: Gerardo Exequiel Pozzi --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index d23ade7..48b0595 100644 --- a/README +++ b/README @@ -286,7 +286,7 @@ Note: These steps should be done with 64 bits support. * Enter 32 bits chroot enviroment then build core and netinstall single images. - [chroot32] # linux32 mkarchroot -r bash /tmp/chroot32 + [host32] # linux32 mkarchroot -r bash /tmp/chroot32 [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) [chroot32] # cp -r /usr/share/archiso/configs/releng /tmp [chroot32] # cd /tmp/releng @@ -295,7 +295,7 @@ Note: These steps should be done with 64 bits support. * Enter 64 bits chroot enviroment then build core and netinstall single images. - [chroot64] # mkarchroot -r bash /tmp/chroot64 + [host64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # mknod /dev/loop1064 b 7 1064 # assumed loop.max_part=0 (by default) [chroot64] # cp -r /usr/share/archiso/configs/releng /tmp [chroot64] # cd /tmp/releng -- cgit v1.2.2 From 2b211a90172374607c901064ce155f32b1a14fec Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Thu, 5 Jan 2012 17:58:12 -0300 Subject: [archiso] Make fstab from initramfs This is needed for initscripts 2012.01, at least the entry for /. Otherwise / is remounted ro, but not remounted rw later. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 202325f..7012343 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -22,16 +22,17 @@ _make_loop_dev() { echo /dev/loop${loop_dev_count} } -# args: source, mountpoint +# args: source, newroot, mountpoint _mnt_fs() { local img="${1}" - local mnt="${2}" + local newroot="${2}" + local mnt="${3}" local img_fullname="${img##*/}"; local img_name="${img_fullname%%.*}" local dm_snap_name="${dm_snap_prefix}_${img_name}" local ro_dev ro_dev_size ro_dev_fs_type rw_dev - mkdir -p "${mnt}" + mkdir -p "${newroot}${mnt}" _next_loop_dev ro_dev=$(_make_loop_dev "${img}") @@ -60,10 +61,12 @@ _mnt_fs() { echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} - msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${mnt}'" - if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${mnt}" ; then - echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${mnt}'" + msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${newroot}${mnt}'" + if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" ; then + echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${newroot}${mnt}'" launch_interactive_shell + else + echo "/dev/mapper/${dm_snap_name} ${mnt} auto defaults 0 0" >> ${newroot}/etc/fstab fi } @@ -214,7 +217,7 @@ archiso_mount_handler() { [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" - _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" + _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}" "${aitab_mnt}" else _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi -- cgit v1.2.2 From 36f327c6d45bf739587e89fa102e5beb400b6281 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Thu, 5 Jan 2012 17:58:12 -0300 Subject: [archiso] simplify _mnt_fs() and _mnt_sfs() mount is now from util-linux (like in e135003c13aef15abc78562a3ab17fa41c0330cc) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 7012343..2635a4c 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -30,15 +30,13 @@ _mnt_fs() { local img_fullname="${img##*/}"; local img_name="${img_fullname%%.*}" local dm_snap_name="${dm_snap_prefix}_${img_name}" - local ro_dev ro_dev_size ro_dev_fs_type rw_dev + local ro_dev ro_dev_size rw_dev mkdir -p "${newroot}${mnt}" _next_loop_dev ro_dev=$(_make_loop_dev "${img}") ro_dev_size=$(blockdev --getsz ${ro_dev}) - ro_dev_fs_type=$(blkid -o value -s TYPE -p ${ro_dev} 2> /dev/null) - if [[ "${cow_persistent}" == "P" ]]; then if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then @@ -61,8 +59,8 @@ _mnt_fs() { echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} - msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${newroot}${mnt}'" - if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" ; then + msg ":: Mounting '/dev/mapper/${dm_snap_name}' to '${newroot}${mnt}'" + if ! mount "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" ; then echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${newroot}${mnt}'" launch_interactive_shell else @@ -89,7 +87,7 @@ _mnt_sfs() { fi _next_loop_dev msg ":: Mounting '${img}' (SquashFS) to '${mnt}'" - if ! mount -r -t squashfs $(_make_loop_dev "${img}") "${mnt}" &> /dev/null ; then + if ! mount -r $(_make_loop_dev "${img}") "${mnt}" &> /dev/null ; then echo "ERROR: while mounting '${img}' to '${mnt}'" launch_interactive_shell fi -- cgit v1.2.2 From 0720ac9bd4ee82d924f6c0e568aa4477297772d1 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 9 Jan 2012 20:33:35 -0300 Subject: [archiso] Refactor: Use losetup from util-linux New losetup from util-linux 2.21 uses new /dev/loop-control from Linux 3.1. Needs mkinitcpio-0.8.2+ (provides modules.devname, or workaround with earlymodules=loop) Get advantages from it! Removing custom shell code. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 37 +++---------------------------------- archiso/hooks/archiso_loop_mnt | 10 ++++------ archiso/install/archiso | 1 + 3 files changed, 8 insertions(+), 40 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 2635a4c..3518d16 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -1,27 +1,3 @@ -# Initialize loopback device logic (we using on-demand mode) -# args: none -_init_loop_dev() { - loop_dev_count=99 - loop_dev_range=$(cat /sys/block/loop0/range) - loop_dev_minor=$((loop_dev_count*loop_dev_range)) -} - -# Call this function before _make_loop_dev() each time. -# args: none -_next_loop_dev() { - loop_dev_count=$((loop_dev_count+1)) - loop_dev_minor=$((loop_dev_count*loop_dev_range)) -} - -# Setup a loopback device for image passed as argument and echo the path to loopback device used. -# args: /path/to/image_file -_make_loop_dev() { - local img="${1}" - mknod /dev/loop${loop_dev_count} b 7 ${loop_dev_minor} &> /dev/null - losetup /dev/loop${loop_dev_count} "${img}" &> /dev/null - echo /dev/loop${loop_dev_count} -} - # args: source, newroot, mountpoint _mnt_fs() { local img="${1}" @@ -34,8 +10,7 @@ _mnt_fs() { mkdir -p "${newroot}${mnt}" - _next_loop_dev - ro_dev=$(_make_loop_dev "${img}") + ro_dev=$(losetup --find --show "${img}") ro_dev_size=$(blockdev --getsz ${ro_dev}) if [[ "${cow_persistent}" == "P" ]]; then @@ -54,8 +29,7 @@ _mnt_fs() { dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null fi - _next_loop_dev - rw_dev=$(_make_loop_dev "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") + rw_dev=$(losetup --find --show "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} @@ -85,9 +59,8 @@ _mnt_sfs() { img="/run/archiso/copytoram/${img_fullname}" msg "done." fi - _next_loop_dev msg ":: Mounting '${img}' (SquashFS) to '${mnt}'" - if ! mount -r $(_make_loop_dev "${img}") "${mnt}" &> /dev/null ; then + if ! mount -r "${img}" "${mnt}" &> /dev/null ; then echo "ERROR: while mounting '${img}' to '${mnt}'" launch_interactive_shell fi @@ -130,8 +103,6 @@ _verify_checksum() { } run_hook() { - modprobe loop - [[ -z "${arch}" ]] && arch="$(uname -m)" [[ -z "${cowspace_size}" ]] && cowspace_size="75%" [[ -z "${copytoram_size}" ]] && copytoram_size="75%" @@ -166,8 +137,6 @@ run_hook() { archiso_mount_handler() { local newroot="${1}" - _init_loop_dev - mountpoint -q "/run/archiso/bootmnt" || _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" if [[ ! -f "${aitab}" ]]; then diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index e52dc69..664f3a5 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -10,15 +10,13 @@ run_hook () { archiso_loop_mount_handler () { newroot="${1}" + local _dev_loop + msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" - _dev_loop=$(losetup -f) - if ! losetup "${_dev_loop}" "/run/archiso/img_dev/${img_loop}"; then - echo "ERROR: Setting loopback device '${_dev_loop}'" - echo " for file '/run/archiso/img_dev/${img_loop}'" - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" + if ! _dev_loop=$(losetup --find --show "/run/archiso/img_dev/${img_loop}"); then + echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" launch_interactive_shell fi diff --git a/archiso/install/archiso b/archiso/install/archiso index 3b4e223..db0fc3a 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -8,6 +8,7 @@ build () add_binary /lib/udev/cdrom_id add_binary /sbin/blockdev add_binary /sbin/dmsetup + add_binary /sbin/losetup add_binary /bin/mountpoint add_file /lib/udev/rules.d/60-cdrom_id.rules -- cgit v1.2.2 From c593c2bd2418c865dc289f8fccd81a1631e9b191 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 3 Feb 2012 10:58:01 -0300 Subject: [archiso] Avoid full path in add_binary Signed-off-by: Gerardo Exequiel Pozzi --- archiso/install/archiso | 8 ++++---- archiso/install/archiso_pxe_http | 2 +- archiso/install/archiso_pxe_nbd | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/archiso/install/archiso b/archiso/install/archiso index db0fc3a..25eccea 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -6,10 +6,10 @@ build () FILES="" add_binary /lib/udev/cdrom_id - add_binary /sbin/blockdev - add_binary /sbin/dmsetup - add_binary /sbin/losetup - add_binary /bin/mountpoint + add_binary blockdev + add_binary dmsetup + add_binary losetup + add_binary mountpoint add_file /lib/udev/rules.d/60-cdrom_id.rules add_file /lib/udev/rules.d/10-dm.rules diff --git a/archiso/install/archiso_pxe_http b/archiso/install/archiso_pxe_http index a636f3b..38a8ee5 100644 --- a/archiso/install/archiso_pxe_http +++ b/archiso/install/archiso_pxe_http @@ -7,7 +7,7 @@ build () FILES="" SCRIPT="archiso_pxe_http" - add_binary "/usr/bin/curl" + add_binary curl } help () diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index 4227623..747e5b9 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -7,7 +7,8 @@ build () FILES="" SCRIPT="archiso_pxe_nbd" - add_binary "/usr/sbin/nbd-client" "/bin/nbd-client" + add_binary nbd-client + add_file "/lib/initcpio/archiso_pxe_nbd" "/archiso_pxe_nbd" } -- cgit v1.2.2 From 27940c420f01f550f36c3aa25633b43a4f2a2069 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 3 Feb 2012 11:13:37 -0300 Subject: [archiso] Misc style cleanups * Add #!/bin/bash to install hooks and fixed vimlines. * Removed empty variables. * Reorder variables, adjust brace/parens in functions. * Removed things implemented in base hook (/tmp, /etc/fstab). Signed-off-by: Gerardo Exequiel Pozzi --- archiso/archiso_shutdown | 2 +- archiso/install/archiso | 16 +++++----------- archiso/install/archiso_loop_mnt | 15 +++++---------- archiso/install/archiso_pxe_common | 19 ++++++++----------- archiso/install/archiso_pxe_http | 13 +++++-------- archiso/install/archiso_pxe_nbd | 14 ++++++-------- archiso/install/archiso_pxe_nfs | 6 ++++-- archiso/install/archiso_shutdown | 9 +++++++-- 8 files changed, 41 insertions(+), 53 deletions(-) diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown index de1197e..26220a6 100644 --- a/archiso/archiso_shutdown +++ b/archiso/archiso_shutdown @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/ash # /oldroot depends on things inside /oldroot/run/archiso... mkdir /oldrun diff --git a/archiso/install/archiso b/archiso/install/archiso index 25eccea..878839b 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -1,9 +1,8 @@ -build () -{ - MODULES="cdrom loop dm-snapshot" +#!/bin/bash - BINARIES="" - FILES="" +build() { + MODULES="cdrom loop dm-snapshot" + SCRIPT="archiso" add_binary /lib/udev/cdrom_id add_binary blockdev @@ -15,11 +14,6 @@ build () add_file /lib/udev/rules.d/10-dm.rules add_file /lib/udev/rules.d/95-dm-notify.rules add_file /lib/initcpio/udev/11-dm-initramfs.rules /lib/udev/rules.d/11-dm-initramfs.rules - - # Add an empty fstab to avoid mount warning when -o remount is used (this should go to install/base) - : > "$BUILDROOT/etc/fstab" - - SCRIPT="archiso" } -# vim:ft=sh:ts=4:sw=4:et: +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_loop_mnt b/archiso/install/archiso_loop_mnt index 886cbb8..4141043 100644 --- a/archiso/install/archiso_loop_mnt +++ b/archiso/install/archiso_loop_mnt @@ -1,18 +1,13 @@ -# vim: set ft=sh: - -build () -{ - MODULES="" - - BINARIES="" - FILES="" +#!/bin/bash +build() { SCRIPT="archiso_loop_mnt" } -help () -{ +help() { cat< $BUILDROOT/etc/nsswitch.conf } -help () -{ +help() { cat< Date: Tue, 21 Feb 2012 18:48:36 -0300 Subject: [configs/releng] packages: btrfs-progs-unstable -> btrfs-progs Signed-off-by: Gerardo Exequiel Pozzi --- configs/releng/packages.i686 | 2 +- configs/releng/packages.x86_64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index ab5bfc9..88820b7 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -1,6 +1,6 @@ aif b43-fwcutter -btrfs-progs-unstable +btrfs-progs crda darkhttpd ddrescue diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index ab5bfc9..88820b7 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -1,6 +1,6 @@ aif b43-fwcutter -btrfs-progs-unstable +btrfs-progs crda darkhttpd ddrescue -- cgit v1.2.2 From bc4731a0d3b6631a68b02f69fd47ed289c8963fe Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:11:48 -0300 Subject: [archiso] Remove uneeded ; Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 3518d16..af3d58d 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -46,7 +46,7 @@ _mnt_fs() { _mnt_sfs() { local img="${1}" local mnt="${2}" - local img_fullname="${img##*/}"; + local img_fullname="${img##*/}" mkdir -p "${mnt}" -- cgit v1.2.2 From 970356426207a1efb777b6fef4ae0a23a6500fa0 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:19:30 -0300 Subject: [archiso] Use _mnt_dev() for SquashFS and dm-mapper Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index af3d58d..bd7aea7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -8,8 +8,6 @@ _mnt_fs() { local dm_snap_name="${dm_snap_prefix}_${img_name}" local ro_dev ro_dev_size rw_dev - mkdir -p "${newroot}${mnt}" - ro_dev=$(losetup --find --show "${img}") ro_dev_size=$(blockdev --getsz ${ro_dev}) @@ -33,13 +31,8 @@ _mnt_fs() { echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} - msg ":: Mounting '/dev/mapper/${dm_snap_name}' to '${newroot}${mnt}'" - if ! mount "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" ; then - echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${newroot}${mnt}'" - launch_interactive_shell - else - echo "/dev/mapper/${dm_snap_name} ${mnt} auto defaults 0 0" >> ${newroot}/etc/fstab - fi + _mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" + echo "/dev/mapper/${dm_snap_name} ${mnt} auto defaults 0 0" >> ${newroot}/etc/fstab } # args: /path/to/image_file, mountpoint @@ -48,8 +41,6 @@ _mnt_sfs() { local mnt="${2}" local img_fullname="${img##*/}" - mkdir -p "${mnt}" - if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." if ! cp "${img}" "/run/archiso/copytoram/${img_fullname}" ; then @@ -59,11 +50,7 @@ _mnt_sfs() { img="/run/archiso/copytoram/${img_fullname}" msg "done." fi - msg ":: Mounting '${img}' (SquashFS) to '${mnt}'" - if ! mount -r "${img}" "${mnt}" &> /dev/null ; then - echo "ERROR: while mounting '${img}' to '${mnt}'" - launch_interactive_shell - fi + _mnt_dev "${img}" "${mnt}" "-r" } # args: device, mountpoint, flags -- cgit v1.2.2 From e6c885d29f14e3fdeea4a61a15721f70e2e7115a Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:26:49 -0300 Subject: [archiso] Setup ro loop devs as read-only Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 2 +- archiso/hooks/archiso_loop_mnt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index bd7aea7..54c3223 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -8,7 +8,7 @@ _mnt_fs() { local dm_snap_name="${dm_snap_prefix}_${img_name}" local ro_dev ro_dev_size rw_dev - ro_dev=$(losetup --find --show "${img}") + ro_dev=$(losetup --find --show --read-only "${img}") ro_dev_size=$(blockdev --getsz ${ro_dev}) if [[ "${cow_persistent}" == "P" ]]; then diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 664f3a5..4fa2910 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -15,7 +15,7 @@ archiso_loop_mount_handler () { msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" - if ! _dev_loop=$(losetup --find --show "/run/archiso/img_dev/${img_loop}"); then + if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" launch_interactive_shell fi -- cgit v1.2.2 From f0b4c353371d3348fb436fbf69d9006b3f60f475 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:37:10 -0300 Subject: [archiso] Use losetup/mount instead of mount directly *.sfs Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 54c3223..abe9932 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -40,6 +40,7 @@ _mnt_sfs() { local img="${1}" local mnt="${2}" local img_fullname="${img##*/}" + local sfs_dev if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." @@ -50,7 +51,8 @@ _mnt_sfs() { img="/run/archiso/copytoram/${img_fullname}" msg "done." fi - _mnt_dev "${img}" "${mnt}" "-r" + sfs_dev=$(losetup --find --show --read-only "${img}") + _mnt_dev "${sfs_dev}" "${mnt}" "-r" } # args: device, mountpoint, flags -- cgit v1.2.2 From 5123b25aa16f1340c39ff7f0e0c457d0e3653598 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:41:32 -0300 Subject: [archiso] Add /run/archiso/used_block_devices This list includes block devices of: * Boot medium [archisodevice] (only if no copytoram= is used) * Loop medium [img_dev] (only if no copytoram= is used) * COW space [cowdevice] (only if cowdevice= is used (no tmpfs is used)) * Loop devices used for SquashFS images. * Loop devices used for device-mapper devices (two per each dm-device, one RO{*.fs} and one RW{*.cow}) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso | 13 ++++++++++++- archiso/hooks/archiso_loop_mnt | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index abe9932..df5bb10 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -9,6 +9,7 @@ _mnt_fs() { local ro_dev ro_dev_size rw_dev ro_dev=$(losetup --find --show --read-only "${img}") + echo ${ro_dev} >> /run/archiso/used_block_devices ro_dev_size=$(blockdev --getsz ${ro_dev}) if [[ "${cow_persistent}" == "P" ]]; then @@ -28,10 +29,12 @@ _mnt_fs() { fi rw_dev=$(losetup --find --show "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") + echo ${rw_dev} >> /run/archiso/used_block_devices echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} _mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" + echo /dev/mapper/${dm_snap_name} >> /run/archiso/used_block_devices echo "/dev/mapper/${dm_snap_name} ${mnt} auto defaults 0 0" >> ${newroot}/etc/fstab } @@ -52,6 +55,7 @@ _mnt_sfs() { msg "done." fi sfs_dev=$(losetup --find --show --read-only "${img}") + echo ${sfs_dev} >> /run/archiso/used_block_devices _mnt_dev "${sfs_dev}" "${mnt}" "-r" } @@ -126,7 +130,13 @@ run_hook() { archiso_mount_handler() { local newroot="${1}" - mountpoint -q "/run/archiso/bootmnt" || _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" + if ! mountpoint -q "/run/archiso/bootmnt"; then + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" + if [[ "${copytoram}" != "y" ]]; then + echo $(readlink -f ${archisodevice}) >> /run/archiso/used_block_devices + fi + fi + if [[ ! -f "${aitab}" ]]; then echo "ERROR: '${aitab}' file does not exist." @@ -159,6 +169,7 @@ archiso_mount_handler() { if [[ -n "${cow_device}" ]]; then _mnt_dev "${cow_device}" "/run/archiso/cowspace" "-r" + echo $(readlink -f ${cow_device}) >> /run/archiso/used_block_devices mount -o remount,rw "/run/archiso/cowspace" else msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 4fa2910..61ddcd4 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -14,6 +14,9 @@ archiso_loop_mount_handler () { msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" + if [[ "${copytoram}" != "y" ]]; then + echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices + fi if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" -- cgit v1.2.2 From 60aa7a18575f539ab7f47cf2eff2c7c39beb8e3f Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 19:44:02 -0300 Subject: [configs/releng] Add /run/aif/ignore_block_devices This is just a symlink to /run/archiso/used_block_devices Signed-off-by: Gerardo Exequiel Pozzi --- .../root-image/etc/rc.d/functions.d/symlink_used_block_devices | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices diff --git a/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices b/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices new file mode 100644 index 0000000..f6b6062 --- /dev/null +++ b/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices @@ -0,0 +1,7 @@ +symlink_used_block_devices() +{ + mkdir /run/aif + ln -s /run/archiso/used_block_devices /run/aif/ignore_block_devices +} + +add_hook multi_end symlink_used_block_devices -- cgit v1.2.2 From 354a202bcc3c3ddc90fd2a9331ebfda8ba14cc36 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Wed, 22 Feb 2012 23:52:06 -0300 Subject: [archiso] Update archiso_shutdown hook * Add libraries from /usr/lib and /sbin/losetup. * Use used_block_devices to detach loop devices. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/archiso_shutdown | 13 +++++-------- archiso/hooks/archiso_shutdown | 10 +++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown index 26220a6..c430014 100644 --- a/archiso/archiso_shutdown +++ b/archiso/archiso_shutdown @@ -10,10 +10,8 @@ umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r) # Remove all dm-snapshot devices. dmsetup remove_all -# Remove all loopback devices made for dm-snapshots devices -# other misc loops like used for pure squashfs images -# and unmount/detach *.fs.sfs images. -for _lup in $(ls -r /dev/loop[1-9][0-9][0-9]); do +# Remove all loopback devices. +for _lup in $(grep ^/dev/loop /oldrun/archiso/used_block_devices | tac); do if ! losetup -d ${_lup} 2> /dev/null; then umount -d ${_lup} fi @@ -24,11 +22,10 @@ umount /oldrun/archiso/cowspace # Unmount boot device if needed (no copytoram=y used) if [[ ! -d /oldrun/archiso/copytoram ]]; then - umount /oldrun/archiso/bootmnt - # Detach img_loop= and unmount img_dev= (archiso_loop_mnt hook) - if [[ -f /oldrun/archiso/img_dev_loop ]]; then - losetup -d $(cat /oldrun/archiso/img_dev_loop) + if [[ -d /oldrun/archiso/img_dev ]]; then umount /oldrun/archiso/img_dev + else + umount /oldrun/archiso/bootmnt fi if [[ -f /oldrun/archiso/nbd_client.pid ]]; then nbd-client -d /dev/nbd0 diff --git a/archiso/hooks/archiso_shutdown b/archiso/hooks/archiso_shutdown index 1cc6e0e..1b2689b 100644 --- a/archiso/hooks/archiso_shutdown +++ b/archiso/hooks/archiso_shutdown @@ -2,15 +2,15 @@ run_hook () { msg -n ":: Creating shutdown ramfs..." - mkdir -p /run/initramfs/usr/bin - mkdir /run/initramfs/usr/sbin - mkdir /run/initramfs/bin - mkdir /run/initramfs/sbin - mkdir /run/initramfs/lib + for _dir in bin lib sbin usr/bin usr/lib usr/sbin; do + mkdir -p /run/initramfs/${_dir} + done cp /bin/busybox /run/initramfs/bin/ cp /lib/ld-* /run/initramfs/lib/ cp /lib/lib* /run/initramfs/lib/ + cp /usr/lib/lib* /run/initramfs/usr/lib/ cp /sbin/dmsetup /run/initramfs/sbin/ + cp /sbin/losetup /run/initramfs/sbin/ if [[ -x /bin/nbd-client ]]; then cp /bin/nbd-client /run/initramfs/bin/ fi -- cgit v1.2.2 From 4f790838568af604e20886f8d822c4b5bd01d667 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Thu, 23 Feb 2012 00:50:35 -0300 Subject: [archiso] Remove uneeded /run/archiso/img_dev_loop Superseded by /run/archiso/used_block_devices Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_loop_mnt | 2 -- 1 file changed, 2 deletions(-) diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 61ddcd4..a02cfac 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -28,7 +28,5 @@ archiso_loop_mount_handler () { if [[ "${copytoram}" == "y" ]]; then losetup -d ${_dev_loop} umount /run/archiso/img_dev - else - echo ${_dev_loop} > /run/archiso/img_dev_loop fi } -- cgit v1.2.2 From 1f66a737de00016f4d78ab340cccbca4e8ec430c Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Sun, 4 Mar 2012 20:58:58 -0300 Subject: [archiso] /lib/initcpio -> /usr/lib/initcpio Needs mkinitpcio >= 0.8.4 Next changes will be for mdadm and mkinitcpio-nfs-utils: * /lib/initcpio/udev/11-dm-initramfs.rules * /lib/initcpio/ipconfig , /lib/initcpio/nfsmount Signed-off-by: Gerardo Exequiel Pozzi --- archiso/Makefile | 68 ++++++++++++++++++++-------------------- archiso/install/archiso_pxe_nbd | 2 +- archiso/install/archiso_shutdown | 2 +- configs/baseline/build.sh | 4 +-- configs/releng/build.sh | 10 +++--- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/archiso/Makefile b/archiso/Makefile index cf7cd05..28868bf 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -10,23 +10,23 @@ install-program: install-hooks: # hooks/install are needed by mkinitcpio - install -D -m 644 hooks/archiso $(DESTDIR)/lib/initcpio/hooks/archiso - install -D -m 644 install/archiso $(DESTDIR)/lib/initcpio/install/archiso - install -D -m 755 archiso_shutdown $(DESTDIR)/lib/initcpio/archiso_shutdown - install -D -m 644 hooks/archiso_shutdown $(DESTDIR)/lib/initcpio/hooks/archiso_shutdown - install -D -m 644 install/archiso_shutdown $(DESTDIR)/lib/initcpio/install/archiso_shutdown - install -D -m 644 archiso_pxe_nbd $(DESTDIR)/lib/initcpio/archiso_pxe_nbd - install -D -m 644 hooks/archiso_pxe_common $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_common - install -D -m 644 install/archiso_pxe_common $(DESTDIR)/lib/initcpio/install/archiso_pxe_common - install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd - install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd - install -D -m 644 hooks/archiso_pxe_http $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_http - install -D -m 644 install/archiso_pxe_http $(DESTDIR)/lib/initcpio/install/archiso_pxe_http - install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs - install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs - install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt - install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt - install -D -m 644 install/archiso_kms $(DESTDIR)/lib/initcpio/install/archiso_kms + install -D -m 644 hooks/archiso $(DESTDIR)/usr/lib/initcpio/hooks/archiso + install -D -m 644 install/archiso $(DESTDIR)/usr/lib/initcpio/install/archiso + install -D -m 755 archiso_shutdown $(DESTDIR)/usr/lib/initcpio/archiso_shutdown + install -D -m 644 hooks/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown + install -D -m 644 install/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown + install -D -m 644 archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd + install -D -m 644 hooks/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common + install -D -m 644 install/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common + install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd + install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd + install -D -m 644 hooks/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http + install -D -m 644 install/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http + install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs + install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs + install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt + install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt + install -D -m 644 install/archiso_kms $(DESTDIR)/usr/lib/initcpio/install/archiso_kms install-examples: # install examples @@ -40,23 +40,23 @@ install-doc: uninstall: rm -f $(DESTDIR)/usr/sbin/mkarchiso rm -f $(DESTDIR)/usr/bin/testiso - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso - rm -f $(DESTDIR)/lib/initcpio/install/archiso - rm -f $(DESTDIR)/lib/initcpio/archiso_shutdown - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_shutdown - rm -f $(DESTDIR)/lib/initcpio/install/archiso_shutdown - rm -f $(DESTDIR)/lib/initcpio/archiso_pxe_nbd - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_common - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_common - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_http - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_http - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nfs - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nfs - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt - rm -f $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt - rm -f $(DESTDIR)/lib/initcpio/install/archiso_kms + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso + rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_kms rm -rf $(DESTDIR)/usr/share/archiso/ .PHONY: install install-program install-hooks install-examples install-doc uninstall diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index 0784e2c..1ee3910 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -6,7 +6,7 @@ build() { add_binary nbd-client - add_file /lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd + add_file /usr/lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd } help() { diff --git a/archiso/install/archiso_shutdown b/archiso/install/archiso_shutdown index 7ef3137..87b8297 100644 --- a/archiso/install/archiso_shutdown +++ b/archiso/install/archiso_shutdown @@ -3,7 +3,7 @@ build() { SCRIPT="archiso_shutdown" - add_file /lib/initcpio/archiso_shutdown /shutdown + add_file /usr/lib/initcpio/archiso_shutdown /shutdown } help() { diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 36cab15..1f2251d 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -22,8 +22,8 @@ make_basefs() { # Copy mkinitcpio archiso hooks (root-image) make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks - cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install + cp /usr/lib/initcpio/hooks/archiso ${work_dir}/root-image/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/archiso ${work_dir}/root-image/usr/lib/initcpio/install cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf : > ${work_dir}/build.${FUNCNAME} fi diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 4967863..42836a9 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -29,12 +29,12 @@ make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then local _hook for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do - cp /lib/initcpio/hooks/${_hook} ${work_dir}/root-image/lib/initcpio/hooks - cp /lib/initcpio/install/${_hook} ${work_dir}/root-image/lib/initcpio/install + cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/root-image/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/${_hook} ${work_dir}/root-image/usr/lib/initcpio/install done - cp /lib/initcpio/install/archiso_kms ${work_dir}/root-image/lib/initcpio/install - cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio - cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio + cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/root-image/usr/lib/initcpio/install + cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/root-image/usr/lib/initcpio + cp /usr/lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/usr/lib/initcpio cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf : > ${work_dir}/build.${FUNCNAME} fi -- cgit v1.2.2 From 630f5f9f6a5666906ccda9d35f87ee0f948b89db Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 5 Mar 2012 19:18:29 -0300 Subject: [archiso] README update Use new -d option in mkarchroot (mount /dev as devtmpfs), then avoid mknod for loop dev. (Needs devtools >= 20120305) Signed-off-by: Gerardo Exequiel Pozzi --- README | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README b/README index 48b0595..2fec0a0 100644 --- a/README +++ b/README @@ -226,11 +226,7 @@ When make your custom boot-pendrive, you need to copy /arch directory to it. [host] # make -C archiso/archiso DESTDIR=/tmp/chroot install * Enter to chroot (prefix with linux32 if needed). - [host] # mkarchroot -r bash /tmp/chroot - -* Create a loopback device. - (mkarchroot does not create it, use other number if not available) - [chroot] # mknod /dev/loop0 b 7 0 + [host] # mkarchroot -d -r bash /tmp/chroot * Setup a mirror. [chroot] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist @@ -286,8 +282,7 @@ Note: These steps should be done with 64 bits support. * Enter 32 bits chroot enviroment then build core and netinstall single images. - [host32] # linux32 mkarchroot -r bash /tmp/chroot32 - [chroot32] # mknod /dev/loop1032 b 7 1032 # assumed loop.max_part=0 (by default) + [host32] # linux32 mkarchroot -d -r bash /tmp/chroot32 [chroot32] # cp -r /usr/share/archiso/configs/releng /tmp [chroot32] # cd /tmp/releng [chroot32] # ./build.sh build single all @@ -295,8 +290,7 @@ Note: These steps should be done with 64 bits support. * Enter 64 bits chroot enviroment then build core and netinstall single images. - [host64] # mkarchroot -r bash /tmp/chroot64 - [chroot64] # mknod /dev/loop1064 b 7 1064 # assumed loop.max_part=0 (by default) + [host64] # mkarchroot -d -r bash /tmp/chroot64 [chroot64] # cp -r /usr/share/archiso/configs/releng /tmp [chroot64] # cd /tmp/releng [chroot64] # ./build.sh build single all -- cgit v1.2.2 From 25c535fa17a0cbbc5ea3afd5c9b736413b1c3ee5 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 12 Mar 2012 11:35:57 -0300 Subject: [archiso] README update Signed-off-by: Gerardo Exequiel Pozzi --- README | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README b/README index 2fec0a0..4bab18d 100644 --- a/README +++ b/README @@ -14,6 +14,7 @@ INDEX * Image types generated by mkarchiso. * File format for aitab. * Why the /isolinux and /arch/boot/syslinux directories? +* Know issues * Building the most basic Arch Linux live media. (configs/baseline) * Building official Arch Linux live media. (configs/releng) @@ -210,6 +211,15 @@ When make your custom boot-pendrive, you need to copy /arch directory to it. /isolinux/isolinux.cfg just holds /arch/boot/syslinux/syslinux.cfg +*** Know issues + +** On shutdown there are two steps that [FAIL]: + "Unmounting Swap-backed Filesystems" and "Unmounting Non-API Filesystems", + These filesystem are in use at this stage by archiso, but... + This is not a real issue since, all mounted filesystem, loopback devices + and device mapper devices made by archiso will be "free" on "shutdown tmpfs" + (A.K.A deinitramfs), build at initramfs by [archiso_shutdown] initcpio hook. + *** Building the most basic Arch Linux live media. (configs/baseline) -- cgit v1.2.2 From 6f9c6293935d218a65b4c731bb10ae163f65197c Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Thu, 15 Mar 2012 23:25:20 -0300 Subject: [archiso] Copy "mount" in archiso_shutdown Signed-off-by: Gerardo Exequiel Pozzi --- archiso/hooks/archiso_shutdown | 1 + 1 file changed, 1 insertion(+) diff --git a/archiso/hooks/archiso_shutdown b/archiso/hooks/archiso_shutdown index 1b2689b..24e4103 100644 --- a/archiso/hooks/archiso_shutdown +++ b/archiso/hooks/archiso_shutdown @@ -9,6 +9,7 @@ run_hook () cp /lib/ld-* /run/initramfs/lib/ cp /lib/lib* /run/initramfs/lib/ cp /usr/lib/lib* /run/initramfs/usr/lib/ + cp /bin/mount /run/initramfs/bin/ cp /sbin/dmsetup /run/initramfs/sbin/ cp /sbin/losetup /run/initramfs/sbin/ if [[ -x /bin/nbd-client ]]; then -- cgit v1.2.2 From ab5d67fe4386f6fcd1de2bdfa35b2dcb669d39dd Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Thu, 15 Mar 2012 23:43:58 -0300 Subject: [archiso] archiso_shutdown: Avoid mtab warning (not found) Signed-off-by: Gerardo Exequiel Pozzi --- archiso/archiso_shutdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown index c430014..85cce59 100644 --- a/archiso/archiso_shutdown +++ b/archiso/archiso_shutdown @@ -2,7 +2,7 @@ # /oldroot depends on things inside /oldroot/run/archiso... mkdir /oldrun -mount --move /oldroot/run /oldrun +mount -n --move /oldroot/run /oldrun # Unmount all mounts now. umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r) -- cgit v1.2.2 From 3d05bef2b96c84126e6c8921e834f2655a4ec730 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Fri, 16 Mar 2012 01:48:10 -0300 Subject: [archiso] Implement own chroot functions in mkarchiso * Remove devtools dependency. * Better control over what files are touched inside chroot (root-image). Now: NONE :) * Two new commands: + init: To install {base} group and other needed packages (syslinux for now) + run: If we want to run some command inside chroot (mkinitcpio, locale-gen, useradd, etc etc...) * Renamed command: "created" to "install", says much better what does. Signed-off-by: Gerardo Exequiel Pozzi --- archiso/mkarchiso | 103 ++++++++++++++++++++++++++++++++++++++-------- configs/baseline/build.sh | 7 ++-- configs/releng/build.sh | 19 +++++---- 3 files changed, 102 insertions(+), 27 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index b3aa5cd..df3d354 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -5,6 +5,7 @@ set -e -u app_name=${0##*/} arch=$(uname -m) pkg_list="" +run_cmd="" quiet="y" pacman_conf="/etc/pacman.conf" export iso_label="ARCH_$(date +%Y%m)" @@ -44,6 +45,44 @@ _show_space_usage () { _msg_info "Total: ${_total} MiB (100%) | Used: ${_used} MiB (${_pct_u}) | Avail: ${_avail} MiB ($((100 - ${_pct_u%\%}))%)" } +_chroot_mount () { + mount -t devtmpfs dev "${work_dir}/root-image/dev" + mount -t devpts devpts "${work_dir}/root-image/dev/pts" + mount -t tmpfs devshm "${work_dir}/root-image/dev/shm" + mount -t proc proc "${work_dir}/root-image/proc" + mount -t tmpfs run "${work_dir}/root-image/run" + mount -t sysfs sys "${work_dir}/root-image/sys" + mount -t tmpfs tmp "${work_dir}/root-image/tmp" + + trap '_chroot_umount' EXIT HUP INT TERM +} + +_chroot_umount () { + umount "${work_dir}/root-image/tmp" + umount "${work_dir}/root-image/sys" + umount "${work_dir}/root-image/run" + umount "${work_dir}/root-image/proc" + umount "${work_dir}/root-image/dev/shm" + umount "${work_dir}/root-image/dev/pts" + umount "${work_dir}/root-image/dev" + + trap - EXIT HUP INT TERM +} + +_chroot_init() { + if [[ ! -d ${work_dir}/root-image/var/cache/pacman ]]; then + mkdir -p ${work_dir}/root-image/{dev,proc,run,sys,tmp,var/lib/pacman} + _pacman "base" + _pacman "syslinux" + fi +} + +_chroot_run() { + _chroot_mount + eval chroot ${work_dir}/root-image "${run_cmd}" + _chroot_umount +} + # Mount a filesystem (trap signals in case of error for unmounting it # $1: source image # $2: mount-point @@ -99,6 +138,7 @@ _usage () echo "usage ${app_name} [options] command " echo " general options:" echo " -p PACKAGE(S) Package(s) to install, can be used multiple times" + echo " -r Run inside root-image" echo " -C Config file for pacman. Default ${pacman_conf}" echo " -L