"Fossies" - the Fresh Open Source Software Archive

Member "install/predoinst.sh" (9 Feb 2022, 1461 Bytes) of package /linux/privat/benno-smtp-2.8.0.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "predoinst.sh": 2.6.0_vs_2.8.0.

    1 #!/bin/sh
    2 # preinst script for benno-archive
    3 #
    4 
    5 set -e
    6 
    7 # summary of how this script can be called:
    8 #        * <new-preinst> `install'
    9 #        * <new-preinst> `install' <old-version>
   10 #        * <new-preinst> `upgrade' <old-version>
   11 #        * <old-preinst> `abort-upgrade' <new-version>
   12 # for details, see http://www.debian.org/doc/debian-policy/ or
   13 # the debian-policy package
   14 
   15 
   16 case "$1" in
   17     install|upgrade)
   18         [ -z "$BENNO_GROUP" ] && BENNO_GROUP=benno
   19         [ -z "$BENNO_USER" ] && BENNO_USER=benno
   20         [ -z "$BENNO_LIB" ] && BENNO_LIB=/opt/benno
   21 
   22         if ! getent group | grep -q "^$BENNO_GROUP:" ; then
   23             echo -n "Adding group $BENNO_GROUP.."
   24             addgroup --quiet --system $BENNO_GROUP 2>/dev/null ||true
   25             echo "..done"
   26         fi
   27 
   28         if ! getent passwd | grep -q "^$BENNO_USER:"; then
   29             echo -n "Adding system user $BENNO_USER.."
   30             adduser --quiet --system --ingroup $BENNO_GROUP --no-create-home \
   31                     --disabled-password $BENNO_USER 2>/dev/null || true
   32             echo "..done"
   33         fi
   34 
   35 
   36         test -d $BENNO_LIB || mkdir $BENNO_LIB
   37 
   38         if ! dpkg-statoverride --list $BENNO_LIB >/dev/null
   39         then
   40             chown -R $BENNO_USER:$BENNO_GROUP $BENNO_LIB
   41             chmod u=rwx,g=rx,o= $BENNO_LIB
   42         fi
   43     ;;
   44 
   45     abort-upgrade)
   46     ;;
   47 
   48     *)
   49         echo "preinst called with unknown argument \`$1'" >&2
   50         exit 1
   51     ;;
   52 esac
   53 
   54 exit 0