aports/openrc/seedbox-mount/runfile

23 lines
562 B
Plaintext

#!/sbin/openrc-run
supervisor=supervise-daemon
depend() {
use net
need localmount
}
start_pre() {
checkpath -d -m 744 -o transmission:transmission "$mountpath"
checkpath -d -m 744 -o root:root /sftp-chroot/"$mountpath"
}
start() {
mount -t cifs -o credentials="$creds",rw,cache=none,seal,uid="$(id -u transmission)",gid="$(id -g transmission)",dir_mode=0755,file_mode=0644 "$endpoint" "$mountpath" || stop
mount --bind "${mountpath}" /sftp-chroot"${mountpath}" || stop
}
stop() {
umount /sftp-chroot"$mountpath" || true
umount "$mountpath" || true
}