From: Evgeni Golov Date: Sat, 29 Mar 2014 13:37:07 +0000 (+0100) Subject: Do not throw warnings when /tmp/custom_mounts.list does not exist. X-Git-Tag: debian/4.0_alpha20-1~1 X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=commitdiff_plain;h=28ca8298a10702e391e420975205a98450d4cf7d Do not throw warnings when /tmp/custom_mounts.list does not exist. When no device for an overlay can be found, /tmp/custom_mounts.list won't be created and will produce warnings while booting: sort: /tmp/custom_mounts.list: No such file or directory rm: can't remove '/tmp/custom_mounts.list': No such file or directory Properly handle this case by calling rm with the -f option and calling sort only when the file exists. --- diff --git a/components/9990-misc-helpers.sh b/components/9990-misc-helpers.sh index c656f23..2bf2db1 100755 --- a/components/9990-misc-helpers.sh +++ b/components/9990-misc-helpers.sh @@ -1422,7 +1422,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}\(/.*\)\?$" diff --git a/components/9990-overlay.sh b/components/9990-overlay.sh index 4ae5c07..52c045a 100755 --- a/components/9990-overlay.sh +++ b/components/9990-overlay.sh @@ -376,7 +376,7 @@ setup_unionfs () then local custom_mounts custom_mounts="/tmp/custom_mounts.list" - rm -rf ${custom_mounts} 2> /dev/null + rm -f ${custom_mounts} # Gather information about custom mounts from devies detected as overlays get_custom_mounts ${custom_mounts} ${overlay_devices} @@ -387,7 +387,7 @@ setup_unionfs () local used_overlays used_overlays="" used_overlays=$(activate_custom_mounts ${custom_mounts}) - rm ${custom_mounts} + rm -f ${custom_mounts} # Close unused overlays (e.g. due to missing $persistence_list) for overlay in ${overlay_devices}