# Reading configuration file from filesystem and live-media
for _FILE in /etc/live/boot.conf /etc/live/boot/* \
- /lib/live/mount/media/live/boot.conf /lib/live/mount/media/live/boot/*
+ /run/live/medium/live/boot.conf /run/live/medium/live/boot/*
do
if [ -e "${_FILE}" ]
then
[ "${QUIET}" ] || echo -n " core"
mkdir -p "${DESTDIR}/bin"
-cp -a /bin/live-boot /lib/live/boot "${DESTDIR}/bin"
+cp -a /bin/live-boot "${DESTDIR}/bin"
mkdir -p "${DESTDIR}/lib/live"
cp -a /lib/live/boot "${DESTDIR}/lib/live"
done
# udev dependencies
-for FILE in /lib/udev/*_id
-do
- copy_exec "${FILE}"
-done
+if [ "${MINIMAL:-}" != "true" ] && [ "${MINIMAL:-}" != "yes" ]
+then
+ for FILE in /lib/udev/*_id
+ do
+ copy_exec "${FILE}"
+ done
+fi
-if [ -e /lib/udev/rules.d/60-cdrom_id.rules ]
+if [ -e /lib/udev/rules.d/60-cdrom_id.rules ] && [ "${DISABLE_CDROM:-}" != "true" ] && \
+ [ "${DISABLE_CDROM:-}" != "yes" ]
then
mkdir -p "${DESTDIR}/lib/udev/rules.d"
cp -p /lib/udev/rules.d/60-cdrom_id.rules "${DESTDIR}/lib/udev/rules.d"
# Filesystem: jffs2
manual_add_modules jffs2
-if [ -x /usr/bin/rsync ]
+if [ -x /usr/bin/rsync ] && [ "${MINIMAL:-}" != "true" ] && [ "${MINIMAL:-}" != "yes" ]
then
copy_exec /usr/bin/rsync /bin
fi
manual_add_modules overlay
# Filesystem: vfat
-manual_add_modules nls_cp437
-manual_add_modules nls_iso8859-1
-manual_add_modules nls_utf8
-manual_add_modules nls_ascii
-manual_add_modules vfat
+if [ "${DISABLE_FAT:-}" != "true" ] && [ "${DISABLE_FAT:-}" != "yes" ]
+then
+ manual_add_modules nls_cp437
+ manual_add_modules nls_iso8859-1
+ manual_add_modules nls_utf8
+ manual_add_modules nls_ascii
+ manual_add_modules vfat
+fi
# Filesystem: ntfs
-manual_add_modules ntfs
+if [ "${DISABLE_NTFS:-}" != "true" ] && [ "${DISABLE_NTFS:-}" != "yes" ]
+then
+ manual_add_modules ntfs
+fi
[ "${QUIET}" ] || echo -n " devices"
# Hardware: cdrom
-manual_add_modules ide-cd
-manual_add_modules ide-generic
-manual_add_modules ohci1394
-manual_add_modules sbp2
-manual_add_modules sr_mod
+if [ "${DISABLE_CDROM:-}" != "true" ] && [ "${DISABLE_CDROM:-}" != "yes" ]
+then
+ manual_add_modules ide-cd
+ manual_add_modules ide-generic
+ manual_add_modules ohci1394
+ manual_add_modules sbp2
+ manual_add_modules sr_mod
+fi
# Hardware: usb
-manual_add_modules sd_mod
+if [ "${DISABLE_USB:-}" != "true" ] && [ "${DISABLE_USB:-}" != "yes" ]
+then
+ manual_add_modules sd_mod
+fi
# Hardware: network
auto_add_modules net
copy_exec /usr/bin/eject /bin
fi
-# Program: mount
-# fuse does not work with klibc mount
-copy_exec /bin/mount /bin/mount.util-linux
-
[ "${QUIET}" ] || echo -n " utils"
# Feature: Verify Checksums
fi
# Program: udev
-if [ -x /sbin/udevadm ]
+if [ -x /bin/udevadm ]
then
[ "${QUIET}" ] || echo -n " udev"
- copy_exec /sbin/udevadm
-fi
-
-# Program: wget
-if [ -x /usr/bin/wget ]
-then
- [ "${QUIET}" ] || echo -n " wget"
- copy_exec /usr/bin/wget /bin
+ copy_exec /bin/udevadm
fi
# Program: blockdev
fi
# FUSE kernel module
-manual_add_modules fuse
-
-# FUSE filesystem: httpfs2
-if [ -x /usr/bin/httpfs2_ssl ]
-then
- [ "${QUIET}" ] || echo -n " httpfs:ssl"
- copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
-elif [ -x /usr/bin/httpfs2 ]
+if [ "${DISABLE_FUSE:-n}" != "true" ] && [ "${DISABLE_FUSE:-n}" != "yes" ]
then
- [ "${QUIET}" ] || echo -n " httpfs"
- copy_exec /usr/bin/httpfs2 /bin/httpfs
-fi
+ manual_add_modules fuse
-# FUSE filesystem: curlftpfs
-if [ -x /usr/bin/curlftpfs ]
-then
- [ "${QUIET}" ] || echo -n " ftpfs"
- copy_exec /usr/bin/curlftpfs /bin
+ # FUSE filesystem: httpfs2
+ if [ -x /usr/bin/httpfs2_ssl ]
+ then
+ [ "${QUIET}" ] || echo -n " httpfs:ssl"
+ copy_exec /usr/bin/httpfs2_ssl /bin/httpfs
+ elif [ -x /usr/bin/httpfs2 ]
+ then
+ [ "${QUIET}" ] || echo -n " httpfs"
+ copy_exec /usr/bin/httpfs2 /bin/httpfs
+ fi
+
+ # FUSE filesystem: curlftpfs
+ if [ -x /usr/bin/curlftpfs ]
+ then
+ [ "${QUIET}" ] || echo -n " ftpfs"
+ copy_exec /usr/bin/curlftpfs /bin
+ fi
fi
# iSCSI
# /lib/libnss_files.so.*: /etc/hosts and /etc/passwd
# /lib/libnss_compat.so.*: /etc/passwd
-for _SHLIB in $(find /lib -name 'libnss_dns.so.*')
+for _SHLIB in $(find /lib -name 'libnss_dns.so.*' -o -name 'libnss_files.so.*')
do
copy_exec "${_SHLIB}"
done
-# might be needed if /etc/hosts is used
-#mkdir -p "${DESTDIR}/etc"
-#cp -p /etc/nsswitch.conf "${DESTDIR}/etc"
+if [ ! -e "${DESTDIR}/etc/nsswitch.conf" ]
+then
+ # Needed to make "hostname -f" honor the domainname provided by DHCP
+ echo "hosts: files dns" > "${DESTDIR}/etc/nsswitch.conf"
+fi
# vlan support
if [ -x /sbin/vconfig ]
-#!/bin/sh
-
-#set -e
+# Live system filesystem mounting -*- shell-script -*-
. /bin/live-boot
-. /scripts/functions
+live_top()
+{
+ if [ "${live_top_used}" != "yes" ]; then
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-top"
+ run_scripts /scripts/live-top
+ [ "$quiet" != "y" ] && log_end_msg
+ fi
+ live_top_used=yes
+}
+
+live_premount()
+{
+ if [ "${live_premount_used}" != "yes" ]; then
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-premount"
+ run_scripts /scripts/live-premount
+ [ "$quiet" != "y" ] && log_end_msg
+ fi
+ live_premount_used=yes
+}
+
+live_bottom()
+{
+ if [ "${live_premount_used}" = "yes" ] || [ "${live_top_used}" = "yes" ]; then
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-bottom"
+ run_scripts /scripts/live-bottom
+ [ "$quiet" != "y" ] && log_end_msg
+ fi
+ live_premount_used=no
+ live_top_used=no
+}
+
-mountroot ()
+mountroot()
{
# initramfs-tools entry point for live-boot is mountroot(); function
Live
}
+
+mount_top()
+{
+ # Note, also called directly in case it's overridden.
+ live_top
+}
+
+mount_premount()
+{
+ # Note, also called directly in case it's overridden.
+ live_premount
+}
+
+mount_bottom()
+{
+ # Note, also called directly in case it's overridden.
+ live_bottom
+}
#!/bin/sh
-mountpoint="/live/medium"
+mountpoint="/run/live/medium"
alt_mountpoint="/media"
LIVE_MEDIA_PATH="live"
HOSTNAME="host"
echo "Checking ${_CHECKSUM}..." > "${_TTY}"
# Verify checksums
- /bin/${_DIGEST}sum -c "${_CHECKSUM}" < "${_TTY}" > "${_TTY}"
+ grep -v '^#' "${_CHECKSUM}" | /bin/${_DIGEST}sum -c > "${_TTY}"
_RETURN="${?}"
# Stop after first verification
esac
# Remove persistence
- cd /live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
+ cd /run/live/overlay && find . -not -name 'persistence.conf' | xargs rm -rf
}
ramdisk_size="${_PARAMETER#ramdisk-size=}"
;;
+ overlay-size=*)
+ OVERLAY_SIZE="${_PARAMETER#overlay-size=}"
+ export OVERLAY_SIZE
+ ;;
+
persistence)
PERSISTENCE="true"
export PERSISTENCE
Fstab ()
{
- # FIXME: stop hardcoding overloading of initramfs-tools functions
- . /scripts/functions
- . /lib/live/boot/9990-initramfs-tools.sh
-
if [ -n "${NOFSTAB}" ]
then
return
then
losetup -d /dev/loop0
- if is_mountpoint /live/fromiso
+ if is_mountpoint /run/live/fromiso
then
- umount /live/fromiso
- rmdir --ignore-fail-on-non-empty /live/fromiso \
+ umount /run/live/fromiso
+ rmdir --ignore-fail-on-non-empty /run/live/fromiso \
>/dev/null 2>&1 || true
fi
fi
mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
fi
- # At this point /root should contain the final root filesystem.
- # Move all mountpoints below /live into /root/lib/live/mount.
- # This has to be done after mounting the root filesystem to /
- # otherwise these mount points won't be accessible from the running system.
- for _MOUNT in $(cat /proc/mounts | cut -f 2 -d " " | grep -e "^/live/")
- do
- local newmount
- newmount="${rootmnt}/lib/live/mount/${_MOUNT#/live/}"
- mkdir -p "${newmount}"
- mount -o move "${_MOUNT}" "${newmount}" > /dev/null 2>&1 || \
- mount -o bind "${_MOUNT}" "${newmount}" > /dev/null || \
- log_warning_msg "W: failed to move or bindmount ${_MOUNT} to ${newmount}"
- done
-
if [ -n "${ROOT_PID}" ]
then
echo "${ROOT_PID}" > "${rootmnt}"/lib/live/root.pid
then
losetup -d /dev/loop0
- if is_mountpoint /root/lib/live/mount/findiso
+ if is_mountpoint /run/live/findiso
then
- umount /root/lib/live/mount/findiso
- rmdir --ignore-fail-on-non-empty /root/lib/live/mount/findiso \
+ umount /run/live/findiso
+ rmdir --ignore-fail-on-non-empty /run/live/findiso \
>/dev/null 2>&1 || true
fi
fi
else
DNSFILE="${rootmnt}/etc/resolv.conf"
fi
- if [ -f /etc/resolv.conf ] && [ ! -s ${DNSFILE} ]
+ if [ -f /etc/resolv.conf ] && ! grep -E -q -v '^[[:space:]]*#|^[[:space:]]*$' ${DNSFILE}
then
log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
cp -v /etc/resolv.conf ${DNSFILE}
panic "A wrong rootfs was mounted."
fi
+ # avoid breaking existing user scripts that rely on the old path
+ # this includes code that checks what is mounted on /lib/live/mount/*
+ # (eg: grep /lib/live /proc/mount)
+ # XXX: to be removed before the bullseye release
+ mkdir -p ${rootmnt}/lib/live/mount
+ mount --rbind /run/live ${rootmnt}/lib/live/mount
+
Fstab
Netbase
exec 1>&6 6>&-
exec 2>&7 7>&-
kill ${tailpid}
- [ -w "${rootmnt}/var/log/" ] && mkdir -p "${rootmnt}/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; \
+ cp fsck.log "${rootmnt}/var/log/live" 2>/dev/null )
}
check_dev ()
{
+ local force fix
sysdev="${1}"
devname="${2}"
skip_uuid_check="${3}"
if [ "$ISO_DEVICE" = "/" ]
then
- echo "Warning: device for bootoption fromiso= ($FROMISO) not found.">>/boot.log
+ # not a block device, check if it's an iso file, for
+ # example an ISO when booting on an ONIE system
+ if echo "${FROMISO}" | grep -q "\.iso$"
+ then
+ fs_type=$(get_fstype "${FROMISO}")
+ if is_supported_fs ${fs_type}
+ then
+ mkdir /run/live/fromiso
+ mount -t $fs_type "${FROMISO}" /run/live/fromiso
+ if [ "$?" != 0 ]
+ then
+ echo "Warning: unable to mount ${FROMISO}." >>/boot.log
+ fi
+ devname="/run/live/fromiso"
+ fi
+ else
+ echo "Warning: device for bootoption fromiso= ($FROMISO) not found.">>/boot.log
+ fi
else
fs_type=$(get_fstype "${ISO_DEVICE}")
if is_supported_fs ${fs_type}
then
- mkdir /live/fromiso
- mount -t $fs_type "$ISO_DEVICE" /live/fromiso
+ mkdir /run/live/fromiso
+ mount -t $fs_type "$ISO_DEVICE" /run/live/fromiso
ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
- loopdevname=$(setup_loop "/live/fromiso/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
+ loopdevname=$(setup_loop "/run/live/fromiso/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
devname="${loopdevname}"
else
echo "Warning: unable to mount $ISO_DEVICE." >>/boot.log
then
devuid=$(blkid -o value -s UUID "$devname")
[ -n "$devuid" ] && grep -qs "\<$devuid\>" /var/lib/live/boot/devices-already-tried-to-mount && continue
+
+ for _PARAMETER in ${LIVE_BOOT_CMDLINE}
+ do
+ case "${_PARAMETER}" in
+ forcefsck)
+ FORCEFSCK="true"
+ ;;
+ esac
+ done
+
+ if [ "${PERSISTENCE_FSCK}" = "true" ] || [ "${PERSISTENCE_FSCK}" = "yes" ] || [ "${FORCEFSCK}" = "true" ]
+ then
+ force=""
+ if [ "$FORCEFSCK" = "true" ]
+ then
+ force="-f"
+ fi
+
+ fix="-a"
+ if [ "$FSCKFIX" = "true" ] || [ "$FSCKFIX" = "yes" ]
+ then
+ fix="-y"
+ fi
+
+ fsck $fix $force ${devname} >> fsck.log 2>&1
+ fi
+
mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
[ -n "$devuid" ] && echo "$devuid" >> /var/lib/live/boot/devices-already-tried-to-mount
if [ -f ${mountpoint}/${FINDISO} ]
then
umount ${mountpoint}
- mkdir -p /live/findiso
- mount -t ${fstype} -o ro,noatime "${devname}" /live/findiso
- loopdevname=$(setup_loop "/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" 0 "")
+ mkdir -p /run/live/findiso
+ mount -t ${fstype} -o ro,noatime "${devname}" /run/live/findiso
+ loopdevname=$(setup_loop "/run/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" 0 "")
devname="${loopdevname}"
mount -t iso9660 -o ro,noatime "${devname}" ${mountpoint}
else
# get_custom_mounts() might call this with a directory path instead
# of a block device path. This means we have found sub-directory path
- # underneath /lib/live/mounts/persistence, so we're done
+ # underneath /run/live/persistence, so we're done
if [ -d "${device}" ]
then
echo "${device}"
return 1
fi
- backing="/live/persistence/$(basename ${device})"
+ backing="/run/live/persistence/$(basename ${device})"
mkdir -p "${backing}"
old_backing="$(where_is_mounted ${device})"
# in one union together.
#
black_listed_devices=""
- for d in /live/rootfs/* /live/findiso /live/fromiso
+ for d in /run/live/rootfs/* /run/live/findiso /run/live/fromiso
do
black_listed_devices="${black_listed_devices} $(what_is_mounted_on d)"
done
get_custom_mounts ()
{
- # Side-effect: leaves $devices with persistence.conf mounted in /live/persistence
+ # Side-effect: leaves $devices with persistence.conf mounted in /run/live/persistence
# Side-effect: prints info to file $custom_mounts
local custom_mounts devices bindings links
if [ -n "${LIVE_BOOT_DEBUG}" ] && [ -e "${include_list}" ]
then
- cp ${include_list} /live/persistence/${persistence_list}.${device_name}
+ cp ${include_list} /run/live/persistence/${persistence_list}.${device_name}
fi
while read dir options # < ${include_list}
continue
fi
- if trim_path ${dir} | grep -q -e "^[^/]" -e "^/lib" -e "^/lib/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
+ if trim_path ${dir} | grep -q -e "^[^/]" -e "^/lib" -e "^/run/live\(/.*\)\?$" -e "^/\(.*/\)\?\.\.\?\(/.*\)\?$"
then
- log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/lib\", or \"/lib/live\" or any of its sub-directories."
+ log_warning_msg "Skipping unsafe custom mount ${dir}: must be an absolute path containing neither the \".\" nor \"..\" special dirs, and cannot be \"/lib\", or \"/run/live\" or any of its sub-directories."
continue
fi
rootfs_dest_backing=""
if [ -n "${opt_link}" ] || [ -n "${opt_union}" ]
then
- for d in /live/rootfs/*
+ for d in /run/live/rootfs/*
do
if [ -n "${rootmnt}" ]
then
local cow_dir links_source
if [ -n "${opt_link}" ] && [ -z "${PERSISTENCE_READONLY}" ]
then
- link_files ${source} ${dest} "s|^/live/|/lib/live/mount/|"
+ link_files ${source} ${dest} ""
elif [ -n "${opt_link}" ] && [ -n "${PERSISTENCE_READONLY}" ]
then
- mkdir -p ${rootmnt}/lib/live/mount/persistence
- links_source=$(mktemp -d ${rootmnt}/lib/live/mount/persistence/links-source-XXXXXX)
+ mkdir -p /run/live/persistence
+ links_source=$(mktemp -d /run/live/persistence/links-source-XXXXXX)
chown_ref ${source} ${links_source}
chmod_ref ${source} ${links_source}
# We put the cow dir in the below strange place to
# has its own directory and isn't nested with some
# other custom mount (if so that mount's files would
# be linked, causing breakage.
- cow_dir="/live/overlay/lib/live/mount/persistence/$(basename ${links_source})"
+ cow_dir="/run/live/overlay/run/live/persistence/$(basename ${links_source})"
mkdir -p ${cow_dir}
chown_ref "${source}" "${cow_dir}"
chmod_ref "${source}" "${cow_dir}"
# bind-mount and union mount are handled the same
# in read-only mode, but note that rootfs_dest_backing
# is non-empty (and necessary) only for unions
- cow_dir="/live/overlay/${dest}"
+ cow_dir="/run/live/overlay/${dest}"
if [ -e "${cow_dir}" ] && [ -z "${opt_link}" ]
then
# If an earlier custom mount has files here
mkdir -p ${cow_dir}
chown_ref "${source}" "${cow_dir}"
chmod_ref "${source}" "${cow_dir}"
+ if [ "${UNIONTYPE}" = "overlay" ]
+ then
+ # When we use overlay we add the "/rw" postfix to our source when using it
+ # as upper layer. Therefore we also have to add it here when using it as
+ # the lower layer.
+ source="${source}/rw"
+ fi
do_union ${dest} ${cow_dir} ${source} ${rootfs_dest_backing}
fi
FUSE_MOUNT="httpfs"
fi
- if [ -n "${FUSE_MOUNT}" ] && [ -x /bin/mount.util-linux ]
- then
- # fuse does not work with klibc mount
- ln -f /bin/mount.util-linux /bin/mount
- fi
-
modprobe fuse
$FUSE_MOUNT "${url}" "${dest}"
ROOT_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )"
return
fi
- # FIXME: stop hardcoding overloading of initramfs-tools functions
- . /scripts/functions
- . /lib/live/boot/9990-initramfs-tools.sh
-
log_begin_msg "Preconfiguring networking"
IFFILE="/root/etc/network/interfaces"
if [ "$bootif_mac" = "$current_mac" ]
then
- ETHDEVICE="${device##*/},$ETHDEVICE" # use ethdevice
+ DEVICE=${device##*/}
break
fi
fi
fi
}
-get_ipconfig_para()
-{
- if [ $# != 1 ] ; then
- echo "Missin parameter for $0"
- return
- fi
- devname=$1
- for ip in ${STATICIP} ; do
- case $ip in
- *:$devname:*)
- echo $ip
- return
- ;;
- esac
- done
- echo $devname
-}
-
do_netsetup ()
{
modprobe -q af_packet # For DHCP
[ -n "$ETHDEV_TIMEOUT" ] || ETHDEV_TIMEOUT=15
echo "Using timeout of $ETHDEV_TIMEOUT seconds for network configuration."
- # Our modus operandi for getting a working network setup is this:
- # * If ip=* is set, pass that to ipconfig and be done
- # * Else, try dhcp on all devices in this order:
- # ethdevice= bootif= <all interfaces>
-
- ALLDEVICES="$(cd /sys/class/net/ && ls -1 2>/dev/null | grep -v '^lo$' )"
-
- # Turn on all interfaces before doing anything, to avoid timing problems
- # during link negotiation.
- echo "Net: Turning on all device links..."
- for device in ${ALLDEVICES}; do
- ipconfig -c none -d $device -t 1 2>/dev/null >/dev/null
- done
-
+ if [ -z "${NETBOOT}" ] && [ -z "${FETCH}" ] && [ -z "${HTTPFS}" ] && [ -z "${FTPFS}" ]
+ then
# See if we can select the device from BOOTIF
Device_from_bootif
if [ -z "$ETHDEVICE" ]
then
echo "If you want to boot from a specific device use bootoption ethdevice=..."
- ETHDEVICE="$ALLDEVICES"
+ 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')
+ for device in $(echo "$ETHDEVICE" | sed 's/,/ /g')
do
devlist="$devlist $device"
done
- for dev in $devlist ; do
- param="$(get_ipconfig_para $dev)"
- if [ -n "$NODHCP" ] && [ "$param" = "$dev" ] ; then
- echo "Ignoring network device $dev due to nodhcp." | tee -a /boot.log
- continue
- fi
- echo "Executing ipconfig -t $ETHDEV_TIMEOUT $param"
- ipconfig -t "$ETHDEV_TIMEOUT" "$param" | tee -a /netboot.config
+ for dev in $devlist
+ do
+ echo "Executing ipconfig -t $ETHDEV_TIMEOUT $dev"
+ ipconfig -t "$ETHDEV_TIMEOUT" "$dev" | tee -a /netboot.config
# 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
-
- IPV4ADDR="0.0.0.0"
- if [ -e "/run/net-${device}.conf" ]; then
- . /run/net-${device}.conf
+ if ifconfig "$dev" | grep -q -E 'inet.*addr:|inet [0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*'
+ then
+ export DEVICE="$dev"
+ break
fi
- if [ "${IPV4ADDR}" != "0.0.0.0" ]; then
- export DEVICE="$dev $DEVICE"
- # break # exit loop as we just use the irst
+ done
+ else
+ for interface in ${DEVICE}; do
+ ipconfig -t "$ETHDEV_TIMEOUT" "${interface}" | tee "/netboot-${interface}.config"
+
+ [ -e "/run/net-${interface}.conf" ] && . "/run/net-${interface}.conf"
+
+ if [ "$IPV4ADDR" != "0.0.0.0" ]
+ then
+ break
fi
done
- unset devlist
+ fi
for interface in ${DEVICE}
do
# source relevant ipconfig output
OLDHOSTNAME=${HOSTNAME}
- [ -e /run/net-${interface}.conf ] && . /run/net-${interface}.conf
+ [ -e "/run/net-${interface}.conf" ] && . "/run/net-${interface}.conf"
- [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
+ [ -z "${HOSTNAME}" ] && HOSTNAME="${OLDHOSTNAME}"
export HOSTNAME
if [ -n "${interface}" ]
then
- HWADDR="$(cat /sys/class/net/${interface}/address)"
+ HWADDR="$(cat "/sys/class/net/${interface}/address")"
+ fi
+
+ # Only create /etc/hosts if FQDN is known (to let 'hostname -f' query
+ # this file). Otherwise DNS will be queried to determine the FQDN.
+ if [ ! -e "/etc/hosts" ] && [ -n "${DNSDOMAIN}" ]
+ then
+ echo "Creating /etc/hosts"
+ cat > /etc/hosts <<EOF
+127.0.0.1 localhost
+127.0.1.1 ${HOSTNAME}.${DNSDOMAIN} ${HOSTNAME}
+
+# The following lines are desirable for IPv6 capable hosts
+::1 localhost ip6-localhost ip6-loopback
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+EOF
fi
if [ ! -e "/etc/resolv.conf" ]
panic "${UNIONTYPE} not available."
fi
- # 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,
- # put them in / since move-mounting them into / breaks mono and
- # some other apps.
-
- croot="/"
+ croot="/run/live/rootfs"
# Let's just mount the read-only file systems first
rootfslist=""
;;
esac
- mpoint="${croot}/${imagename}"
+ mpoint=$(trim_path "${croot}/${imagename}")
rootfslist="${mpoint} ${rootfslist}"
mkdir -p "${mpoint}"
# tmpfs file systems
touch /etc/fstab
- mkdir -p /live/overlay
- mount -t tmpfs tmpfs /live/overlay
+ mkdir -p /run/live/overlay
# Looking for persistence devices or files
if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
then
cowdevice="tmpfs"
cow_fstype="tmpfs"
- cow_mountopt="rw,noatime,mode=755"
+ cow_mountopt="rw,noatime,mode=755,size=${OVERLAY_SIZE:-50%}"
fi
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
then
- mount -t tmpfs -o rw,noatime,mode=755 tmpfs "/live/overlay"
- root_backing="/live/persistence/$(basename ${cowdevice})-root"
+ mount -t tmpfs -o rw,noatime,mode=755,size=${OVERLAY_SIZE:-50%} tmpfs "/run/live/overlay"
+ root_backing="/run/live/persistence/$(basename ${cowdevice})-root"
mkdir -p ${root_backing}
else
- root_backing="/live/overlay"
+ root_backing="/run/live/overlay"
fi
if [ "${cow_fstype}" = "nfs" ]
fi
for dir in ${cow_dirs}; do
- unionmountpoint="${rootmnt}${dir}"
+ unionmountpoint=$(trim_path "${rootmnt}${dir}")
mkdir -p ${unionmountpoint}
- cow_dir="/live/overlay${dir}"
+ cow_dir=$(trim_path "/run/live/overlay${dir}")
rootfs_dir="${rootfs}${dir}"
mkdir -p ${cow_dir}
if [ -n "${PERSISTENCE_READONLY}" ] && [ "${cowdevice}" != "tmpfs" ]
chmod 1777 "${rootmnt}"/tmp
fi
- live_rootfs_list=""
- for d in ${rootfslist}
- do
- live_rootfs="/live/rootfs/${d##*/}"
- live_rootfs_list="${live_rootfs_list} ${live_rootfs}"
- mkdir -p "${live_rootfs}"
- case "${d}" in
- *.dir)
- # do nothing # mount -o bind "${d}" "${live_rootfs}"
- ;;
- *)
- mount -o move "${d}" "${live_rootfs}"
- ;;
- esac
- done
-
# Adding custom persistence
if [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ]
then
# Gather information about custom mounts from devies detected as overlays
get_custom_mounts ${custom_mounts} ${overlay_devices}
- [ -n "${LIVE_BOOT_DEBUG}" ] && cp ${custom_mounts} "/lib/live/mount/persistence"
+ [ -n "${LIVE_BOOT_DEBUG}" ] && cp ${custom_mounts} "/run/live/persistence"
# Now we do the actual mounting (and symlinking)
local used_overlays
fi
done
fi
-
- # ensure that a potentially stray tmpfs gets removed
- # otherways, initramfs-tools is unable to remove /live
- # and fails to boot
- umount /live/overlay > /dev/null 2>&1 || true
}
+live-boot (1:20180603) unstable; urgency=medium
+
+ [ Luca Boccassi ]
+ * Mark live-boot-doc as Multi-Arch: foreign
+ * Remove --parallel from dh to fix Lintian Warning.
+
+ [ Benjamin Drung ]
+ * Fix resolving FQDN given by DHCP
+ * Double quote to prevent globbing and word splitting
+
+ -- Raphaël Hertzog <hertzog@debian.org> Sun, 03 Jun 2018 23:00:11 +0200
+
+live-boot (1:20180328) unstable; urgency=low
+
+ [ Raphaël Hertzog ]
+ * Fix read-only persistence mode with overlayfs. Closes: #877776
+ Thanks to Ronny Standtke <ronny.standtke@fhnw.ch> for the patch.
+ * Add a small warning in the long description that the
+ package must not be installed on a regular system, but only in
+ a live image. Closes: #884886
+ * Strip comments from checksums files passed to "shaXsum -c"
+ Thanks to Andreas Heinlein for the report (Closes: #856482)
+
+ [ Steve McIntyre ]
+ * Repo moved to salsa
+
+ [ Benjamin Drung ]
+ * Don't replace busybox's wget by the true wget.
+ It was likely done for https support but since buster the busybox
+ provided wget has https support too. We save a lot of space by
+ doing so (8 Mb). (Closes: #885455)
+ * Avoid double slashes in some paths (Closes: #885453)
+ * Support setting upperdir tmpfs size with overlay-size boot parameter
+ (Closes: #885466)
+ * Simplify mount point handling by using /run/live instead of /lib/live/mount
+ (Closes: #886328)
+ * Add configuration variables to build a stripped down initrd
+ (Closes: #886337)
+
+ [ Daniel Reichelt ]
+ * Use klibc's mount again for fuse mounts (Closes: #868559)
+
+ [ raizo62 ]
+ * Update DNSFILE even if DNSFILE contains only commented or empty lines
+
+ [ Sameer Agrawal ]
+ * Fix ifconfig parsing (Closes: #892772)
+
+ [ Chas Williams ]
+ * Add back persistence fsck option
+ * Remove workaround for ipconfig issues
+
+ [ Benjamin Drung ]
+ * Remove sourcing /scripts/functions in components
+ * Support live-{top,premount,bottom} hooks (Closes: #884355)
+
+ [ Luca Boccassi ]
+ * Add backward compatibility rbind mount /lib/live/mount -> /run/live.
+ The paths used in the current released versions of live-boot are a
+ form of public API, and existing applications and scripts might rely
+ on them. Do a recursive bind mount of the new path on the previous one
+ so that they do not break on upgrade (see #886328).
+ This backward-compatible mount point will be deprecated and removed
+ before the Bullseye (Debian 11) release. Users are recommended to start
+ migrating to the new /run/live path as soon as possible.
+
+ [ Erik Ziegenbalg ]
+ * fromiso: add support for local ISO (ONIE)
+
+ [ Luca Boccassi ]
+ * Clarify FROMISO documentation in live-boot manpage
+ * Use HTTPS in debian/copyright (policy 4.0.0).
+ * Remove dead link to live-systems.org from debian/copyright.
+ * Bump Standards-Version to 4.1.3, no changes.
+ * Add myself to Uploaders.
+
+ -- Luca Boccassi <bluca@debian.org> Wed, 28 Mar 2018 20:07:39 +0100
+
+live-boot (1:20170623) unstable; urgency=medium
+
+ * Do not duplicate files in /lib/live/boot/ and /bin/boot/ in the initrd.
+ Closes: #864385 Thanks to Daniel Reichelt <debian@nachtgeist.net> for the
+ patch.
+ * Take into account the fact that udevadm is now in /bin and no longer in
+ /sbin. Closes: #852570
+ * Add myself to Uploaders.
+ * Bump debhelper compat to 10.
+ * Bump Standards-Version to 4.0.0.
+ * Fix spelling errors in live-boot(7).
+
+ -- Raphaël Hertzog <hertzog@debian.org> Fri, 23 Jun 2017 14:41:06 +0200
+
live-boot (1:20170112+grml.1) unstable; urgency=medium
[ Kristian Klausen ]
Priority: optional
Maintainer: Grml Team <team@grml.org>
Build-Depends:
- debhelper (>= 9),
-Standards-Version: 3.9.8
+ debhelper (>= 10),
+Standards-Version: 4.1.3
Homepage: http://live.debian.net/devel/live-boot/
Vcs-Browser: http://git.grml.org/?p=live-boot-grml.git
Vcs-Git: git://git.grml.org/live-boot-grml.git
Provides: live-boot
Description: Live System Boot Components
live-boot contains the components to configure a live system during the boot
- process (early userspace).
+ process (early userspace). Do not install this package on your regular system,
+ it is only meant to be used in a live image.
.
In addition to live-boot, a backend for the initrd generation is required, such
as live-boot-initramfs-tools.
Package: live-boot-grml-doc
Section: doc
Architecture: all
+Multi-Arch: foreign
Depends:
${misc:Depends},
Description: Live System Boot Components (documentation)
systems and the official Debian Live images themselves.
.
live-boot contains the components to configure a live system during the boot
- process (early userspace).
+ process (early userspace). Do not install this package on your regular system,
+ it is only meant to be used in a live image.
.
This package contains the initramfs-tools backend.
.
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: live-boot
Upstream-Contact: Live Systems Project <debian-live@lists.debian.org>
-Source: http://live-systems.org/archive/packages/live-boot/
Files: *
Copyright: 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
#!/usr/bin/make -f
%:
- dh ${@} --parallel
+ dh ${@}
override_dh_auto_install:
dh_auto_install -- DESTDIR=debian/tmp
.SS Configuration Files
\fBlive\-boot\fR can be configured (but not activated) through configuration files. Those files can be placed either in the root filesystem itself (/etc/live/boot.conf, /etc/live/boot/*), or on the live media (live/boot.conf, live/boot/*).
+These environment variables can only be set in the configuration files:
+
+.TP
+\fBDISABLE_CDROM\fR=[\fItrue\fR|\fIfalse\fR]
+Disable support for booting from CD-ROMs. If set to '\fIy\fR' mkinitramfs will build an initramfs without the kernel modules for reading CD-ROMs.
+
+.TP
+\fBDISABLE_FAT\fR=[\fItrue\fR|\fIfalse\fR]
+Disable support for booting from FAT file systems. If set to '\fIy\fR' mkinitramfs will build an initramfs without the kernel module vfat and some nls_* modules.
+
+.TP
+\fBDISABLE_FUSE\fR=[\fItrue\fR|\fIfalse\fR]
+Disable support for booting from FUSE-based file systems. If set to '\fIy\fR' mkinitramfs will build an initramfs without the kernel module fuse and file systems that depend on it (like curlftpfs and httpfs2).
+
+.TP
+\fBDISABLE_NTFS\fR=[\fItrue\fR|\fIfalse\fR]
+Disable support for booting from NTFS file systems. If set to '\fIy\fR' mkinitramfs will build an initramfs without the kernel module ntfs.
+
+.TP
+\fBDISABLE_USB\fR=[\fItrue\fR|\fIfalse\fR]
+Disable support for booting from USB devices. If set to '\fIy\fR' mkinitramfs will build an initramfs without the kernel module sd_mod.
+
+.TP
+\fBMINIMAL\fR=[\fItrue\fR|\fIfalse\fR]
+Build a minimal initramfs. If set to '\fIy\fR' mkinitramfs will build an initramfs without some udev scripts and without rsync.
+
+.TP
+\fBPERSISTENCE_FSCK\fR=[\fItrue\fR|\fIfalse\fR]
+Run fsck on persistence filesystem on boot. Will attempt to repair errors. The execution log will be saved in /var/log/live/fsck.log.
+
+.TP
+\fBFSCKFIX\fR=[\fItrue\fR|\fIfalse\fR]
+If PERSISTENCE_FSCK or forcefsck are set, will pass -y to fsck to stop it from asking questions interactively and assume yes to all queries.
.SH OPTIONS
\fBlive\-boot\fR currently features the following parameters.
# Wthreads or MaxConnections
.IP "\fBfindiso\fR=\fI/PATH/TO/IMAGE\fI" 4
Look for the specified ISO file on all disks where it usually looks for the .squashfs file (so you don't have to know the device name as in fromiso=....).
+.IP "\fBforcefsck\fR" 4
+Run fsck on persistence filesystem on boot. Will attempt to repair errors. The execution log will be saved in /var/log/live/fsck.log.
.IP "\fBfromiso\fR=\fI/PATH/TO/IMAGE\fI" 4
-Allows to use a filesystem from within an ISO image that's available on live-media.
+Use a filesystem from within an ISO image that's available on live-media. The first part of the argument should be the block device where the image is stored, followed by the path and filename (e.g. fromiso=/dev/sda1/live/image.iso).
+.br
+Alternatively, it can be used to boot from an ISO embedded into an initrd (e.g. fromiso=/live/image.iso).
.IP "\fBignore_uuid\fR" 4
Do not check that any UUID embedded in the initramfs matches the discovered medium. live\-boot may be told to generate a UUID by setting LIVE_GENERATE_UUID=1 when building the initramfs.
.IP "\fBverify\-checksums\fR" 4
If specified, an MD5 sum is calculated on the live media during boot and compared to the value found in md5sum.txt found in the root directory of the live media.
.IP "\fBip\fR=[\fIDEVICE\fR]:[\fICLIENT_IP\fR]:[\fINETMASK\fR]:[\fIGATEWAY_IP\fR]:[\fINAMESERVER\fR] [,[\fIDEVICE\fR]:[\fICLIENT_IP\fR]:[\fINETMASK\fR]:[\fIGATEWAY_IP\fR]:[\fINAMESERVER\fR]]" 4
-Let you specify the name(s) and the options of the interface(s) that should be configured at boot time. Do not specify this if you want to use dhcp (default). It will be changed in a future release to mimick official kernel boot param specification (e.g. ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp).
+Let you specify the name(s) and the options of the interface(s) that should be configured at boot time. Do not specify this if you want to use dhcp (default). It will be changed in a future release to mimic official kernel boot param specification (e.g. ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0,:::::eth1:dhcp).
.IP "\fBip\fR=[\fIfrommedia\fR]" 4
If this variable is set, dhcp and static configuration are just skipped and the system will use the (must be) media\-preconfigured /etc/network/interfaces instead.
.IP "{\fBlive\-media\fR|\fBbootfrom\fR}=\fIDEVICE\fR" 4
If you specify one of this two equivalent forms, live\-boot will first try to find this device for the "/live" directory where the read\-only root filesystem should reside. If it did not find something usable, the normal scan for block devices is performed.
.br
-Instead of specifing an actual device name, the keyword 'removable' can be used to limit the search of acceptable live media to removable type only. Note that if you want to further restrict the media to usb mass storage only, you can use the 'removable\-usb' keyword.
+Instead of specifying an actual device name, the keyword 'removable' can be used to limit the search of acceptable live media to removable type only. Note that if you want to further restrict the media to usb mass storage only, you can use the 'removable\-usb' keyword.
.IP "{\fBlive\-media\-encryption\fR|\fBencryption\fR}=\fITYPE\fI" 4
live\-boot will mount the encrypted rootfs TYPE, asking the passphrase, useful to build paranoid live systems :\-). TYPE supported so far is "aes" for loop\-aes encryption type.
.IP "\fBlive\-media\-offset\fR=\fIBYTES\fR" 4
.IP "\fBnoeject\fR" 4
Do not prompt to eject the live medium.
.IP "\fBramdisk\-size\fR" 4
-This parameter allows to set a custom ramdisk size (it's the '\-o size' option of tmpfs mount). By default, there is no ramdisk size set, so the default of mount applies (currently 50% of available RAM). Note that this option has currently no effect when booting with toram.
+This parameter defines a custom ramdisk size (it's the '\-o size' option of tmpfs mount). By default, there is no ramdisk size set, so the default of mount applies (currently 50% of available RAM). Note that this option has currently no effect when booting with toram.
+.IP "\fBoverlay\-size\fR=\fISIZE\fR" 4
+The size of the tmpfs mount (used for the upperdir union root mount) in bytes, and rounded up to entire pages. This option accepts a suffix % to limit the instance to that percentage of your physical RAM or a suffix k, m or g for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga (gibi)). By default, 50% of available RAM will be used.
.IP "\fBswap=true\fR" 4
This parameter enables usage of local swap partitions.
.IP "\fBpersistence\fR" 4
live\-boot will probe devices for persistence media. These can be partitions (with the correct GPT name), filesystems (with the correct label) or image files (with the correct file name). Overlays are labeled/named "persistence" (see \fIpersistence.conf\fR(5)). Overlay image files are named "persistence".
.IP "\fBpersistence\-encryption\fR=\fITYPE1\fR,\fITYPE2\fR ... \fITYPEn\fR" 4
-This option determines which types of encryption that we allow to be used when probing devices for persistence media. If "none" is in the list, we allow unencrypted media; if "luks" is in the list, we allow LUKS\-encrypted media. Whenever a device containing encrypted media is probed the user will be prompted for the passphrase. The default value is "none".
+This option determines which types of encryption that are allowed to be used when probing devices for persistence media. If "none" is in the list, we allow unencrypted media; if "luks" is in the list, we allow LUKS\-encrypted media. Whenever a device containing encrypted media is probed the user will be prompted for the passphrase. The default value is "none".
.IP "\fBpersistence\-media\fR={\fIremovable\fR|\fIremovable\-usb\fR}" 4
If you specify the keyword 'removable', live\-boot will try to find persistence partitions on removable media only. Note that if you want to further restrict the media to usb mass storage only, you can use the 'removable\-usb' keyword.
.IP "\fBpersistence\-method\fR=\fITYPE1\fR,\fITYPE2\fR ... \fITYPEn\fR" 4