postinst is in isdnvboxserver 1:3.25+dfsg1-3.3ubuntu2.
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | #!/bin/sh
set -e
if [ "$1" != "configure" ]; then exit 0; fi
# Source debconf library.
. /usr/share/debconf/confmodule
db_set isdnvboxserver/dummy donetwice # next time, do it again
DEVDIR=/dev
if [ ! -c $DEVDIR/ttyI6 ]; then
if grep 'type devfs' /proc/mounts >/dev/null; then
DEVDIR=/dev/isdn
else
if [ ! -c /dev/ttyI6 ]; then
cd /dev
echo "Note: running MAKEDEV to create ISDN tty devices in /dev..."
WRITE_ON_UDEV=1 /sbin/MAKEDEV isdn-tty
fi
fi
fi
# Doing this now isn't so bad, even though perhaps the config files
# aren't correct yet, because it won't be started until needed anyway.
# It's a different story for 'init q' though.
# the "|| true" is because update-inetd fails if xinetd is used?! Not my problem.
update-inetd --add "vboxd stream tcp nowait root /usr/sbin/tcpd /usr/sbin/vboxd" || true
db_get isdnvboxserver/msn || true
VBOX_MSN=`echo "$RET" | tr -d ' '`; export VBOX_MSN
if [ -z "$RET" -o `echo "$RET" | tr A-Z a-z` = quit ]; then # do it by hand
echo "Not touching any isdnvboxserver config files."
db_stop
exit 0
fi
if [ -s /etc/isdn/vboxgetty.conf ]; then
# only use ttyI6
eval `perl -- - /etc/isdn/vboxgetty.conf <<'EOF'
while (<>) {
if (m,^port (/dev/(isdn/)?)ttyI6,) {
print "oldDEVDIR=$1\n";
last;
}
}
while (<>) {
last if m,^port,;
if (/^\s+spooldir\s+(\S+)/) {
print "VBOX_SPOOL=$1\n";
exit 0;
}
}
EOF
`
if [ "$oldDEVDIR" != "$DEVDIR/" ]; then
db_get isdnvboxserver/devfs_vboxgettyconf || true
db_go
fi
fi
db_get isdnvboxserver/user || true
VBOX_USER=`echo "$RET" | tr -d ' '`
if [ ! -z "$VBOX_USER" ]; then
db_get isdnvboxserver/password || true
VBOX_PASSWORD=$(echo "$RET" | sed 's,^ *,,' | sed 's, *$,,')
fi
db_get isdnvboxserver/daemonuser || true
VBOX_DUSER=`echo "$RET" | tr -d ' '`
if [ -z "$VBOX_SPOOL" ]; then
VBOX_SPOOL=/var/spool/vbox/ttyI6
fi
if [ ! -d "$VBOX_SPOOL" ]; then
# on initial installation it won't exist, and "old" name == new name
# so create it here if necessary
mkdir -p "$VBOX_SPOOL/incoming" "$VBOX_SPOOL/messages"
cp /usr/share/isdnvboxserver/default/standard.tcl "$VBOX_SPOOL/."
fi
if chown -R "$VBOX_DUSER" "$VBOX_SPOOL"; then
: #OK
else
echo "Somehow the user you entered is not valid after all."
echo "Run 'dpkg-reconfigure isdnvboxserver' to remedy the situation."
echo "Continuing on now anyway."
VBOX_DUSER=''
fi
# end of spooldir handling....
###################################
if [ ! -z "$VBOX_DUSER" ]; then
VBOX_USERHOME=`getent passwd "$VBOX_DUSER" | cut -f6 -d:`
if [ ! -z "$VBOX_USERHOME" ]; then
if [ -d "$VBOX_SPOOL" ]; then
chown -R "$VBOX_DUSER" "$VBOX_SPOOL"
fi
if [ -d "$VBOX_USERHOME" ]; then
if [ ! -s "$VBOX_USERHOME/.vbox.conf" ]; then
cp /usr/share/isdn/default/vbox.conf $VBOX_USERHOME/.vbox.conf
chown $VBOX_DUSER $VBOX_USERHOME/.vbox.conf
fi
else
db_subst isdnvboxserver/vboxnodir DIR $VBOX_USERHOME
db_subst isdnvboxserver/vboxnodir USER "$VBOX_DUSER"
db_fset isdnvboxserver/vboxnodir seen false
db_input high isdnvboxserver/vboxnodir || true
fi
else
db_subst isdnvboxserver/vboxnouser USER $VBOX_DUSER
db_input high isdnvboxserver/vboxnouser || true
fi
db_go || true
mv -f /etc/isdn/vboxgetty.conf /etc/isdn/vboxgetty.conf.bak || echo "mv 4 failed"
perl -- - > /etc/isdn/vboxgetty.conf <<EOF
open(STDIN, '/etc/isdn/vboxgetty.conf.bak');
while (<>) { print; last if m,^port /dev/(isdn/)?ttyI6,; }
while (<>) {
if (m,^port,) {
print;
last;
}
s/^(\s+modeminit\s+.*&E)\s*\d*(.*)/\${1}$VBOX_MSN\${2}/;
s/^(\s+user\s+)\S+(.*)/\${1}$VBOX_DUSER\${2}/;
print;
}
print <>;
EOF
fi
if [ ! -z "$VBOX_USER" ]; then
# Lines in vboxd.conf:
# # Remove this comment if you don't want any configuration to happen.
# A:localhost:RW:username:*invalid*password*:/var/spool/vbox/username:incoming
if [ -s /etc/isdn/vboxd.conf ]; then
mv -f /etc/isdn/vboxd.conf /etc/isdn/vboxd.conf.bak || echo "mv 5 failed"
VBOX_PASSWORD_ESC=`echo "$VBOX_PASSWORD" | perl -pe 'print quotemeta'`
perl -- - > /etc/isdn/vboxd.conf <<EOF
\$user = <DATA>; chomp \$user;
\$password = <DATA>; chomp \$password;
\$spool = <DATA>; chomp \$spool;
# perhaps password is already crypted
unless (\$password =~ /^DES /) {
# yes, I know the salt should be random, no inspiration right now
\$password = 'DES ' . crypt(\$password, 'vv');
}
open(STDIN, '/etc/isdn/vboxd.conf.bak');
while (<>) { print; last if m,^# Remove this comment if you don't want,; }
if (\$_ = <>) {
s{^(A:[^:]+:[^:]+):[^:]+:[^:]+:[^:]+}{\$1:\$user:\$password:\$spool};
print;
print <>;
}
__DATA__
$VBOX_USER
$VBOX_PASSWORD
$VBOX_SPOOL
EOF
chmod 600 /etc/isdn/vboxd.conf
chown root /etc/isdn/vboxd.conf
fi
fi
# if inittab was changed up above, make init reread it
init q
# vboxgetty might have new parameters, make sure they're used
if [ -s /var/run/vboxgetty-ttyI6.pid ]; then
kill `cat vboxgetty-ttyI6.pid 2>/dev/null` >/dev/null 2>&1 || true
fi
db_stop
exit 0
|