X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive;h=c28314f1a99e75b0f709c0543ea6b27730bd76f4;hb=ef22a990570cd3658c7a693796e4470994b86fb9;hp=c3732feda1df0fd3fe6811d71d8317cc420622c3;hpb=959403d20e2259c10de7ef55b9226c40812eabd7;p=live-boot-grml.git diff --git a/scripts/live b/scripts/live index c3732fe..c28314f 100755 --- a/scripts/live +++ b/scripts/live @@ -262,6 +262,10 @@ Arguments () PERSISTENT_PATH="${ARGUMENT#persistent-path=}" export PERSISTENT_PATH ;; + persistent-read-only) + PERSISTENT_READONLY="Yes" + export PERSISTENT_READONLY + ;; persistent-storage=*) PERSISTENT_STORAGE="${ARGUMENT#persistent-storage=}" @@ -391,6 +395,27 @@ Arguments () export UNIONTYPE fi + if [ -z "${PERSISTENT_ENCRYPTION}" ] + then + PERSISTENT_ENCRYPTION="none" + export PERSISTENT_ENCRYPTION + elif echo ${PERSISTENT_ENCRYPTION} | grep -qw luks + then + if ! modprobe dm-crypt + then + log_warning_msg "Unable to load module dm-crypt" + PERSISTENT_ENCRYPTION=$(echo ${PERSISTENT_ENCRYPTION} | sed -e 's/\> snapshot.conf # for resync on reboot/halt + if [ -z ${PERSISTENT_READONLY} ] + then + echo "export ${snap_type}SNAP=${snap_relpath}:${snapdev}:${snapfile}" >> snapshot.conf # for resync on reboot/halt + fi return 0 } @@ -1397,34 +1405,43 @@ setup_unionfs () if echo ${PERSISTENT_METHOD} | grep -qw overlay then - # search for label and files (this could be hugely optimized) - cowprobe=$(find_cow_device "${root_persistence}" "${blacklistdev}" "${whitelistdev}") - if [ -b "${cowprobe}" ] - then - # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots - # makes sense to have both persistence for /cow and /home mounted, maybe also with - # snapshots to be sure to really store some e.g key config files, - # but not on the same media - blacklistdev="${cowprobe}" - PERSISTENCE_IS_ON="1" - export PERSISTENCE_IS_ON - fi - # homecow just mount something on /home, this should be generalized some way - homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}" "${whitelistdev}") - if [ -b "${homecow}" ] - then - PERSISTENCE_IS_ON="1" - export PERSISTENCE_IS_ON - fi + overlays="${root_persistence} ${home_persistence}" fi if echo ${PERSISTENT_METHOD} | grep -qw snapshot then - root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}" "${whitelistdev}") - # This second type should be removed when snapshot will get smarter, - # hence when "/etc/live-snapshot*list" will be supported also by - # ext2|ext3|ext4|jffs2 snapshot types. - home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}" "${whitelistdev}") + snapshots="${root_snapshot_label} ${home_snapshot_label}" + fi + + + for media in $(find_persistent_media "${overlays}" "${snapshots}" "${blacklistdev}" "${whitelistdev}") + do + media="$(echo ${media} | tr ":" " ")" + case ${media} in + ${root_persistence}=*) + cowprobe="${media#*=}" + ;; + ${home_persistence}=*) + homecow="${media#*=}" + ;; + ${root_snapshot_label}=*) + root_snapdata="${media#*=}" + ;; + ${home_snapshot_label}=*) + # This second type should be removed when snapshot will get smarter, + # hence when "/etc/live-snapshot*list" will be supported also by + # ext2|ext3|ext4|jffs2 snapshot types. + home_snapdata="${media#*=}" + ;; + *) + ;; + esac + done + + if [ -b "${cowprobe}" ] || [ -b "${homecow}" ] + then + PERSISTENCE_IS_ON="1" + export PERSISTENCE_IS_ON fi if [ -b "${cowprobe}" ] @@ -1438,7 +1455,6 @@ setup_unionfs () fsck -y ${cowdevice} fi else - log_warning_msg "Unable to find the persistent medium" cowdevice="tmpfs" cow_fstype="tmpfs" cow_mountopt="rw,noatime,mode=755"