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.
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
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}\(/.*\)\?$"
while read device source dest options
do
if echo ${source} | grep -qe "^${prev_source}\(/.*\)\?$"
then
local custom_mounts
custom_mounts="/tmp/custom_mounts.list"
then
local custom_mounts
custom_mounts="/tmp/custom_mounts.list"
- rm -rf ${custom_mounts} 2> /dev/null
# Gather information about custom mounts from devies detected as overlays
get_custom_mounts ${custom_mounts} ${overlay_devices}
# Gather information about custom mounts from devies detected as overlays
get_custom_mounts ${custom_mounts} ${overlay_devices}
local used_overlays
used_overlays=""
used_overlays=$(activate_custom_mounts ${custom_mounts})
local used_overlays
used_overlays=""
used_overlays=$(activate_custom_mounts ${custom_mounts})
# Close unused overlays (e.g. due to missing $persistence_list)
for overlay in ${overlay_devices}
# Close unused overlays (e.g. due to missing $persistence_list)
for overlay in ${overlay_devices}