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
|
#!/bin/sh
# No copyright is claimed. This code is in the public domain; do with it
# what you wish. Written by Joost van Baal-Ilić.
# Written in 2014 - 2015
set -e
# we reuse www-data
# create useraccount www-log
case "$1" in
configure)
if ! getent passwd www-log >/dev/null
then
#echo 'Adding system-user for publicfile: www-log' 1>&2
adduser --system --quiet --home /nonexistent \
--no-create-home --disabled-login --shell /usr/sbin/nologin www-log
fi
# download documentation, see get-publicfile-docs
# configure publicfile
# as documented upstream:
# /usr/local/publicfile/bin/configure ftp ftplog /public www.heaven.af.mil www 1.2.3.4
test -d /etc/publicfile/file || \
/usr/lib/publicfile/configure www-data www-log /etc/publicfile $(hostname --fqdn) www ftp localhost
# logs should be somewhere under /var/log, create compatibility
# symlinks. the log dir _must_ be named "main".
test -d /var/log/publicfile || mkdir -p /var/log/publicfile
test -d /var/log/publicfile/ftpd || {
mv /etc/publicfile/ftpd/log/main /var/log/publicfile/ftpd && \
ln -s /var/log/publicfile/ftpd /etc/publicfile/ftpd/log/main
}
test -d /var/log/publicfile/httpd || {
mv /etc/publicfile/httpd/log/main /var/log/publicfile/httpd && \
ln -s /var/log/publicfile/httpd /etc/publicfile/httpd/log/main
}
test -d /var/www/html/0 || {
mkdir -p /var/www/html
mv /etc/publicfile/file/* /var/www/html
ln -s /var/www/html /etc/publicfile/file
}
# something to see
test -d /etc/publicfile/file/0 || mkdir -p /etc/publicfile/file/0
test -f /etc/publicfile/file/0/index.html || \
echo it works >/etc/publicfile/file/0/index.html
;;
abort-upgrade|abort-remove|abort-deconfigure)
:
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#/etc/publicfile/file
#/etc/publicfile/file/0/foo.html
#/etc/publicfile/file/www.heaven.af.mil/foo.html
#/etc/publicfile/httpd
#/etc/publicfile/httpd/log/main
#/etc/publicfile/ftpd
#/service/httpd -> /etc/publicfile/httpd
#DEBHELPER#
exit 0
|