for ARGUMENT in $(cat /proc/cmdline)
do
case "${ARGUMENT}" in
+ skipconfig)
+ NOACCESSIBILITY="Yes"
+ NOAPPARMOR="Yes"
+ NOAPTCDROM="Yes"
+ NOAUTOLOGIN="Yes"
+ NOCONSOLEKEYBOARD="Yes"
+ NOFASTBOOT="Yes"
+ NOFSTAB="Yes"
+ NOGNOMEPANEL="Yes"
+ NOHOSTS="Yes"
+ NOJOCKEY="Yes"
+ NOKPERSONALIZER="Yes"
+ NOLANGUAGESELECTOR="Yes"
+ NOLOCALES="Yes"
+ NONETWORKING="Yes"
+ NOPOLKITCONF="Yes"
+ NOPOWERMANAGEMENT="Yes"
+ NOPROGRAMCRASHES="Yes"
+ NOSUDO="Yes"
+ NOTIMEZONE="Yes"
+ NOUPDATENOTIFIER="Yes"
+ NOUSER="Yes"
+ NOXAUTOCONFIG="Yes"
+ NOXAUTOLOGIN="Yes"
+ NOXSCREENSAVER="Yes"
+
+ export NOACCESSIBILITY NOAPPARMOR NOAPTCDROM NOAUTOLOGIN NOCONSOLEKEYBOARD NOFASTBOOT NOFSTAB NOGNOMEPANEL NOHOSTS NOJOCKEY NOKPERSONALIZER NOLANGUAGESELECTOR NOLOCALES NONETWORKING NOPOLKITCONF NOPOWERMANAGEMENT NOPROGRAMCRASHES NOSUDO NOTIMEZONE NOUPDATENOTIFIER NOUSER NOXAUTOCONFIG NOXAUTOLOGIN NOXSCREENSAVER
+ ;;
+
access=*)
ACCESS="${ARGUMENT#access=}"
export ACCESS
set -x
;;
+ ethdevice=*)
+ DEVICE="${ARGUMENT#ethdevice=}"
+ export DEVICE
+ ;;
+
fetch=*)
FETCH="${ARGUMENT#fetch=}"
export FETCH
export HOSTNAME LIVECONF
;;
+ isofrom=*|fromiso=*)
+ FROMISO="${ARGUMENT#*=}"
+ export FROMISO
+ ;;
+
username=*)
USERNAME="${ARGUMENT#username=}"
LIVECONF="changed"
export NOPERSISTENT
;;
+ quickusbmodules)
+ QUICKUSBMODULES="Yes"
+ export QUICKUSBMODULES
+ ;;
+
preseed/file=*|file=*)
LOCATION="${ARGUMENT#*=}"
export LOCATION
mount -o bind /dev /root/dev
mkdir -p /root/var/run/network
- chroot /root dhclient eth0
+ [ "${NETBOOT}" ] || chroot /root dhclient eth0
chroot /root wget -P /tmp "${location}"
- chroot /root ifconfig eth0 down
+ [ "${NETBOOT}" ] || chroot /root ifconfig eth0 down
umount /root/sys
umount /root/proc
{
sysfs_path="${1#/sys}"
- if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb))"
+ if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-|platform-mmc)"
then
return 0
elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
if [ -z "${MODULETORAM}" ]
then
- size=$(fs_size "" ${copyfrom} "used")
+ size=$(fs_size "" ${copyfrom}/${LIVE_MEDIA_PATH} "used")
else
MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
# begin copying (or uncompressing)
mkdir "${copyto}"
- echo "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
+ log_begin_msg "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
if [ "${extension}" = "tgz" ]
else
if [ -n "${MODULETORAMFILE}" ]
then
- cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
+ if [ -x /bin/rsync ]
+ then
+ echo " * Copying $MODULETORAMFILE to RAM" 1>/dev/console
+ rsync -a --progress ${MODULETORAMFILE} ${copyto} 1>/dev/console # copy only the filesystem module
+ else
+ cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
+ fi
else
- cp -a ${copyfrom}/* ${copyto} # "cp -a" from busybox also copies hidden files
+ if [ -x /bin/rsync ]
+ then
+ echo " * Copying whole medium to RAM" 1>/dev/console
+ rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files
+ else
+ mkdir -p ${copyto}/${LIVE_MEDIA_PATH}
+ cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} # "cp -a" from busybox also copies hidden files
+ fi
fi
umount ${copyfrom}
modprobe -q af_packet # For DHCP
- if [ -x /sbin/udevadm ]
- then
- # lenny
- udevadm trigger
- udevadm settle
- else
- # etch
- udevtrigger
- udevsettle
- fi
+ udevadm trigger
+ udevadm settle
ipconfig ${DEVICE} | tee /netboot.config
if [ "${PERSISTENT}" != "nofiles" ]
then
# search for image files
- snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.ext4 ${snap_label}.jffs2")
+ snapdata=$(find_files "${PERSISTENT_PATH}${snap_label}.squashfs ${PERSISTENT_PATH}${snap_label}.cpio.gz ${PERSISTENT_PATH}${snap_label}.ext2 ${PERSISTENT_PATH}${snap_label}.ext3 ${PERSISTENT_PATH}${snap_label}.ext4 ${PERSISTENT_PATH}${snap_label}.jffs2")
fi
if [ -z "${snapdata}" ]
image_directory="${1}"
rootmnt="${2}"
addimage_directory="${3}"
- modprobe -q -b ${UNIONTYPE}
+
+ case ${UNIONTYPE} in
+ aufs|unionfs)
+ modprobe -q -b ${UNIONTYPE}
+
+ if ! cut -f2 /proc/filesystems | grep -q "^${UNIONTYPE}\$" && [ -x /bin/unionfs-fuse ]
+ then
+ UNIONTYPE="unionfs-fuse"
+ fi
+ ;;
+ 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,
# Let's just mount the read-only file systems first
rofsstring=""
rofslist=""
- minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
- if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
+ if [ "${UNIONTYPE}" = "aufs" ]
then
- # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
- roopt="nfsro"
- elif [ "${UNIONTYPE}" = "aufs" ]
+ roopt="rr,noxino"
+ elif [ "${UNIONTYPE}" = "unionfs-fuse" ]
then
- roopt="rr"
+ roopt="RO"
else
roopt="ro"
fi
# Looking for "${root_persistence}" device or file
if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
then
- # Load USB modules
- num_block=$(ls -l /sys/block | wc -l)
- for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
- do
- modprobe -q -b ${module}
- done
-
- if [ -x /sbin/udevadm ]
+ if [ -z "${QUICKUSBMODULES}" ]
then
- # lenny
+ # Load USB modules
+ num_block=$(ls -l /sys/block | wc -l)
+ for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
+ do
+ modprobe -q -b ${module}
+ done
+
udevadm trigger
udevadm settle
- else
- # etch
- udevtrigger
- udevsettle
- fi
- # For some reason, udevsettle does not block in this scenario,
- # so we sleep for a little while.
- #
- # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
- for timeout in 5 4 3 2 1
- do
- sleep 1
+ # For some reason, udevsettle does not block in this scenario,
+ # so we sleep for a little while.
+ #
+ # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
+ for timeout in 5 4 3 2 1
+ do
+ sleep 1
- if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
- then
- break
- fi
- done
+ if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
+ then
+ break
+ fi
+ done
+ fi
# search for label and files (this could be hugely optimized)
cowprobe=$(find_cow_device "${root_persistence}")
for dir in ${cow_dirs}; do
mkdir -p /cow${dir}
- mount -t ${UNIONTYPE} \
- -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
- ${UNIONTYPE} "${rootmnt}${dir}" || \
- panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
- rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
+
+ case "${UNIONTYPE}" in
+ unionfs-fuse)
+ (ulimit -n 16384; unionfs-fuse -o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid /cow=RW:${exposedrootfs}${dir} "${rootmnt}${dir}" || panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option cow,noinitgroups,default_permissions,allow_other,use_ino,suid=/cow=RW:${exposedrootfs}${dir}")
+ ;;
+
+ *)
+ mount -t ${UNIONTYPE} -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro ${UNIONTYPE} "${rootmnt}${dir}" || panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
+ ;;
+ esac
done
else
- mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
- ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
- ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
+ case "${UNIONTYPE}" in
+ unionfs-fuse)
+ (ulimit -n 16384; unionfs-fuse -o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid /cow=RW:${rofsstring} "${rootmnt}" || panic "mount ${UNIONTYPE} on ${rootmnt} failed with option cow,noinitgroups,default_permissions,allow_other,use_ino,suid=/cow:RW:${rofsstring}")
+ ;;
+
+ *)
+ mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
+ ;;
+ esac
fi
# Correct the permissions of /:
;;
*)
- mount -o move "${d}" "${rootmnt}/live/${d##*/}"
+ case "${UNIONTYPE}" in
+ unionfs-fuse)
+ mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+
+ *)
+ mount -o move "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+ esac
;;
esac
done
devname="${2}"
skip_uuid_check="${3}"
+ # support for fromiso=.../isofrom=....
+ if [ -n "$FROMISO" ]
+ then
+ mkdir /isofrom
+ ISO_DEVICE="$(echo $FROMISO | sed 's|\(/dev/[a-z]*[0-9]*\).*|\1|')"
+ mount "$ISO_DEVICE" /isofrom
+ ISO_NAME="$(echo $FROMISO | sed 's|/dev/[a-z]*[0-9]*/||')"
+ loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
+ devname="${loopdevname}"
+ fi
+
if [ -z "${devname}" ]
then
devname=$(sys2dev "${sysdev}")
fi
fi
done
+ return 1
;;
removable)
done
fi
done
+ return 1
;;
*)
log_end_msg
fi
+ # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
+ # because the mountpoint is left behind in /proc/mounts, so let's get
+ # rid of it when running from RAM
+ if [ -n "$FROMISO" ] && [ "${TORAM}" ]
+ then
+ losetup -d /dev/loop0
+ grep -q /isofrom /proc/mounts && umount /isofrom
+ fi
+
if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
then
setup_unionfs "${livefs_root}" "${rootmnt}"
log_end_msg
+ # 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
+
maybe_break live-bottom
log_begin_msg "Running /scripts/live-bottom\n"
run_scripts /scripts/live-bottom
log_end_msg
+ if [ "${UNIONFS}" = unionfs-fuse ]
+ then
+ umount "${rootmnt}/dev"
+ fi
+
exec 1>&6 6>&-
exec 2>&7 7>&-
kill ${tailpid}