summaryrefslogtreecommitdiff
path: root/debian/preinst
diff options
context:
space:
mode:
Diffstat (limited to 'debian/preinst')
-rw-r--r--debian/preinst100
1 files changed, 0 insertions, 100 deletions
diff --git a/debian/preinst b/debian/preinst
deleted file mode 100644
index 50c89e140..000000000
--- a/debian/preinst
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-# preinst script for freeside
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-# * <new-preinst> `install'
-# * <new-preinst> `install' <old-version>
-# * <new-preinst> `upgrade' <old-version>
-# * <old-preinst> `abort-upgrade' <new-version>
-# for details, see http://www.debian.org/doc/debian-policy/ or
-# the debian-policy package
-
-
-case "$1" in
- install|upgrade)
-
- # If the package has default file it could be sourced, so that
- # the local admin can overwrite the defaults
-
- [ -f "/etc/default/freeside" ] && . /etc/default/freeside
-
- # Sane defaults:
-
- [ -z "$FREESIDE_HOME" ] && FREESIDE_HOME=/home/freeside
- [ -z "$FREESIDE_USER" ] && FREESIDE_USER=freeside
- [ -z "$FREESIDE_NAME" ] && FREESIDE_NAME="Freeside"
- [ -z "$FREESIDE_GROUP" ] && FREESIDE_GROUP=freeside
-
- [ -z "$RT_GROUP" ] && RT_GROUP=rt
-
- # Groups that the user will be added to, if undefined, then none.
- ADDGROUP="rt"
-
- # create user to avoid running server as root
- # 1. create group if not existing
- if ! getent group | grep -q "^$FREESIDE_GROUP:" -; then
- echo -n "Adding group $FREESIDE_GROUP.."
- addgroup --quiet --system $FREESIDE_GROUP 2>/dev/null ||true
- echo "..done"
- fi
- if ! getent group | grep -q "^$RT_GROUP:" -; then
- echo -n "Adding group $RT_GROUP.."
- addgroup --quiet --system $RT_GROUP 2>/dev/null ||true
- echo "..done"
- fi
- # 2. create homedir if not existing
- test -d $FREESIDE_HOME || mkdir $FREESIDE_HOME
- # 3. create user if not existing
- if ! getent passwd | grep -q "^$FREESIDE_USER:" -; then
- echo -n "Adding system user $FREESIDE_USER.."
- adduser --quiet \
- --system \
- --ingroup $FREESIDE_GROUP \
- --shell /bin/sh \
- --no-create-home \
- --disabled-password \
- $FREESIDE_USER 2>/dev/null || true
- echo "..done"
- fi
- # 4. adjust passwd entry
- usermod -c "$FREESIDE_NAME" \
- -d $FREESIDE_HOME \
- -g $FREESIDE_GROUP \
- $FREESIDE_USER
- # 5. adjust file and directory permissions
- if ! dpkg-statoverride --list $FREESIDE_HOME >/dev/null
- then
- chown -R $FREESIDE_USER:adm $FREESIDE_HOME
- chmod u=rwx,g=rxs,o= $FREESIDE_HOME
- fi
- # 6. Add the user to the ADDGROUP group
- if test -n $ADDGROUP
- then
- if ! groups $FREESIDE_USER | cut -d: -f2 | \
- grep -qw $ADDGROUP -; then
- adduser $FREESIDE_USER $ADDGROUP
- fi
- fi
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
-
-