1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00

helper script to delete symlink in local_content

This commit is contained in:
Jerry Vonau 2020-04-07 11:52:05 -05:00
parent 15229ce16d
commit 0682fb6563
3 changed files with 18 additions and 2 deletions

View file

@ -16,6 +16,7 @@
- { src: 'usbmount.rules.j2', dest: '/etc/udev/rules.d/usbmount.rules', mode: '0644' }
- { src: 'iiab-usb_lib-show-all-on', dest: '/usr/bin/', mode: '0755' }
- { src: 'iiab-usb_lib-show-all-off', dest: '/usr/bin/', mode: '0755' }
- { src: 'iiab-clean-usb.sh', dest: '/usr/sbin/', mode: '0755' }
- name: Enable exFAT and NTFS in /etc/usbmount/usbmount.conf
lineinfile:

View file

@ -0,0 +1,14 @@
#!/bin/bash
# Remove symlink in /library/content to automounted usb drive
#
DEVICE=`echo $@ | sed -s 's|-|/|'`
MNT_POINT=`findmnt -n /$DEVICE | awk '{print $1}'`
CONTENT_LINK_USB=`basename $MNT_POINT | awk '{print toupper($0)}'`
CONTENT_LINK="/library/www/html/local_content/$CONTENT_LINK_USB"
logger -p user.notice -t "usbmount" -- "Attempting to remove link $CONTENT_LINK."
if [ -L $CONTENT_LINK ]; then
/bin/rm $CONTENT_LINK
logger -p user.notice -t "usbmount" -- "$CONTENT_LINK removed."
fi

View file

@ -4,10 +4,11 @@ After=%i.device
After=rc-local.service
[Service]
Type=oneshot
#Type=oneshot
TimeoutStartSec=0
Environment=DEVNAME=%I
ExecStart=/usr/share/usbmount/usbmount add
ExecStop=/bin/umount /%I
ExecStop=/usr/sbin/iiab-clean-usb.sh %I
ExecStopPost=/bin/umount /%I
RemainAfterExit=yes