mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
helper script to delete symlink in local_content
This commit is contained in:
parent
15229ce16d
commit
0682fb6563
3 changed files with 18 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
||||||
- { src: 'usbmount.rules.j2', dest: '/etc/udev/rules.d/usbmount.rules', mode: '0644' }
|
- { 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-on', dest: '/usr/bin/', mode: '0755' }
|
||||||
- { src: 'iiab-usb_lib-show-all-off', 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
|
- name: Enable exFAT and NTFS in /etc/usbmount/usbmount.conf
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|
14
roles/usb_lib/templates/iiab-clean-usb.sh
Normal file
14
roles/usb_lib/templates/iiab-clean-usb.sh
Normal 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
|
||||||
|
|
|
@ -4,10 +4,11 @@ After=%i.device
|
||||||
After=rc-local.service
|
After=rc-local.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
#Type=oneshot
|
||||||
TimeoutStartSec=0
|
TimeoutStartSec=0
|
||||||
Environment=DEVNAME=%I
|
Environment=DEVNAME=%I
|
||||||
ExecStart=/usr/share/usbmount/usbmount add
|
ExecStart=/usr/share/usbmount/usbmount add
|
||||||
ExecStop=/bin/umount /%I
|
ExecStop=/usr/sbin/iiab-clean-usb.sh %I
|
||||||
|
ExecStopPost=/bin/umount /%I
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue