aboutsummaryrefslogtreecommitdiff
path: root/files/mpd-music/music.init
blob: 4a5c654e2240718243a771ea13933bbec6b52376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	use logger
}

mounted() {
	mount | grep -q ' /music '
}

status() {
	mounted
}

start() {
	if mounted; then
		einfo "Already mounted"
		return
	fi

	mkdir -p /music
	sshfs -o rw,allow_other root@10.8.2.1:/data/music /music
}

stop() {
	if ! mounted; then
		ewarn "Already not mounted"
		return
	fi

	fusermount -u /music
}