Skip to content

Instantly share code, notes, and snippets.

@peci1
Created May 31, 2018 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peci1/443062022352a3adc0df574584c9af44 to your computer and use it in GitHub Desktop.
Save peci1/443062022352a3adc0df574584c9af44 to your computer and use it in GitHub Desktop.
OpenWRT: automount NTFS drive by UUID and before mountd comes into action and mounts it under /tmp/run/mountd
#!/bin/sh /etc/rc.common
# This is a procd initscript, so put it in /etc/init.d/
START=79 # Important: this number must be lower than the START number in /etc/init.d/mountd !!!
USE_PROCD=1
PROGNAME="/usr/bin/ntfs-3g"
# Fill these values as desired
# You'll find the UUID by calling `blkid` and putting here either the UUID or UUID_SUB value (not PARTUUID).
uuid=94D6774FD677311A
# The folder is expected to already exist. If it doesn't, create it manually.
target=/mnt/exterak
find_device() {
device=$(blkid -sUUID | grep ${uuid} | cut -d: -f0)
}
start_service() {
logger -t mount-ntfs "Mounting NTFS drives"
find_device
"${PROGNAME}" "${device}" "${target}"
}
stop_service() {
logger -t mount-ntfs "Unmounting NTFS drives"
find_device
umount ${device}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment