Skip to content
Snippets Groups Projects
Commit 5c97a606 authored by Dominik Mehlem's avatar Dominik Mehlem
Browse files

fix bug that deletes work directory on fully persistent USB drives

parent aecd305b
No related branches found
No related tags found
1 merge request!12fix bug that deletes work directory on fully persistent USB drives
......@@ -19,6 +19,7 @@ sudo chown -R mindstorms:mindstorms ${DOCUMENTATION_DIR}
# in any local partition.
# If it exists, mount it to /home/mindstorms/work.
# Also try to find mindstorms.swp files to use as swap space.
# Also checks for persistent drives on E2B-USB-stick
mkdir -p /mnt/localfs /home/mindstorms/work
chmod 700 /mnt
......@@ -45,6 +46,7 @@ shopt -u globstar # disallow '**' path expansion
# Look for partition labels "casper-rw" (Easy2Boot persistence)
echo "Looking for Easy2Boot persistence partitions..."
E2BUDEV="/etc/udev/rules.d/999-easy2boot-permissions.rules"
PERSISTENT=false
rm $E2BUDEV
for PART in /dev/disk/by-id/*; do
DEVICE="$( readlink -f "$PART" )"
......@@ -55,6 +57,7 @@ for PART in /dev/disk/by-id/*; do
echo "KERNEL==\"$EASY2BOOT\", SUBSYSTEM==\"block\", SUBSYSTEMS==\"usb\", ENV{UDISKS_IGNORE}=\"1\"" >> $E2BUDEV
# gnome is stupid and seems to need an fstab entry
echo "$DEVICE /mnt/persist auto nosuid,nodev,nofail,noauto 0 0" >> /etc/fstab
PERSISTENT=true
break
fi
done
......@@ -134,7 +137,7 @@ for SWP in /mnt/localfs/*/mindstorms.swp; do
done
# Remove work directory if not mounted
if ! mountpoint -q /home/mindstorms/work; then
if [! mountpoint -q /home/mindstorms/work] && [! PERSISTENT]; then
echo "Removing work directory as no available mountpoint found."
rm -rf /home/mindstorms/work
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment