Kyle Robbertze pushed to branch master at Debian OCaml Maintainers / liquidsoap


Commits:
34e043a5 by Kyle Robbertze at 2024-07-23T14:19:58+09:00
Configure cache directory

- - - - -


2 changed files:

- debian/liquidsoap.postinst
- debian/liquidsoap.postrm


Changes:

=====================================
debian/liquidsoap.postinst
=====================================
@@ -16,20 +16,30 @@ case "$1" in
     ;;
 esac
 
-addgroup --system liquidsoap
+if ! getent group liquidsoap > /dev/null; then
+    addgroup --system liquidsoap
+fi
 
 # Create the new system account
-adduser --system --disabled-password --disabled-login \
---home /usr/share/liquidsoap --ingroup liquidsoap liquidsoap
-usermod --append --groups audio liquidsoap
+id liquidsoap > dev/null 2>&1 || (
+    adduser --system --disabled-password --disabled-login \
+    --home /var/cache/liquidsoap --ingroup liquidsoap liquidsoap &&
+    usermod --append --groups audio liquidsoap
+)
 
-# Add again /usr/share/liquidsoap if user was already created
+# Add /usr/share/liquidsoap
 if ! test -d /usr/share/liquidsoap; then
     mkdir /usr/share/liquidsoap
 fi
 
+# Add cache directory
+if ! test -d /var/cache/liquidsoap; then
+    mkdir /var/cache/liquidsoap
+fi
+
 # Fix directories ownership
 chown liquidsoap:liquidsoap /var/log/liquidsoap
+chown liquidsoap:liquidsoap /var/cache/liquidsoap
 chown root:root /usr/share/liquidsoap
 
 #DEBHELPER#


=====================================
debian/liquidsoap.postrm
=====================================
@@ -8,4 +8,10 @@ if [ "$1" = "purge" ] && [ -d /usr/share/liquidsoap ]; then
     fi
 fi
 
+if [ "$1" = "purge" ] && [ -d /var/cache/liquidsoap ]; then
+    if ! rmdir /var/cache/liquidsoap; then
+        echo "leaving /var/cache/liquidsoap in place"
+    fi
+fi
+
 #DEBHELPER#



View it on GitLab: 
https://salsa.debian.org/ocaml-team/liquidsoap/-/commit/34e043a587cfc8f180a629e55ac13671967d0760

-- 
This project does not include diff previews in email notifications.
View it on GitLab: 
https://salsa.debian.org/ocaml-team/liquidsoap/-/commit/34e043a587cfc8f180a629e55ac13671967d0760
You're receiving this email because of your account on salsa.debian.org.


Reply via email to