X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=95673018acf8c1f5076c31867c6f77f70ded71ca;hb=7c563d53a8726c6769a113045e5fae01bdc0a8a6;hp=7e748dcf68be3254aa15eec2a1a392214c6a93de;hpb=b0ed7d4fd478305f56314fbe58fd41a3df2dda3a;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index 7e748dc..9567301 100755 --- a/scripts/live +++ b/scripts/live @@ -18,12 +18,11 @@ home_snapshot_label="home-sn" USERNAME="user" USERFULLNAME="Live user" HOSTNAME="host" -BUILD_SYSTEM="Custom" mkdir -p "${mountpoint}" [ -f /etc/live.conf ] && . /etc/live.conf -export USERNAME USERFULLNAME HOSTNAME BUILD_SYSTEM +export USERNAME USERFULLNAME HOSTNAME . /scripts/live-helpers @@ -46,7 +45,7 @@ Arguments () console=*) DEFCONSOLE="${ARGUMENT#*=}" - export DEFCONFSOLE + export DEFCONSOLE ;; debug) @@ -372,6 +371,11 @@ Arguments () export TORAM MODULETORAM ;; + exposedroot) + EXPOSED_ROOT="Yes" + export EXPOSED_ROOT + ;; + union=*) UNIONTYPE="${ARGUMENT#union=}" export UNIONTYPE @@ -618,7 +622,7 @@ do_netmount () { rc=1 - modprobe "${MP_QUIET}" af_packet # For DHCP + modprobe -q af_packet # For DHCP udevtrigger udevsettle @@ -688,7 +692,7 @@ do_nfsmount () { rc=1 - modprobe "${MP_QUIET}" nfs + modprobe -q nfs if [ -z "${NFSOPTS}" ] then @@ -721,7 +725,7 @@ do_cifsmount () fi [ "${quiet}" != "y" ] && log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}" - modprobe "${MP_QUIET}" cifs + modprobe -q cifs if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}" then @@ -762,7 +766,7 @@ do_snap_copy () if [ -n "${fstype}" ] then # Copying stuff... - mount -t "${fstype}" -o ro,noatime,nodiratime "${fromdev}" "${tomount}" + mount -t "${fstype}" -o ro,noatime "${fromdev}" "${tomount}" cp -a "${tomount}"/* ${todir} umount "${tomount}" else @@ -861,7 +865,7 @@ setup_unionfs () image_directory="${1}" rootmnt="${2}" - modprobe "${MP_QUIET}" -b ${UNIONTYPE} + modprobe -q -b ${UNIONTYPE} # 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, @@ -938,7 +942,7 @@ setup_unionfs () mkdir -p "${croot}/${imagename}" echo "debug: Can not mount backdev ${backdev} (image = ${image}) on croot/imagename ${croot}/${imagename}" - mount -t "${fstype}" -o ro,noatime,nodiratime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}" + mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}" fi done @@ -962,9 +966,40 @@ setup_unionfs () fi fi - mount ${cowdevice} -t ${cow_fstype} -o rw,noatime,nodiratime /cow || panic "Can not mount ${cowdevice} on /cow" + rofscount=$(echo ${rofslist} |wc -w) + + if [ -n "${EXPOSED_ROOT}" ] + then + if [ ${rofscount} -ne 1 ] + then + panic "only one RO file system supported with exposedroot: ${rofslist}" + fi + exposedrootfs=${rofslist%% } + + mount --bind ${exposedrootfs} ${rootmnt} || \ + panic "bind mount of ${exposedrootfs} failed" + + mount ${cowdevice} -t ${cow_fstype} -o rw,noatime /cow || \ + panic "Can not mount ${cowdevice} on /cow" + + cow_dirs='/tmp /var/tmp /var/lock /var/run /var/log /var/spool + /home /live /var/lib/live' - mount -t ${UNIONTYPE} -o noatime,nodiratime,dirs=/cow=rw:${rofsstring} ${UNIONTYPE} "${rootmnt}" || panic "${UNIONTYPE} mount failed" + 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" + done + else + mount ${cowdevice} -t ${cow_fstype} -o rw,noatime /cow || \ + panic "Can not mount ${cowdevice} on /cow" + mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \ + ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \ + ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}" + fi # Adding other custom mounts if [ -n "${PERSISTENT}" ] @@ -975,7 +1010,7 @@ setup_unionfs () if [ -b "${homecow}" ] then - mount -t $(get_fstype "${homecow}") -o rw,noatime,nodiratime "${homecow}" "${rootmnt}/home" + mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home" export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy() else [ "${quiet}" != "y" ] && log_warning_msg "Unable to find the persistent home medium" @@ -1030,7 +1065,7 @@ check_dev () if is_supported_fs ${fstype} then - mount -t ${fstype} -o ro,noatime,nodiratime "${devname}" ${mountpoint} || continue + mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue if is_live_path ${mountpoint} && \ ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})