summarylogtreecommitdiffstats
path: root/headphones.install
blob: 312d6c245c0c05432338bcfa0930d524efb4704b (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
_NAME=headphones

post_install() {
	getent passwd ${_NAME} > /dev/null || useradd -d /opt/${_NAME} -s /bin/false -r ${_NAME} > /dev/null
	chown -R ${_NAME}. /opt/${_NAME}

	# Create a directory in /run if it does not exist
	if [ ! -d /run/${_NAME} ]; then
		mkdir /run/${_NAME}
		chown ${_NAME}. /run/${_NAME}
		chmod 775 /run/${_NAME}
	fi

    echo ""
    echo "To fill the configuration file (/opt/headphones/config.ini), do:"
    echo "  systemctl start headphones; systemctl stop headphones"
    echo ""
    echo "It should dump the initial configuration that you can now modify."
    echo ""
}

post_upgrade() {
	post_install
}

post_remove() {
	echo "Some files have not been removed because they are created by ${_NAME} itself, e.g. the music database."
	userdel -f ${_NAME}
}