From 3cb6fa175301b22dba38a233582bfcc707f2822b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 27 Jun 2012 14:20:15 +0200 Subject: [PATCH] Adding upstream version 3.0~a34. --- VERSION | 2 +- backends/initramfs-tools/live.hook | 5 +- backends/initramfs-tools/live.script | 2 +- manpages/de/live-boot.de.7 | 2 +- manpages/de/live-persistence.conf.de.5 | 2 +- manpages/en/live-boot.7 | 2 +- manpages/en/live-persistence.conf.5 | 2 +- manpages/es/live-boot.es.7 | 2 +- manpages/es/live-persistence.conf.es.5 | 2 +- manpages/po/de/live-boot.7.po | 12 +-- manpages/po/de/live-persistence.conf.5.po | 12 +-- manpages/po/es/live-boot.7.po | 14 +-- manpages/po/es/live-persistence.conf.5.po | 14 +-- manpages/pot/live-boot.7.pot | 6 +- manpages/pot/live-persistence.conf.5.pot | 6 +- scripts/boot/cmdline.sh | 8 +- scripts/boot/misc-helpers.sh | 65 +++++++----- scripts/boot/mountroot.sh | 28 ++--- scripts/boot/netbase.sh | 6 +- scripts/boot/networking.sh | 164 +++++++++++++++--------------- scripts/boot/overlay.sh | 59 ++++++----- scripts/boot/select-eth-device.sh | 68 +++++++------ 22 files changed, 258 insertions(+), 225 deletions(-) diff --git a/VERSION b/VERSION index e7c0eca..871361b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0~a32-1 +3.0~a34-1 diff --git a/backends/initramfs-tools/live.hook b/backends/initramfs-tools/live.hook index d3dce71..7ead725 100755 --- a/backends/initramfs-tools/live.hook +++ b/backends/initramfs-tools/live.hook @@ -42,7 +42,7 @@ fi # Handling live-boot -if [ ! -e /usr/share/live-boot ] +if [ ! -e /lib/live/boot ] then echo "W: live-boot-initramfs-tools (backend) installed without live-boot," echo "W: this initramfs will *NOT* have live support." @@ -54,9 +54,6 @@ fi mkdir -p "${DESTDIR}/lib/live" cp -a /lib/live/boot.sh /lib/live/boot "${DESTDIR}/lib/live" -# Directories -mkdir -p "${DESTDIR}"/lib/live-boot - # klibc dependencies for FILE in /lib/libacl* /lib/libblkid* /lib/libuuid* /lib/libdevmapper* /lib/libattr* do diff --git a/backends/initramfs-tools/live.script b/backends/initramfs-tools/live.script index ad67e24..46576fb 100755 --- a/backends/initramfs-tools/live.script +++ b/backends/initramfs-tools/live.script @@ -4,5 +4,5 @@ if [ -e /lib/live/boot.sh ] then - /lib/live/boot.sh ${@} + . /lib/live/boot.sh fi diff --git a/manpages/de/live-boot.de.7 b/manpages/de/live-boot.de.7 index 0d040f0..1d4a368 100644 --- a/manpages/de/live-boot.de.7 +++ b/manpages/de/live-boot.de.7 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT 7 13.06.2012 3.0~a32\-1 "Debian Live Project" +.TH LIVE\-BOOT 7 27.06.2012 3.0~a34\-1 "Debian Live Project" .SH NAME \fBlive\-boot\fP \- System Boot Scripts diff --git a/manpages/de/live-persistence.conf.de.5 b/manpages/de/live-persistence.conf.de.5 index 2230810..7d2ea4c 100644 --- a/manpages/de/live-persistence.conf.de.5 +++ b/manpages/de/live-persistence.conf.de.5 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT conf 13.06.2012 3.0~a32\-1 "Debian Live Project" +.TH LIVE\-BOOT conf 27.06.2012 3.0~a34\-1 "Debian Live Project" .SH NAME \fBlive\-persistence.conf\fP \- Configuration file for persistence media in diff --git a/manpages/en/live-boot.7 b/manpages/en/live-boot.7 index 766599c..226d812 100644 --- a/manpages/en/live-boot.7 +++ b/manpages/en/live-boot.7 @@ -1,4 +1,4 @@ -.TH LIVE\-BOOT 7 2012\-06\-13 3.0~a32-1 "Debian Live Project" +.TH LIVE\-BOOT 7 2012\-06\-27 3.0~a34-1 "Debian Live Project" .SH NAME \fBlive\-boot\fR \- System Boot Scripts diff --git a/manpages/en/live-persistence.conf.5 b/manpages/en/live-persistence.conf.5 index e5ce6f4..8c70256 100644 --- a/manpages/en/live-persistence.conf.5 +++ b/manpages/en/live-persistence.conf.5 @@ -1,4 +1,4 @@ -.TH LIVE\-BOOT conf 2012\-06\-13 3.0~a32-1 "Debian Live Project" +.TH LIVE\-BOOT conf 2012\-06\-27 3.0~a34-1 "Debian Live Project" .SH NAME \fBlive-persistence.conf\fR \- Configuration file for persistence media in diff --git a/manpages/es/live-boot.es.7 b/manpages/es/live-boot.es.7 index c6ffae5..cb97a53 100644 --- a/manpages/es/live-boot.es.7 +++ b/manpages/es/live-boot.es.7 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT 7 13.06.2012 3.0~a32\-1 "Proyecto Debian Live" +.TH LIVE\-BOOT 7 27.06.2012 3.0~a34\-1 "Proyecto Debian Live" .SH NOMBRE \fBlive\-boot\fP \- Scripts de Arranque del Sistema diff --git a/manpages/es/live-persistence.conf.es.5 b/manpages/es/live-persistence.conf.es.5 index 2c3a7f5..410b21f 100644 --- a/manpages/es/live-persistence.conf.es.5 +++ b/manpages/es/live-persistence.conf.es.5 @@ -3,7 +3,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH LIVE\-BOOT conf 13.06.2012 3.0~a32\-1 "Proyecto Debian Live" +.TH LIVE\-BOOT conf 27.06.2012 3.0~a34\-1 "Proyecto Debian Live" .SH NOMBRE \fBlive\-persistence.conf\fP \- Fichero para configurar medios de almacenamiento diff --git a/manpages/po/de/live-boot.7.po b/manpages/po/de/live-boot.7.po index 17507c7..4d25a95 100644 --- a/manpages/po/de/live-boot.7.po +++ b/manpages/po/de/live-boot.7.po @@ -1,11 +1,11 @@ # German translations for live-boot package -# (C) 2006-2012 Daniel Baumann +# Copyright (C) 2006-2012 Daniel Baumann # This file is distributed under the same license as the live-boot package. # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a33-1\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"Project-Id-Version: live-boot 3.0~a34-1\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: 2012-04-08 22:48+0300\n" "Last-Translator: Daniel Baumann \n" "Language-Team: none\n" @@ -24,13 +24,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" -msgstr "13.06.2012" +msgid "2012-06-27" +msgstr "27.06.2012" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" +msgid "3.0~a34-1" msgstr "" #. type: TH diff --git a/manpages/po/de/live-persistence.conf.5.po b/manpages/po/de/live-persistence.conf.5.po index 358fcbe..77b6f30 100644 --- a/manpages/po/de/live-persistence.conf.5.po +++ b/manpages/po/de/live-persistence.conf.5.po @@ -1,11 +1,11 @@ # German translations for live-boot package -# (C) 2006-2012 Daniel Baumann +# Copyright (C) 2006-2012 Daniel Baumann # This file is distributed under the same license as the live-boot package. # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a33-1\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"Project-Id-Version: live-boot 3.0~a34-1\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: 2012-04-08 22:48+0300\n" "Last-Translator: Daniel Baumann \n" "Language-Team: none\n" @@ -24,13 +24,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" -msgstr "13.06.2012" +msgid "2012-06-27" +msgstr "27.06.2012" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" +msgid "3.0~a34-1" msgstr "" #. type: TH diff --git a/manpages/po/es/live-boot.7.po b/manpages/po/es/live-boot.7.po index e387450..9bfbbbc 100644 --- a/manpages/po/es/live-boot.7.po +++ b/manpages/po/es/live-boot.7.po @@ -1,11 +1,11 @@ # Spanish translations for live-boot package -# (C) 2012 Carlos Zuferri «chals» +# Copyright (C) 2012 Carlos Zuferri «chals» # This file is distributed under the same license as the live-boot package. # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a33-1\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"Project-Id-Version: live-boot 3.0~a34-1\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: 2012-06-07 20:29+0200\n" "Last-Translator: Carlos Zuferri «chals» \n" "Language-Team: none\n" @@ -24,14 +24,14 @@ msgstr "LIVE-BOOT" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" -msgstr "13.06.2012" +msgid "2012-06-27" +msgstr "27.06.2012" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" -msgstr "3.0~a32-1" +msgid "3.0~a34-1" +msgstr "3.0~a34-1" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 diff --git a/manpages/po/es/live-persistence.conf.5.po b/manpages/po/es/live-persistence.conf.5.po index ba25f34..14f8197 100644 --- a/manpages/po/es/live-persistence.conf.5.po +++ b/manpages/po/es/live-persistence.conf.5.po @@ -1,11 +1,11 @@ # Spanish translations for live-boot package -# (C) 2012 Carlos Zuferri «chals» +# Copyright (C) 2012 Carlos Zuferri «chals» # This file is distributed under the same license as the live-boot package. # msgid "" msgstr "" -"Project-Id-Version: live-boot 3.0~a33-1\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"Project-Id-Version: live-boot 3.0~a34-1\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: 2012-06-07 19:11+0200\n" "Last-Translator: Carlos Zuferri «chals» \n" "Language-Team: none\n" @@ -23,14 +23,14 @@ msgstr "LIVE-BOOT" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" -msgstr "13.06.2012" +msgid "2012-06-27" +msgstr "27.06.2012" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" -msgstr "3.0~a32-1" +msgid "3.0~a34-1" +msgstr "3.0~a34-1" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 diff --git a/manpages/pot/live-boot.7.pot b/manpages/pot/live-boot.7.pot index c560b8d..c5a9eec 100644 --- a/manpages/pot/live-boot.7.pot +++ b/manpages/pot/live-boot.7.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: live-boot VERSION\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" +msgid "2012-06-27" msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" +msgid "3.0~a34-1" msgstr "" #. type: TH diff --git a/manpages/pot/live-persistence.conf.5.pot b/manpages/pot/live-persistence.conf.5.pot index ce9ed8c..d271396 100644 --- a/manpages/pot/live-persistence.conf.5.pot +++ b/manpages/pot/live-persistence.conf.5.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: live-boot VERSION\n" -"POT-Creation-Date: 2012-06-13 13:27+0300\n" +"POT-Creation-Date: 2012-06-27 14:14+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "2012-06-13" +msgid "2012-06-27" msgstr "" #. type: TH #: en/live-boot.7:1 en/live-persistence.conf.5:1 #, no-wrap -msgid "3.0~a32-1" +msgid "3.0~a34-1" msgstr "" #. type: TH diff --git a/scripts/boot/cmdline.sh b/scripts/boot/cmdline.sh index 31f97da..a3781da 100755 --- a/scripts/boot/cmdline.sh +++ b/scripts/boot/cmdline.sh @@ -206,10 +206,10 @@ Cmdline () export PERSISTENCE_STORAGE ;; - persistence-subtext=*) - old_root_overlay_label="${old_root_overlay_label}-${_PARAMETER#persistence-subtext=}" - old_home_overlay_label="${old_home_overlay_label}-${_PARAMETER#persistence-subtext=}" - custom_overlay_label="${custom_overlay_label}-${_PARAMETER#persistence-subtext=}" + persistence-label=*) + old_root_overlay_label="${_PARAMETER#persistence-label=*}" + old_home_overlay_label="${_PARAMETER#persistence-label=*}" + custom_overlay_label="${_PARAMETER#persistence-label=*}" ;; nopersistence) diff --git a/scripts/boot/misc-helpers.sh b/scripts/boot/misc-helpers.sh index 241bba1..cc39fcb 100755 --- a/scripts/boot/misc-helpers.sh +++ b/scripts/boot/misc-helpers.sh @@ -81,7 +81,6 @@ mount_images_in_directory () rootmnt="${2}" mac="${3}" - if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" || match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" || match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" || @@ -377,7 +376,8 @@ really_export () eval export "${STRING}"="${VALUE}" } -is_in_list_separator_helper () { +is_in_list_separator_helper () +{ local sep=${1} shift local element=${1} @@ -386,13 +386,15 @@ is_in_list_separator_helper () { echo ${list} | grep -qe "^\(.*${sep}\)\?${element}\(${sep}.*\)\?$" } -is_in_space_sep_list () { +is_in_space_sep_list () +{ local element=${1} shift is_in_list_separator_helper "[[:space:]]" "${element}" "${*}" } -is_in_comma_sep_list () { +is_in_comma_sep_list () +{ local element=${1} shift is_in_list_separator_helper "," "${element}" "${*}" @@ -501,10 +503,11 @@ where_is_mounted () grep -m1 "^${device} " /proc/mounts | cut -f2 -d ' ' } -trim_path () { - # remove all unnecessary /:s in the path, including last one (except - # if path is just "/") - echo ${1} | sed 's|//\+|/|g' | sed 's|^\(.*[^/]\)/$|\1|' +trim_path () +{ + # remove all unnecessary /:s in the path, including last one (except + # if path is just "/") + echo ${1} | sed 's|//\+|/|g' | sed 's|^\(.*[^/]\)/$|\1|' } what_is_mounted_on () @@ -761,7 +764,8 @@ mount_persistence_media () return 0 } -close_persistence_media () { +close_persistence_media () +{ local device=${1} local backing="$(where_is_mounted ${device})" @@ -945,8 +949,7 @@ find_persistence_media () # in order to probe any filesystem it contains, like we do # below. activate_custom_mounts() also depends on that any luks # device already has been opened. - if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && \ - is_luks_partition ${dev} + if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && is_luks_partition ${dev} then if luks_device=$(open_luks_device "${dev}") then @@ -991,8 +994,7 @@ find_persistence_media () fi # Close luks device if it isn't used - if [ -z "${result}" ] && [ -n "${luks_device}" ] && \ - is_active_luks_mapping "${luks_device}" + if [ -z "${result}" ] && [ -n "${luks_device}" ] && is_active_luks_mapping "${luks_device}" then /sbin/cryptsetup luksClose "${luks_device}" fi @@ -1034,7 +1036,8 @@ is_active_luks_mapping () /sbin/cryptsetup status "${device}" 1>/dev/null 2>&1 } -get_luks_backing_device () { +get_luks_backing_device () +{ device=${1} cryptsetup status ${device} 2> /dev/null | \ awk '{if ($1 == "device:") print $2}' @@ -1131,7 +1134,9 @@ link_files () return fi - find "${src_dir}" -mindepth 1 -maxdepth 1 | while read src; do + find "${src_dir}" -mindepth 1 -maxdepth 1 | \ + while read src + do local dest="${dest_dir}$(basename "${src}")" if [ -d "${src}" ] then @@ -1166,19 +1171,23 @@ do_union () local unionro1="${3}" # first underlying read-only branch (optional) local unionro2="${4}" # second underlying read-only branch (optional) - if [ "${UNIONTYPE}" = "aufs" ] - then - rw_opt="rw" - ro_opt="rr+wh" - noxino_opt="noxino" - elif [ "${UNIONTYPE}" = "unionfs-fuse" ] - then - rw_opt="RW" - ro_opt="RO" - else - rw_opt="rw" - ro_opt="ro" - fi + case "${UNIONTYPE}" in + aufs) + rw_opt="rw" + ro_opt="rr+wh" + noxino_opt="noxino" + ;; + + unionfs-fuse) + rw_opt="RW" + ro_opt="RO" + ;; + + *) + rw_opt="rw" + ro_opt="ro" + ;; + esac case "${UNIONTYPE}" in unionfs-fuse) diff --git a/scripts/boot/mountroot.sh b/scripts/boot/mountroot.sh index dbc66d4..69f6f0a 100755 --- a/scripts/boot/mountroot.sh +++ b/scripts/boot/mountroot.sh @@ -4,8 +4,9 @@ mountroot () { - if [ -x /scripts/local-top/cryptroot ]; then - /scripts/local-top/cryptroot + if [ -x /scripts/local-top/cryptroot ] + then + /scripts/local-top/cryptroot fi exec 6>&1 @@ -136,7 +137,8 @@ mountroot () fi - if [ -n "${ROOT_PID}" ] ; then + if [ -n "${ROOT_PID}" ] + then echo "${ROOT_PID}" > "${rootmnt}"/live/root.pid fi @@ -144,10 +146,11 @@ mountroot () # unionfs-fuse needs /dev to be bind-mounted for the duration of # live-bottom; udev's init script will take care of things after that - if [ "${UNIONTYPE}" = unionfs-fuse ] - then - mount -n -o bind /dev "${rootmnt}/dev" - fi + case "${UNIONTYPE}" in + unionfs-fuse) + mount -n -o bind /dev "${rootmnt}/dev" + ;; + esac # Move to the new root filesystem so that programs there can get at it. if [ ! -d /root/live/image ] @@ -205,13 +208,14 @@ mountroot () ;; esac - if [ "${UNIONFS}" = unionfs-fuse ] - then - umount "${rootmnt}/dev" - fi + case "${UNIONFS}" in + unionfs-fuse) + umount "${rootmnt}/dev" + ;; + esac exec 1>&6 6>&- exec 2>&7 7>&- kill ${tailpid} - [ -w "${rootmnt}/var/log/" ] && mkdir -p /var/log/live && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null + [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/var/log/live" && cp boot.log "${rootmnt}/var/log/live" 2>/dev/null } diff --git a/scripts/boot/netbase.sh b/scripts/boot/netbase.sh index 0528817..3f5f7af 100755 --- a/scripts/boot/netbase.sh +++ b/scripts/boot/netbase.sh @@ -17,7 +17,7 @@ Netbase () IFFILE="/root/etc/network/interfaces" - if [ "${STATICIP}" = "frommedia" -a -e "${IFFILE}" ] + if [ "${STATICIP}" = "frommedia" ] && [ -e "${IFFILE}" ] then # will use existent /etc/network/interfaces log_end_msg @@ -33,9 +33,9 @@ EOF udevadm trigger udevadm settle - if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ] + if [ -z "${NETBOOT}" ] && [ -n "${STATICIP}" ] && [ "${STATICIP}" != "frommedia" ] then - parsed=$(echo "${STATICIP}" | sed -e 's/,/ /g') + parsed=$(echo "${STATICIP}" | sed -e 's|,| |g') for ifline in ${parsed} do diff --git a/scripts/boot/networking.sh b/scripts/boot/networking.sh index 3d22a90..8c8d840 100755 --- a/scripts/boot/networking.sh +++ b/scripts/boot/networking.sh @@ -12,98 +12,101 @@ do_netsetup () [ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15 echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration." - if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && \ - [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ] + if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ] then + # support for Syslinux IPAPPEND parameter + # it sets the BOOTIF variable on the kernel parameter + if [ -n "${BOOTIF}" ] + then + # pxelinux sets BOOTIF to a value based on the mac address of the + # network card used to PXE boot, so use this value for DEVICE rather + # than a hard-coded device name from initramfs.conf. this facilitates + # network booting when machines may have multiple network cards. + # pxelinux sets BOOTIF to 01-$mac_address + + # strip off the leading "01-", which isn't part of the mac + # address + temp_mac=${BOOTIF#*-} + + # convert to typical mac address format by replacing "-" with ":" + bootif_mac="" + IFS='-' + for x in $temp_mac + do + if [ -z "$bootif_mac" ] + then + bootif_mac="$x" + else + bootif_mac="$bootif_mac:$x" + fi + done + unset IFS - # support for Syslinux IPAPPEND parameter - # it sets the BOOTIF variable on the kernel parameter + # look for devices with matching mac address, and set DEVICE to + # appropriate value if match is found. - if [ -n "${BOOTIF}" ] - then - # pxelinux sets BOOTIF to a value based on the mac address of the - # network card used to PXE boot, so use this value for DEVICE rather - # than a hard-coded device name from initramfs.conf. this facilitates - # network booting when machines may have multiple network cards. - # pxelinux sets BOOTIF to 01-$mac_address - - # strip off the leading "01-", which isn't part of the mac - # address - temp_mac=${BOOTIF#*-} - - # convert to typical mac address format by replacing "-" with ":" - bootif_mac="" - IFS='-' - for x in $temp_mac + for device in /sys/class/net/* + do + if [ -f "$device/address" ] + then + current_mac=$(cat "$device/address") + + if [ "$bootif_mac" = "$current_mac" ] + then + DEVICE=${device##*/} + break + fi + fi + done + fi + + # if ethdevice was not specified on the kernel command line + # make sure we try to get a working network configuration + # for *every* present network device (except for loopback of course) + if [ -z "$ETHDEVICE" ] + then + echo "If you want to boot from a specific device use bootoption ethdevice=..." + for device in /sys/class/net/* + do + dev=${device##*/} + if [ "$dev" != "lo" ] + then + ETHDEVICE="$ETHDEVICE $dev" + fi + done + fi + + # split args of ethdevice=eth0,eth1 into "eth0 eth1" + for device in $(echo $ETHDEVICE | sed 's/,/ /g') do - if [ -z "$bootif_mac" ] - then - bootif_mac="$x" - else - bootif_mac="$bootif_mac:$x" - fi + devlist="$devlist $device" done - unset IFS - - # look for devices with matching mac address, and set DEVICE to - # appropriate value if match is found. - for device in /sys/class/net/* + # this is tricky (and ugly) because ipconfig sometimes just hangs/runs into + # an endless loop; if execution fails give it two further tries, that's + # why we use '$devlist $devlist $devlist' for the other for loop + for dev in $devlist $devlist $devlist do - if [ -f "$device/address" ] + echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev" + ipconfig -t "$ETHDEV_TIMEOUT" $dev | tee -a /netboot.config & + jobid=$! + sleep "$ETHDEV_TIMEOUT" ; sleep 1 + if [ -r /proc/"$jobid"/status ] then - current_mac=$(cat "$device/address") - - if [ "$bootif_mac" = "$current_mac" ] - then - DEVICE=${device##*/} - break - fi + echo "Killing job $jobid for device $dev as ipconfig ran into recursion..." + kill -9 $jobid fi - done - fi - # if ethdevice was not specified on the kernel command line - # make sure we try to get a working network configuration - # for *every* present network device (except for loopback of course) - if [ -z "$ETHDEVICE" ] ; then - echo "If you want to boot from a specific device use bootoption ethdevice=..." - for device in /sys/class/net/*; do - dev=${device##*/} ; - if [ "$dev" != "lo" ] ; then - ETHDEVICE="$ETHDEVICE $dev" + # if configuration of device worked we should have an assigned + # IP address, if so let's use the device as $DEVICE for later usage. + # simple and primitive approach which seems to work fine + if ifconfig $dev | grep -q 'inet.*addr:' + then + export DEVICE="$dev" + break fi done - fi - - # split args of ethdevice=eth0,eth1 into "eth0 eth1" - for device in $(echo $ETHDEVICE | sed 's/,/ /g') ; do - devlist="$devlist $device" - done - - # this is tricky (and ugly) because ipconfig sometimes just hangs/runs into - # an endless loop; if execution fails give it two further tries, that's - # why we use '$devlist $devlist $devlist' for the other for loop - for dev in $devlist $devlist $devlist ; do - echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev" - ipconfig -t "$ETHDEV_TIMEOUT" $dev | tee -a /netboot.config & - jobid=$! - sleep "$ETHDEV_TIMEOUT" ; sleep 1 - if [ -r /proc/"$jobid"/status ] ; then - echo "Killing job $jobid for device $dev as ipconfig ran into recursion..." - kill -9 $jobid - fi - - # if configuration of device worked we should have an assigned - # IP address, if so let's use the device as $DEVICE for later usage. - # simple and primitive approach which seems to work fine - if ifconfig $dev | grep -q 'inet.*addr:' ; then - export DEVICE="$dev" - break - fi - done - else for interface in ${DEVICE}; do ipconfig -t "$ETHDEV_TIMEOUT" ${interface} | tee /netboot-${interface}.config @@ -115,7 +118,8 @@ do_netsetup () done fi - for interface in ${DEVICE}; do + for interface in ${DEVICE} + do # source relevant ipconfig output OLDHOSTNAME=${HOSTNAME} [ -e /tmp/net-${interface}.conf ] && . /tmp/net-${interface}.conf diff --git a/scripts/boot/overlay.sh b/scripts/boot/overlay.sh index 7b79df6..cb12c4b 100755 --- a/scripts/boot/overlay.sh +++ b/scripts/boot/overlay.sh @@ -22,10 +22,11 @@ setup_unionfs () ;; esac - if [ "${UNIONTYPE}" = unionfs-fuse ] - then - modprobe fuse - fi + case "${UNIONTYPE}" in + unionfs-fuse) + modprobe fuse + ;; + esac # run-init can't deal with images in a subdir, but we're going to # move all of these away before it runs anyway. No, we're not, @@ -111,25 +112,29 @@ setup_unionfs () fi fstype=$(get_fstype "${backdev}") - if [ "${fstype}" = "unknown" ] - then - panic "Unknown file system type on ${backdev} (${image})" - fi - - if [ -z "${fstype}" ] - then - fstype="${imagename##*.}" - log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}." - fi + case "${fstype}" in + unknown) + panic "Unknown file system type on ${backdev} (${image})" + ;; + + "") + fstype="${imagename##*.}" + log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}." + ;; + esac + + case "${UNIONTYPE}" in + unionmount) + mpoint="${rootmnt}" + rofslist="${rootmnt} ${rofslist}" + ;; + + *) + mpoint="${croot}/${imagename}" + rofslist="${mpoint} ${rofslist}" + ;; + esac - if [ "${UNIONTYPE}" != "unionmount" ] - then - mpoint="${croot}/${imagename}" - rofslist="${mpoint} ${rofslist}" - else - mpoint="${rootmnt}" - rofslist="${rootmnt} ${rofslist}" - fi mkdir -p "${mpoint}" log_begin_msg "Mounting \"${image}\" on \"${mpoint}\" via \"${backdev}\"" mount -t "${fstype}" -o ro,noatime "${backdev}" "${mpoint}" || panic "Can not mount ${backdev} (${image}) on ${mpoint}" @@ -189,9 +194,11 @@ setup_unionfs () removable) whitelistdev="$(removable_dev)" ;; + removable-usb) whitelistdev="$(removable_usb_dev)" ;; + *) whitelistdev="" ;; @@ -206,17 +213,20 @@ setup_unionfs () for media in $(find_persistence_media "${overlays}" "${whitelistdev}") do media="$(echo ${media} | tr ":" " ")" + case ${media} in ${old_root_overlay_label}=*) device="${media#*=}" fix_backwards_compatibility ${device} / union overlay_devices="${overlay_devices} ${device}" ;; + ${old_home_overlay_label}=*) device="${media#*=}" fix_backwards_compatibility ${device} /home bind overlay_devices="${overlay_devices} ${device}" ;; + ${custom_overlay_label}=*) device="${media#*=}" overlay_devices="${overlay_devices} ${device}" @@ -226,7 +236,7 @@ setup_unionfs () elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENCE}" ] then # check if there are any nfs options - if echo ${NFS_COW}|grep -q ',' + if echo ${NFS_COW} | grep -q ',' then nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)" nfs_cow=$(echo ${NFS_COW}|cut -d, -f1) @@ -243,7 +253,7 @@ setup_unionfs () mac="$(get_mac)" if [ -n "${mac}" ] then - cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/") + cowdevice=$(echo ${nfs_cow} | sed "s/client_mac_address/${mac}/") cow_fstype="nfs" else panic "unable to determine mac address" @@ -354,6 +364,7 @@ setup_unionfs () unionfs-fuse) mount -o bind "${d}" "${live_rofs}" ;; + *) mount -o move "${d}" "${live_rofs}" ;; diff --git a/scripts/boot/select-eth-device.sh b/scripts/boot/select-eth-device.sh index 924b8bc..ed1da6f 100755 --- a/scripts/boot/select-eth-device.sh +++ b/scripts/boot/select-eth-device.sh @@ -6,7 +6,8 @@ Select_eth_device () bootconf=$(egrep '^BOOT=' /conf/initramfs.conf | tail -1) # can be superseded by command line (used by Debian-Live's netboot for example) - for ARGUMENT in $(cat /proc/cmdline); do + for ARGUMENT in $(cat /proc/cmdline) + do case "${ARGUMENT}" in netboot=*) NETBOOT="${ARGUMENT#netboot=}" @@ -14,14 +15,10 @@ Select_eth_device () esac done - if [ "$bootconf" != "BOOT=nfs" ] && - [ "$NETBOOT" = "" ] && - [ "$FETCH" = "" ] && - [ "$FTPFS" = "" ] && - [ "$HTTPFS" = "" ] + if [ "$bootconf" != "BOOT=nfs" ] && [ -z "$NETBOOT" ] && [ -z "$FETCH" ] && [ -z "$FTPFS" ] && [ -z "$HTTPFS" ] then - # Not a net boot : nothing to do - return + # Not a net boot : nothing to do + return fi # we want to do some basic IP @@ -30,33 +27,38 @@ Select_eth_device () # Available Ethernet interfaces ? l_interfaces="" echo "Waiting for ethernet card(s) up... If this fails, maybe the ethernet card is not supported by the kernel `uname -r`?" - while [ -z "$l_interfaces" ]; do - l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)" + while [ -z "$l_interfaces" ] + do + l_interfaces="$(cd /sys/class/net/ && ls -d eth* 2>/dev/null)" done - if [ $(echo $l_interfaces | wc -w) -lt 2 ]; then + if [ $(echo $l_interfaces | wc -w) -lt 2 ] + then # only one interface : no choice echo "DEVICE=$l_interfaces" >> /conf/param.conf return fi # If user force to use specific device, write it - for ARGUMENT in $(cat /proc/cmdline); do - case "${ARGUMENT}" in - live-netdev=*) - NETDEV="${ARGUMENT#live-netdev=}" - echo "DEVICE=$NETDEV" >> /conf/param.conf - echo "Found live-netdev parameter in /proc/cmdline. Force to use network device $NETDEV." - return - ;; - esac + for ARGUMENT in $(cat /proc/cmdline) + do + case "${ARGUMENT}" in + live-netdev=*) + NETDEV="${ARGUMENT#live-netdev=}" + echo "DEVICE=$NETDEV" >> /conf/param.conf + echo "Found live-netdev parameter in /proc/cmdline. Force to use network device $NETDEV." + return + ;; + esac done found_eth_dev="" - while true; do + while true + do echo -n "Looking for a connected Ethernet interface ..." - for interface in $l_interfaces; do + for interface in $l_interfaces + do # ATTR{carrier} is not set if this is not done echo -n " $interface ?" ipconfig -c none -d $interface -t 1 >/dev/null 2>&1 @@ -64,18 +66,24 @@ Select_eth_device () echo '' - for step in 1 2 3 4 5; do - for interface in $l_interfaces; do + for step in 1 2 3 4 5 + do + for interface in $l_interfaces + do carrier=$(cat /sys/class/net/$interface/carrier \ 2>/dev/null) # link detected - if [ "$carrier" = 1 ]; then - echo "Connected $interface found" - # inform initrd's init script : - found_eth_dev="$found_eth_dev $interface" - fi + + case "${carrier}" in + 1) + echo "Connected $interface found" + # inform initrd's init script : + found_eth_dev="$found_eth_dev $interface" + ;; + esac done - if [ -n "$found_eth_dev" ]; then + if [ -n "$found_eth_dev" ] + then echo "DEVICE='$found_eth_dev'" >> /conf/param.conf return else -- 2.1.4