diff options
author | Superpiffer | 2017-08-09 16:43:00 +0200 |
---|---|---|
committer | Superpiffer | 2017-08-09 16:43:00 +0200 |
commit | 799c7878d784b2e6ea4b0c09c1294ca4ae8ce066 (patch) | |
tree | fa60fe164399b7679393991c4b88d2589df96ce8 /airsonic.install | |
download | aur-799c7878d784b2e6ea4b0c09c1294ca4ae8ce066.tar.gz |
Initial release
Diffstat (limited to 'airsonic.install')
-rw-r--r-- | airsonic.install | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/airsonic.install b/airsonic.install new file mode 100644 index 000000000000..480c1df21cac --- /dev/null +++ b/airsonic.install @@ -0,0 +1,55 @@ +_homedir=/var/lib/airsonic +_playlistdir=${_homedir}/playlists + +post_install() { + + getent group airsonic &>/dev/null || groupadd --system airsonic > /dev/null + getent passwd airsonic &>/dev/null || useradd --system \ + --home-dir /var/lib/airsonic \ + --shell /usr/bin/nologin \ + --gid airsonic \ + --groups audio \ + --comment "Airsonic user" \ + airsonic > /dev/null + passwd --lock airsonic &> /dev/null + + fix_permissions + echo "*************************************************" + echo "* Edit /etc/airsonic.conf to configure airsonic *" + echo "*************************************************" + + systemctl daemon-reload +} + +pre_remove() { + if [[ `systemctl is-active airsonic` == 'active' ]]; then + systemctl stop airsonic + fi +} + +post_remove() { + getent passwd airsonic &>/dev/null && userdel airsonic &>/dev/null +} + +fix_permissions() { + chown -R airsonic:airsonic ${_homedir} + chown airsonic:airsonic ${_playlistdir} +} + +pre_upgrade() { + rm -f /tmp/airsonic-was-active + if [[ `systemctl is-active airsonic` == 'active' ]]; then + touch /tmp/airsonic-was-active + echo "Stopping airsonic" + systemctl stop airsonic + fi +} + +post_upgrade() { + post_install + if [ -e /tmp/airsonic-was-active ]; then + echo "Starting airsonic" + systemctl start airsonic + rm /tmp/airsonic-was-active + fi +} |