Merge remote-tracking branch 'qubesos/pr/42'

* qubesos/pr/42:
  bind-dirs: Create ro if bind target exists
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-17 11:55:23 +01:00
commit 203386af62
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -87,15 +87,21 @@ bind_dirs() {
continue continue
fi fi
# Initially copy over data directories to /rw if rw directory does not exist. if [ -d "$fso_rw" ] || [ -f "$fso_rw" ]; then
if [ -d "$fso_ro" ] || [ -f "$fso_ro" ]; then if [ ! -e "$fso_ro" ]; then
if ! [ -d "$fso_rw" -o -f "$fso_rw" ]; then ## Create empty file or directory if path exists in /rw to allow to bind mount none existing files/dirs.
echo "Initializing $rw_dest_dir with files from $fso_ro" >&2 test -d "$fso_rw" && mkdir --parents "$fso_ro"
cp --archive --recursive --parents "$fso_ro" "$rw_dest_dir" test -f "$fso_rw" && touch "$fso_ro"
fi fi
else else
true "$fso_ro is neither a directory nor a file or does not exist, skipping." if [ -d "$fso_ro" ] || [ -f "$fso_ro" ]; then
continue ## Initially copy over data directories to /rw if rw directory does not exist.
echo "Initializing $rw_dest_dir with files from $fso_ro" >&2
cp --archive --recursive --parents "$fso_ro" "$rw_dest_dir"
else
true "$fso_ro is neither a directory nor a file and the path does not exist below /rw, skipping."
continue
fi
fi fi
# Bind the fso. # Bind the fso.