Skip to content

Commit c209d3b

Browse files
authored
Updated %post section
Updated %post section to recent version from crypto-sdcard with better quoting.
1 parent 3d90325 commit c209d3b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

rpm/mount-sdcard.spec

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Name: mount-sdcard
22
Summary: Enhanced mounting scripts for SD-cards
33
Version: 0.1
4-
Release: 2
4+
Release: 3
55
Group: System/Base
66
Distribution: SailfishOS
77
Vendor: olf
@@ -36,24 +36,24 @@ cp -R systemd udev %{buildroot}%{_sysconfdir}/
3636

3737
%post
3838
# Replay adapted https://git.merproject.org/olf/udisks2/blob/master/rpm/udisks2-symlink-mount-path
39-
OLD_MOUNT_PATH=/media/sdcard
40-
if [ ! -L ${OLD_MOUNT_PATH} ]
39+
OLD_MOUNT_PATH="/media/sdcard"
40+
if [ ! -L "$OLD_MOUNT_PATH" ]
4141
then
42-
DEF_UID=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
43-
DEVICEUSER=$(getent passwd $DEF_UID | sed 's/:.*//')
44-
for path in ${OLD_MOUNT_PATH}/*
42+
DEF_UID="$(grep '^UID_MIN' /etc/login.defs | tr -s ' ' | cut -f 2 -d ' ')"
43+
DEVICEUSER="$(getent passwd $DEF_UID | sed 's/:.*//')"
44+
for path in "$OLD_MOUNT_PATH"/*
4545
do
46-
if [ -L ${path} ]
47-
then rm -f ${path}
48-
else rmdir ${path}
46+
if [ -L "$path" ]
47+
then rm -f "$path"
48+
else rmdir "$path"
4949
fi
5050
done
51-
if rmdir ${OLD_MOUNT_PATH}
52-
then ln -s /run/media/${DEVICEUSER} ${OLD_MOUNT_PATH}
51+
if rmdir "$OLD_MOUNT_PATH"
52+
then ln -s "/run/media/$DEVICEUSER" "$OLD_MOUNT_PATH"
5353
else
54-
echo "[%{name}] Warning:"
55-
echo "${OLD_MOUNT_PATH} does either not exist, is not a directory or contains files or non-empty directories."
56-
echo "Thus omitting creation of compatibility symlink ${OLD_MOUNT_PATH} -> /run/media/${DEVICEUSER}!"
54+
echo '[%{name}] Warning:'
55+
echo "$OLD_MOUNT_PATH does either not exist, is not a directory or contains files or non-empty directories."
56+
echo "Thus omitting creation of compatibility symlink $OLD_MOUNT_PATH -> /run/media/${DEVICEUSER}!"
5757
fi
5858
fi
5959

0 commit comments

Comments
 (0)