|
|
@ -25,39 +25,24 @@ PS4='-\D{%F %T} ' |
|
|
|
# Print commands and their arguments as they are executed. |
|
|
|
# Print commands and their arguments as they are executed. |
|
|
|
set -x |
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
sleep 0.5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find the removable F2FS partition |
|
|
|
|
|
|
|
PART=$(lsblk -pro kname,partlabel | grep 01-home | cut -d' ' -f1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make sure the mountpoints are free |
|
|
|
# Make sure the mountpoints are free |
|
|
|
( |
|
|
|
kill $(lsof -t "$HOME" /mnt) ||: |
|
|
|
lsof -t $HOME | xargs kill -9 |
|
|
|
umount "$HOME" /mnt ||: |
|
|
|
umount $HOME |
|
|
|
|
|
|
|
umount /mnt |
|
|
|
if test -e /dev/disk/by-partlabel/01-home; then |
|
|
|
) || true |
|
|
|
mount -o noatime /dev/disk/by-partlabel/01-home /mnt |
|
|
|
|
|
|
|
|
|
|
|
if test "$PART" |
|
|
|
|
|
|
|
then |
|
|
|
|
|
|
|
mount -o noatime "$PART" /mnt |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
# No removable F2FS partition found |
|
|
|
# Fails if no local partition is found |
|
|
|
PART=$(lsblk -pro kname,partlabel | grep 01-tmp-home | cut -d' ' -f1) |
|
|
|
test -e /dev/disk/by-partlabel/01-tmp-home || exit 1 |
|
|
|
|
|
|
|
|
|
|
|
if test -z "$PART" |
|
|
|
# We don't care about data consistency since the partition is temporary so disable journaling |
|
|
|
then |
|
|
|
/sbin/mke2fs -t ext4 -O ^has_journal -F /dev/disk/by-partlabel/01-tmp-home |
|
|
|
# No local partition found, error |
|
|
|
mount -o noatime,nobarrier /dev/disk/by-partlabel/01-tmp-home /mnt |
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# We don't care about data consistency since the partition is temporary |
|
|
|
|
|
|
|
/sbin/mke2fs -t ext4 -O ^has_journal -F "$PART" |
|
|
|
|
|
|
|
mount -o noatime,nobarrier "$PART" /mnt |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
USER_PATH=/mnt/.01/$USER |
|
|
|
user_path=/mnt/.01/"$USER" |
|
|
|
TEMP_PATH=/mnt/.01/tmp |
|
|
|
temp_path=/mnt/.01/tmp |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p $USER_PATH $TEMP_PATH |
|
|
|
mkdir -p "$user_path" "$temp_path" |
|
|
|
chown -R $USER:$USER $USER_PATH $TEMP_PATH |
|
|
|
chown -R "$USER":"$USER" "$user_path" "$temp_path" |
|
|
|
mount -t overlay -o lowerdir=$HOME,upperdir=$USER_PATH,workdir=$TEMP_PATH overlay $HOME |
|
|
|
mount -t overlay -o lowerdir="$HOME",upperdir="$user_path",workdir="$temp_path" overlay "$HOME" |
|
|
|