X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=blobdiff_plain;f=components%2F9990-misc-helpers.sh;h=315e3b16d9a23fb692ce70c515e53f94b7f021c1;hp=902ddfe86011139240fc9a176671b3dcceab9af4;hb=d1d4af9b25661d047a3c5a739b5d1e991a863d88;hpb=e5e8d934a9d992efec23998e289863852df18b8b diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index 902ddfe..315e3b1 100755 --- a/components/9990-misc-helpers.sh +++ b/components/9990-misc-helpers.sh @@ -161,7 +161,7 @@ check_dev () # Adding lvm support if [ -x /scripts/local-top/lvm2 ] then - ROOT="$device" resume="" /scripts/local-top/lvm2 + ROOT="$device" resume="" /scripts/local-top/lvm2 >>/boot.log fi ;; @@ -169,10 +169,10 @@ check_dev () # Adding raid support if [ -x /scripts/local-top/mdadm ] then - cp /conf/conf.d/md /conf/conf.d/md.orig + [ -r /conf/conf.d/md ] && cp /conf/conf.d/md /conf/conf.d/md.orig echo "MD_DEVS=$device " >> /conf/conf.d/md - /scripts/local-top/mdadm - mv /conf/conf.d/md.orig /conf/conf.d/md + /scripts/local-top/mdadm >>/boot.log + [ -r /conf/conf.d/md.orig ] && mv /conf/conf.d/md.orig /conf/conf.d/md fi ;; esac @@ -426,7 +426,7 @@ is_supported_fs () return 0 else # Then try to add support for it the gentle way using the initramfs capabilities - modprobe ${fstype} + modprobe -q -b ${fstype} if grep -q ${fstype} /proc/filesystems then return 0 @@ -803,9 +803,30 @@ open_luks_device () load_keymap + # check for plymouth + if [ -x /bin/plymouth ] + then + _PLYMOUTH="true" + fi + + case "${_PLYMOUTH}" in + true) + plymouth --ping + + cryptkeyscript="plymouth ask-for-password --prompt" + # Plymouth will add a : if it is a non-graphical prompt + cryptkeyprompt="Please unlock disk ${dev}" + ;; + + *) + cryptkeyscript="/lib/cryptsetup/askpass" + cryptkeyprompt="Please unlock disk ${dev}: " + ;; + esac + while true do - /lib/cryptsetup/askpass "Enter passphrase for ${dev}: " | \ + $cryptkeyscript "$cryptkeyprompt" | \ /sbin/cryptsetup -T 1 luksOpen ${dev} ${name} ${opts} if [ 0 -eq ${?} ] @@ -816,11 +837,28 @@ open_luks_device () fi echo >&6 - echo -n "There was an error decrypting ${dev} ... Retry? [Y/n] " >&6 - read answer + retryprompt="There was an error decrypting ${dev} ... Retry? [Y/n]" + + case "${_PLYMOUTH}" in + true) + plymouth display-message --text "${retryprompt}" + answer=$(plymouth watch-keystroke --keys="YNyn") + ;; + + *) + echo -n "${retryprompt} " >&6 + read answer + ;; + esac if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ] then + case "${_PLYMOUTH}" in + true) + plymouth display-message --text "" + ;; + esac + return 2 fi done @@ -1254,23 +1292,8 @@ do_union () 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) - unionmountopts="-o cow -o noinitgroups -o default_permissions -o allow_other -o use_ino -o suid" - unionmountopts="${unionmountopts} ${unionrw}=${rw_opt}" + unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}" if [ -n "${unionro}" ] then for rofs in ${unionro} @@ -1278,36 +1301,36 @@ do_union () unionmountopts="${unionmountopts}:${rofs}=${ro_opt}" done fi - ( sysctl -w fs.file-max=391524 ; ulimit -HSn 16384 - unionfs-fuse ${unionmountopts} "${unionmountpoint}" ) && \ - ( mkdir -p /run/sendsigs.omit.d - pidof unionfs-fuse >> /run/sendsigs.omit.d/unionfs-fuse || true ) + mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" ;; - overlayfs) - # XXX: can multiple unionro be used? (overlayfs only handles two dirs, but perhaps they can be chained?) - # XXX: and can unionro be optional? i.e. can overlayfs skip lowerdir? + overlay) + rw_opt="rw" + ro_opt="ro" + + # XXX: can multiple unionro be used? (overlay only handles two dirs, but perhaps they can be chained?) + # XXX: and can unionro be optional? i.e. can overlay skip lowerdir? if echo ${unionro} | grep -q " " then - panic "Multiple lower filesystems are currently not supported with overlayfs (unionro = ${unionro})." + panic "Multiple lower filesystems are currently not supported with overlay (unionro = ${unionro})." elif [ -z "${unionro}" ] then - panic "Overlayfs needs at least one lower filesystem (read-only branch)." + panic "overlay needs at least one lower filesystem (read-only branch)." fi unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}" - mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" - ;; - - *) - unionmountopts="-o noatime,${noxino_opt},dirs=${unionrw}=${rw_opt}" - if [ -n "${unionro}" ] + if ! mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" 2>/dev/null then - for rofs in ${unionro} - do - unionmountopts="${unionmountopts}:${rofs}=${ro_opt}" - done + # Ref: kiwi from OpenSuse kiwi-7.02.18-1.1 + # overlayfs in version >= v22 behaves differently + # + renamed from overlayfs to overlay + # + requires a workdir to become mounted + # + requires workdir and upperdir to reside under the same mount + # + requires workdir and upperdir to be in separate subdirs + mkdir ${unionrw}/rw + mkdir ${unionrw}/work + unionmountopts="-o noatime,lowerdir=${unionro},upperdir=${unionrw}/rw,workdir=${unionrw}/work" + mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" fi - mount -t ${UNIONTYPE} ${unionmountopts} ${UNIONTYPE} "${unionmountpoint}" ;; esac } @@ -1377,7 +1400,7 @@ get_custom_mounts () union|bind) ;; *) - log_warning_msg "Skipping custom mount with unkown option: ${opt}" + log_warning_msg "Skipping custom mount with unknown option: ${opt}" continue 2 ;; esac @@ -1422,7 +1445,7 @@ get_custom_mounts () prev_dest="" # This sort will ensure that a source /a comes right before a source # /a/b so we only need to look at the previous source - sort -k2 -b ${custom_mounts} | + [ -e ${custom_mounts} ] && sort -k2 -b ${custom_mounts} | while read device source dest options do if echo ${source} | grep -qe "^${prev_source}\(/.*\)\?$"