mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-06 00:58:16 +00:00
fix(deck): Remove mount lock
We already outright stop the automount service before formatting and start it again afterwards. This provides redundant functionality and increases the possibility of a failure
This commit is contained in:
parent
d53f0c0636
commit
f78aab84b0
@ -61,19 +61,6 @@ STORAGE_PARTBASE="${STORAGE_PARTITION#/dev/}"
|
||||
|
||||
systemctl stop steamos-automount@"$STORAGE_PARTBASE".service
|
||||
|
||||
# lock file prevents the mount service from re-mounting as it gets triggered by udev rules.
|
||||
#
|
||||
# NOTE: Uses a shared lock filename between this and the auto-mount script to ensure we're not double-triggering nor
|
||||
# automounting while formatting or vice-versa.
|
||||
MOUNT_LOCK="/var/run/jupiter-automount-${STORAGE_PARTBASE//\/_}.lock"
|
||||
MOUNT_LOCK_FD=9
|
||||
exec 9<>"$MOUNT_LOCK"
|
||||
|
||||
if ! flock -n "$MOUNT_LOCK_FD"; then
|
||||
echo "Failed to obtain lock $MOUNT_LOCK, failing"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# If any partitions on the device are mounted, unmount them before continuing
|
||||
# to prevent problems later
|
||||
for m in $(lsblk -n "$STORAGE_DEVICE" -o MOUNTPOINTS| awk NF | sort -u); do
|
||||
@ -145,7 +132,6 @@ sync
|
||||
udevadm settle
|
||||
|
||||
# trigger the mount service
|
||||
flock -u "$MOUNT_LOCK_FD"
|
||||
if ! systemctl start steamos-automount@"$STORAGE_PARTBASE".service; then
|
||||
echo "Failed to start mount service"
|
||||
journalctl --no-pager --boot=0 -u steamos-automount@"$STORAGE_PARTBASE".service
|
||||
|
@ -21,19 +21,6 @@ ACTION=$1
|
||||
DEVBASE=$2
|
||||
DEVICE="/dev/${DEVBASE}"
|
||||
|
||||
# Shared between this and the auto-mount script to ensure we're not double-triggering nor automounting while formatting
|
||||
# or vice-versa.
|
||||
MOUNT_LOCK="/var/run/jupiter-automount-${DEVBASE//\/_}.lock"
|
||||
|
||||
# Obtain lock
|
||||
exec 9<>"$MOUNT_LOCK"
|
||||
if ! flock -n 9; then
|
||||
echo "$MOUNT_LOCK is active: ignoring action $ACTION"
|
||||
# Do not return a success exit code: it could end up putting the service in 'started' state without doing the mount
|
||||
# work (further start commands will be ignored after that)
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wait N seconds for steam
|
||||
wait_steam()
|
||||
{
|
||||
@ -77,7 +64,7 @@ do_mount()
|
||||
OPTS="rw,noatime,lazytime,compress-force=zstd,space_cache=v2,autodefrag,ssd_spread"
|
||||
FSTYPE="btrfs"
|
||||
# check for main subvol
|
||||
mount_point_tmp="${MOUNT_LOCK%.*}.tmp"
|
||||
mount_point_tmp="/var/run/jupiter-automount-${STORAGE_PARTBASE//\/_}.tmp"
|
||||
mkdir -p "${mount_point_tmp}"
|
||||
if /bin/mount -t btrfs -o ro "${DEVICE}" "${mount_point_tmp}"; then
|
||||
if [[ -d "${mount_point_tmp}/@" ]] && \
|
||||
|
Loading…
Reference in New Issue
Block a user