Skip to content

Commit

Permalink
Add extra check to ensure files aren't deleted if unmount fails
Browse files Browse the repository at this point in the history
  • Loading branch information
bluerider committed Dec 4, 2016
1 parent 24d220c commit be50c41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions compiler
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ fi

# unmount and remove drive
cat <<EOF >> oroot
umount /run/oroot;
rm -r /run/oroot;
umount /run/oroot &&
rm -r /run/oroot &&
EOF

# close the device in overlay_flush
Expand Down Expand Up @@ -352,4 +352,4 @@ cat <<EOF >> oroot
mount_handler=oroot_mount
fi;
}
EOF
EOF
12 changes: 6 additions & 6 deletions initcpio/hooks/oroot
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ run_hook() {
mkdir /run/oroot;
mount -o \$(awk '{if (\$2 == \"/\") {print \$4}}' /etc/fstab) \"$root\" /run/oroot || mount \"$root\" /run/oroot;
rsync -ax --no-whole-file --inplace --delete / /run/oroot --exclude boot --exclude dev --exclude mnt --exclude proc --exclude run --exclude sys --exclude tmp --exclude usr/bin/overlay_flush;
umount /run/oroot;
rm -r /run/oroot;
umount /run/oroot &&
rm -r /run/oroot &&
cryptsetup close \"$root\";
" > /overlay_flush;
elif [[ "${cryptdevice}" && "${oroot}" = "live" && ! -f "/hooks/lvm2" ]]; then
Expand All @@ -29,17 +29,17 @@ run_hook() {
mkdir /run/oroot;
mount -o \$(awk '{if (\$2 == \"/\") {print \$4}}' /etc/fstab) \"$root\" /run/oroot || mount \"$root\" /run/oroot;
rsync -ax --no-whole-file --inplace --delete / /run/oroot --exclude boot --exclude dev --exclude mnt --exclude proc --exclude run --exclude sys --exclude tmp --exclude usr/bin/overlay_flush;
umount /run/oroot;
rm -r /run/oroot;
umount /run/oroot &&
rm -r /run/oroot &&
cryptsetup close \"$root\";
" > /overlay_flush;
else
echo "#!/bin/bash
mkdir /run/oroot;
mount -o \$(awk '{if (\$2 == \"/\") {print \$4}}' /etc/fstab) \"$root\" /run/oroot || mount \"$root\" /run/oroot;
rsync -ax --no-whole-file --inplace --delete / /run/oroot --exclude boot --exclude dev --exclude mnt --exclude proc --exclude run --exclude sys --exclude tmp --exclude usr/bin/overlay_flush;
umount /run/oroot;
rm -r /run/oroot;
umount /run/oroot &&
rm -r /run/oroot &&

This comment has been minimized.

Copy link
@nightworks

nightworks Dec 21, 2016

There is nothing after the last &&, breaking the command

" > /overlay_flush;
fi;
chmod ug+x /overlay_flush
Expand Down

0 comments on commit be50c41

Please sign in to comment.