postinst is in autoradio 2.8.6-1.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/bin/sh
# postinst script for autoradio
#
# see: dh_installdeb(1)
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# set some useful variables
AUTORADIO="autoradio"
CHOWN="/bin/chown"
ADDUSER="/usr/sbin/adduser"
USERDEL="/usr/sbin/userdel"
USERADD="/usr/sbin/useradd"
GROUPDEL="/usr/sbin/groupdel"
GROUPMOD="/usr/sbin/groupmod"
ID="/usr/bin/id"
set -e
#set -x
case "$1" in
configure)
###
# 1. get current autoradio uid and gid if user exists.
if $ID $AUTORADIO > /dev/null 2>&1; then
IUID=`$ID --user $AUTORADIO`
IGID=`$ID --group $AUTORADIO`
else
IUID="NONE"
IGID="NONE"
fi
if [ "$IUID" = "NONE" ] ; then # we must do sth :)
####
## 2. Ensure that no standard account or group will remain before adding the
## new user
#if [ "$IUID" = "NONE" ] || [ $IUID -ge 1000 ]; then # we must do sth :)
# if ! [ "$IUID" = "NONE" ] && [ $IUID -ge 1000 ]; then
# # autoradio user exists but isn't a system user... delete it.
# $USERDEL $AUTORADIO
# $GROUPDEL $AUTORADIO
# fi
#
####
# 3. Add the system account.
# Issue a debconf warning if it fails.
# if $GROUPMOD $AUTORADIO > /dev/null 2>&1; then
# # autoradio group already exists, use --ingroup
# if ! $ADDUSER --home /usr/share/autoradio/ --gecos autoradio --disabled-password --disabled-login --no-create-home --ingroup $AUTORADIO $AUTORADIO; then
# echo "The adduser command failed."
# fi
# else
# if ! $ADDUSER --home /usr/share/autoradio/ --gecos autoradio --disabled-password --disabled-login --no-create-home --group $AUTORADIO $AUTORADIO; then
# echo "The adduser command failed."
# fi
# fi
#fi
if ! getent group autoradio > /dev/null 2>&1 ; then
addgroup --system autoradio --quiet
fi
if ! id autoragio > /dev/null 2>&1 ; then
adduser --home /usr/share/autoradio/ --gecos autoradio \
--ingroup autoradio --disabled-password --disabled-login \
--no-create-home autoradio
fi
fi
set -e
###
# 4. change ownership of directory
#install -d /var/{run/autoradio,log/autoradio}
mkdir -p /var/log/autoradio/
mkdir -p /var/run/autoradio/
$CHOWN -R $AUTORADIO:$AUTORADIO /usr/share/autoradio/
$CHOWN -R $AUTORADIO:$AUTORADIO /etc/autoradio/
$CHOWN -R $AUTORADIO:$AUTORADIO /var/log/autoradio/
$CHOWN -R $AUTORADIO:$AUTORADIO /var/run/autoradio/
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0
|