postinst is in piuparts-slave 0.56ubuntu1.
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 | #!/bin/sh
set -e
pgroup=piuparts
muser=piupartsm
suser=piupartss
scriptroot=/usr/share/piuparts
userhome=/var/lib/piuparts
if [ "$1" = "configure" ] ; then
addgroup --system --quiet $pgroup
for user in $suser
do
adduser --system --quiet --home $userhome/$user --ingroup $pgroup \
--shell /bin/sh $user
if ! [ -d $userhome/$user ]; then
mkdir -m 0755 $userhome/$user
chown $user:$pgroup $userhome/$user
fi
touch $userhome/$user/.profile
chown $user:$pgroup $userhome/$user/.profile
if [ $user = "piupartsm" ] ;
then
role="master"
else
role="slave"
fi
if ! grep -q $scriptroot/$role $userhome/$user/.profile ;
then
echo PATH=\$PATH:$scriptroot:$scriptroot/$role \
>>$userhome/$user/.profile
fi
if [ ! -d $userhome/$user/.ssh ] ; then
install -d -o $user -g $pgroup -m 0755 $userhome/$user/.ssh
fi
done
if [ ! -e $userhome/$suser/.ssh/id_rsa ] ; then
ssh-keygen -q -f $userhome/$suser/.ssh/id_rsa -N ""
chown $suser:$pgroup $userhome/$suser/.ssh/id_rsa \
$userhome/$suser/.ssh/id_rsa.pub
fi
if [ ! -e $userhome/$suser/.ssh/known_hosts ] ; then
ssh-keyscan localhost > $userhome/$suser/.ssh/known_hosts 2>/dev/null
chown $suser:$pgroup $userhome/$suser/.ssh/known_hosts
fi
if [ -d $userhome/$muser/.ssh ] && [ ! -e $userhome/$muser/.ssh/authorized_keys ] ; then
sed 's#^#command="'"$scriptroot"'/piuparts-master",no-pty,no-port-forwarding #' \
$userhome/$suser/.ssh/id_rsa.pub >>$userhome/$muser/.ssh/authorized_keys
chown $muser:$pgroup $userhome/$muser/.ssh/authorized_keys
chmod 0600 $userhome/$muser/.ssh/authorized_keys
fi
install -d -o $suser -g $pgroup -m 0755 $userhome/slave
install -d -o $suser -g $pgroup -m 0755 $userhome/slave/0
chown $suser:$pgroup /var/cache/piuparts/basetgz
fi
|