3 # Skeleton maintainer script showing all the possible cases.
4 # Written by Charles Briscoe-Smith, March-June 1998. Public Domain.
6 # Abort if any command returns an error value
8 . /usr/share/debconf/confmodule
10 # This script is called as the last step of the installation of the
11 # package. All the package's files are in place, dpkg has already done
12 # its automatic conffile handling, and all the packages we depend of
13 # are already fully installed and configured.
15 # The following idempotent stuff doesn't generally need protecting
16 # against being run in the abort-* cases.
18 #### Install info files into the dir file
19 ###: install-info --quiet --section "section pattern" "Section Title" \
20 ###: --description="Name of the document" /usr/info/foo.info
22 #### Create stub directories under /usr/local
23 ###: if test ! -d /usr/local/lib/foo; then
24 ###: if test ! -d /usr/local/lib; then
25 ###: if mkdir /usr/local/lib; then
26 ###: chown root.staff /usr/local/lib || true
27 ###: chmod 2775 /usr/local/lib || true
30 ###: if mkdir /usr/local/lib/foo; then
31 ###: chown root.staff /usr/local/lib/foo || true
32 ###: chmod 2775 /usr/local/lib/foo || true
36 #### Ensure the menu system is updated
37 ###: [ ! -x /usr/bin/update-menus ] || /usr/bin/update-menus
39 #### Arrange for a daemon to be started at system boot time
40 ###: update-rc.d foo default >/dev/null
44 # Configure this package. If the package must prompt the user for
45 # information, do it here.
47 mkdir -p /var/lib/citadel/www/static
48 # Activate menu-methods script
49 #: chmod a+x /etc/menu-methods/foo
54 # Make our version of a program available
55 #: update-alternatives \
56 #: --install /usr/bin/program program /usr/bin/alternative 50 \
57 #: --slave /usr/share/man/man1/program.1.gz program.1.gz \
58 #: /usr/share/man/man1/alternative.1.gz
60 # Tell ucf that the file in /usr/share/foo is the latest
61 # maintainer version, and let it handle how to manage the real
62 # confuguration file in /etc. This is how a static configuration
63 # file can be handled:
66 cd /var/lib/citadel/www/;
67 for i in `find -type f `; do
68 md5sum "$i" >>/tmp/md5sums
71 cd /usr/share/doc/citadel-webcit/examples/
72 # if target dirs don't exist, create them.
73 for i in `find -type d` ; do
74 if test ! -d /var/lib/citadel/www/$i; then
75 mkdir -p /var/lib/citadel/www/$i
79 gunzip -c md5sums > /tmp/newsums
80 if diff /tmp/newsums /tmp/md5sums >/dev/null; then
83 cd /usr/share/doc/citadel-webcit/examples/
84 for i in `cat /tmp/newsums |sed "s;.* \./;;"`; do
85 if test -f $i.gz; then
86 j=`basename $i|sed -e "s;.gz;;" `
87 gunzip -c "/usr/share/doc/citadel-webcit/examples$REL_PATH/$i" >"/tmp/$j"
91 cp "/usr/share/doc/citadel-webcit/examples/$i" "/tmp"
93 if test -f /var/lib/citadel/www/$i; then
94 origsum=`grep "$i" /tmp/md5sums |sed "s; .*;;"`
95 newsum=`grep "$i" /tmp/newsums |sed "s; .*;;"`
96 if test -z "$origsum"; then
97 ucf "/tmp/$j" "/var/lib/citadel/www/$i"
99 if test "$origsum" != "$newsum"; then
100 ucf "/tmp/$j" "/var/lib/citadel/www/$i"
104 ucf "/tmp/$j" "/var/lib/citadel/www/$i"
109 rm -f /tmp/newsums /tmp/md5sums
110 if test ! -d /var/lib/citadel/keys; then
111 mkdir -p /var/lib/citadel/keys
113 if test ! -d /var/run/citadel/keys; then
114 mkdir -p /var/run/citadel/keys
117 db_get citadel/WebcitHttpPort && http_port="$RET"
118 db_get citadel/WebcitHttpsPort && https_port="$RET"
120 echo "aplying your settings"
122 export WEBCIT_HTTP_PORT=$http_port
123 export WEBCIT_HTTPS_PORT=$https_port
124 export WEBCIT_CITADEL_IP=127.0.0.1
125 export WEBCIT_CITADEL_PORT=504
126 export WEBCIT_LISTEN_IP=0.0.0.0
127 " >>/etc/default/webcit
133 #### There are three sub-cases:
134 ###if test "${2+set}" != set; then
135 ### # We're being installed by an ancient dpkg which doesn't remember
136 ### # which version was most recently configured, or even whether
137 ### # there is a most recently configured version.
140 ###elif test -z "$2" -o "$2" = "<unknown>"; then
141 ### # The package has not ever been configured on this system, or was
142 ### # purged since it was last configured.
146 ### # Version $2 is the most recently configured version of this
153 # Back out of an attempt to upgrade this package FROM THIS VERSION
154 # to version $2. Undo the effects of "prerm upgrade $2".
159 ###if test "$2" != in-favour; then
160 ### echo "$0: undocumented call to \`postinst $*'" 1>&2
163 #### Back out of an attempt to remove this package, which was due to
164 #### a conflict with package $3 (version $4). Undo the effects of
165 #### "prerm remove in-favour $3 $4".
170 ###if test "$2" != in-favour -o "$5" != removing; then
171 ### echo "$0: undocumented call to \`postinst $*'" 1>&2
174 #### Back out of an attempt to deconfigure this package, which was
175 #### due to package $6 (version $7) which we depend on being removed
176 #### to make way for package $3 (version $4). Undo the effects of
177 #### "prerm deconfigure in-favour $3 $4 removing $6 $7".
181 *) echo "$0: didn't understand being called with '$1'" 1>&2