Skip to content

Commit 07752b5

Browse files
authored
Update mount-sdcard.spec
1 parent 9a1c6ba commit 07752b5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rpm/mount-sdcard.spec

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@ cp -R systemd udev %{buildroot}%{_sysconfdir}/
3434
%{_sysconfdir}/systemd/system/mount-sd@.service
3535
%{_sysconfdir}/udev/rules.d/81-mountsd.rules
3636

37+
%post
38+
# Replay enhanced git.merproject.org/udisks2/udisks2-symlink-mount-path
39+
OLD_MOUNT_PATH=/media/sdcard
40+
if [ ! -L ${OLD_MOUNT_PATH} ]
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}/*
45+
do
46+
if [ -L ${path} ]
47+
then rm -f ${path}
48+
else rmdir ${path}
49+
fi
50+
done
51+
if rmdir ${OLD_MOUNT_PATH}
52+
then ln -s /run/media/${DEVICEUSER} ${OLD_MOUNT_PATH}
53+
else echo "Warning: Files or non-empty directories exist in ${OLD_MOUNT_PATH}, hence cannot create compatibility symlink."
54+
fi
55+
fi
56+

0 commit comments

Comments
 (0)