| 1 |
#!/bin/sh |
| 2 |
set -e |
| 3 |
|
| 4 |
everything() { |
| 5 |
|
| 6 |
# install /etc/ppp/pap-secrets and /etc/ppp/chap-secrets from templates, |
| 7 |
# if necessary |
| 8 |
for file in pap-secrets chap-secrets; do |
| 9 |
if [ -f /etc/ppp/$file ]; then |
| 10 |
TAG=$(head --lines=1 /etc/ppp/$file) |
| 11 |
if [ "$TAG" = "#GENERATED-BY-DEBIAN-INSTALLER#" ]; then |
| 12 |
(sed -e "s/-HOSTNAME-/$HOST/g" /usr/share/ppp/$file; \ |
| 13 |
cat /etc/ppp/$file) > /etc/ppp/$file.tmp |
| 14 |
mv /etc/ppp/$file.tmp /etc/ppp/$file |
| 15 |
fi |
| 16 |
else |
| 17 |
sed -e "s/-HOSTNAME-/$HOST/g" < /usr/share/ppp/$file > /etc/ppp/$file |
| 18 |
fi |
| 19 |
chmod 600 /etc/ppp/$file |
| 20 |
done |
| 21 |
|
| 22 |
# install template provider files |
| 23 |
if [ ! -f /etc/ppp/peers/provider ]; then |
| 24 |
install -g dip -m 640 /usr/share/ppp/provider.peer \ |
| 25 |
/etc/ppp/peers/provider |
| 26 |
fi |
| 27 |
if [ ! -f /etc/chatscripts/provider ]; then |
| 28 |
install -g dip -m 640 /usr/share/ppp/provider.chatscript \ |
| 29 |
/etc/chatscripts/provider |
| 30 |
fi |
| 31 |
|
| 32 |
# fix the log files permissions |
| 33 |
LOG_FILES="/var/log/ppp.log /var/log/ppp-connect-errors" |
| 34 |
for file in $LOG_FILES; do |
| 35 |
[ -e $file ] || continue |
| 36 |
chown root:adm $file |
| 37 |
chmod 640 $file |
| 38 |
done |
| 39 |
|
| 40 |
# Clean up after ppp-dns service removal |
| 41 |
if dpkg --compare-versions "$2" le-nl "2.4.8-1+2~"; then |
| 42 |
rm -f /lib/systemd/system/pppd-dns.service.dpkg-bak |
| 43 |
deb-systemd-helper purge pppd-dns.service >/dev/null |
| 44 |
deb-systemd-helper unmask pppd-dns.service >/dev/null |
| 45 |
update-rc.d -f pppd-dns remove |
| 46 |
fi |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
case "$1" in |
| 51 |
configure) |
| 52 |
everything "$@" |
| 53 |
;; |
| 54 |
|
| 55 |
abort-upgrade|abort-remove|abort-deconfigure) |
| 56 |
;; |
| 57 |
|
| 58 |
*) |
| 59 |
echo "postinst called with unknown argument '$1'" >&2 |
| 60 |
exit 1 |
| 61 |
;; |
| 62 |
esac |
| 63 |
|
| 64 |
#DEBHELPER# |
| 65 |
|
| 66 |
exit 0 |
| 67 |
|