summarylogtreecommitdiffstats
path: root/subsonic-beta.install
diff options
context:
space:
mode:
authorThom Wiggers2014-12-31 15:08:20 +0100
committerThom Wiggers2014-12-31 15:08:20 +0100
commit734b79b698e86c70810e9f628fbfa181c8118c17 (patch)
tree5a7d929a02da015c0e19f48562af9a7540c5143a /subsonic-beta.install
parent6c493a271ec6ee205ed2284a10c4723ef6ad302c (diff)
downloadaur-734b79b698e86c70810e9f628fbfa181c8118c17.tar.gz
Updated version
Diffstat (limited to 'subsonic-beta.install')
-rw-r--r--subsonic-beta.install66
1 files changed, 61 insertions, 5 deletions
diff --git a/subsonic-beta.install b/subsonic-beta.install
index 3427acf64ef..bfa017e2708 100644
--- a/subsonic-beta.install
+++ b/subsonic-beta.install
@@ -1,8 +1,64 @@
+_homedir=/var/lib/subsonic
+_playlistdir=/var/playlists
+
post_install() {
- echo "*************************************************"
- echo "* Edit /var/subsonic/subsonic.sh to configure *"
- echo "* subsonic *"
- echo "*************************************************"
-
+
+ getent group subsonic &>/dev/null || groupadd --system subsonic > /dev/null
+ getent passwd subsonic &>/dev/null || useradd --system \
+ --home-dir /var/lib/subsonic \
+ --shell /usr/bin/nologin \
+ --gid subsonic \
+ --groups audio \
+ --comment "Subsonic user" \
+ subsonic > /dev/null
+ passwd --lock subsonic > /dev/null
+
+ fix_permissions
+ echo "*************************************************"
+ echo "* Edit /etc/subsonic.conf to configure subsonic *"
+ echo "*************************************************"
+
}
+post_remove() {
+ getent passwd subsonic &>/dev/null && userdel subsonic >/dev/null
+ getent group subsonic &>/dev/null && groupdel subsonic >/dev/null
+}
+
+fix_permissions() {
+ chown -R subsonic:subsonic ${_homedir}
+ chown subsonic:subsonic ${_playlistdir}
+}
+
+pre_upgrade() {
+ rm -f /tmp/subsonic-was-active
+ if [[ `systemctl is-active subsonic` == 'active' ]]; then
+ touch /tmp/subsonic-was-active
+ echo "Stopping subsonic"
+ systemctl stop subsonic
+ fi
+}
+
+post_upgrade() {
+ post_install
+
+ if [[ $(vercmp 5.0.beta1 $2) == "1" ]]; then
+ echo "!! Subsonics home dir is now located in /var/lib/subsonic."
+ echo " You will have to move the database located in "
+ echo " /var/subsonic/db to this new location."
+ echo ""
+ echo "!! This package now runs subsonic as the user 'subsonic'."
+ echo " You mightneed to edit permissions for your media folders."
+ rm -f /tmp/subsonic-was-active
+ echo ""
+ echo "!! Not restarting subsonic automatically."
+ echo " You might need to change configs"
+ fi
+
+ systemctl daemon-reload
+ if [ -e /tmp/subsonic-was-active ]; then
+ echo "Starting subsonic"
+ systemctl start subsonic
+ rm /tmp/subsonic-was-active
+ fi
+}