|
1 | 1 | Name: mount-sdcard |
2 | 2 | Summary: Enhanced mounting scripts for SD-cards |
3 | 3 | Version: 0.1 |
4 | | -Release: 2 |
| 4 | +Release: 3 |
5 | 5 | Group: System/Base |
6 | 6 | Distribution: SailfishOS |
7 | 7 | Vendor: olf |
@@ -36,24 +36,24 @@ cp -R systemd udev %{buildroot}%{_sysconfdir}/ |
36 | 36 |
|
37 | 37 | %post |
38 | 38 | # 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" ] |
41 | 41 | 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"/* |
45 | 45 | 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" |
49 | 49 | fi |
50 | 50 | 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" |
53 | 53 | 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}!" |
57 | 57 | fi |
58 | 58 | fi |
59 | 59 |
|
0 commit comments