Commit bbe44370 authored by Raine Makelainen's avatar Raine Makelainen

[udisks2] Symlink old sdcard mount path. Fixes JB#41427

parent 9719fc64
#!/bin/sh
OLD_MOUNT_PATH=/media/sdcard
# 1) Test if symlink already exist
# 2) Cleanup old empty mount points
# 3) Create symlink
if [ -L $OLD_MOUNT_PATH ]; then
exit 0
fi
DEF_UID=$(grep "^UID_MIN" /etc/login.defs | tr -s " " | cut -d " " -f2)
DEVICEUSER=$(getent passwd $DEF_UID | sed 's/:.*//')
for path in ${OLD_MOUNT_PATH}/*
do
rmdir ${path}
done
rmdir ${OLD_MOUNT_PATH}
ln -s /run/media/${DEVICEUSER} ${OLD_MOUNT_PATH}
exit $?
......@@ -41,6 +41,7 @@ BuildRequires: libblockdev-loop-devel >= %{libblockdev_version}
BuildRequires: libblockdev-swap-devel >= %{libblockdev_version}
BuildRequires: libblockdev-fs-devel >= %{libblockdev_version}
BuildRequires: libblockdev-crypto-devel >= %{libblockdev_version}
BuildRequires: oneshot
Requires: libblockdev >= %{libblockdev_version}
Requires: libblockdev-loop >= %{libblockdev_version}
......@@ -66,6 +67,8 @@ Requires: e2fsprogs
Requires: lib%{name} = %{version}-%{release}
%{_oneshot_requires_post}
Obsoletes: sd-utils < 0.1.6
Provides: sd-utils >= 0.1.6
......@@ -127,6 +130,9 @@ chrpath --delete %{buildroot}/%{_sbindir}/umount.udisks2
chrpath --delete %{buildroot}/%{_bindir}/udisksctl
chrpath --delete %{buildroot}/%{_libexecdir}/udisks2/udisksd
mkdir -p %{buildroot}/%{_oneshotdir}/
install -m 0755 ../rpm/udisks2-symlink-mount-path %{buildroot}/%{_oneshotdir}
mkdir -p %{buildroot}/%{_unitdir}/graphical.target.wants
ln -s ../udisks2.service %{buildroot}/%{_unitdir}/graphical.target.wants/udisks2.service
......@@ -138,6 +144,8 @@ systemctl reload-or-try-restart udisks2.service || :
udevadm control --reload || :
udevadm trigger || :
%{_bindir}/add-oneshot --late udisks2-symlink-mount-path || :
%preun -n %{name}
if [ "$1" -eq 0 ]; then
systemctl stop udisks2.service || :
......@@ -161,6 +169,7 @@ fi
%{_unitdir}/mount-sd@.service
%{_udevrulesdir}/80-udisks2.rules
%{_sbindir}/umount.udisks2
%{_oneshotdir}/*
%dir %{_libexecdir}/udisks2
%{_libexecdir}/udisks2/udisksd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment