]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
General improvements to debconf configuration handling
authorRuss Allbery <rra@debian.org>
Fri, 13 Feb 2009 02:02:30 +0000 (18:02 -0800)
committerRuss Allbery <rra@debian.org>
Fri, 13 Feb 2009 02:02:30 +0000 (18:02 -0800)
* General improvements to debconf configuration handling.
  - Do not abort the config script if we have no default realm and
    dnsdomainname fails.  (LP: #274886, #318132)
  - Do not abort postinst if we can't resolve any host name for the
    cell.  Just continue in that case, omitting any configuration for
    the local cell.  (LP: #322054)
  - Correctly set the default for AFS_CRYPT from the existing config.
  - The cache size is high, not critical, since we have a default.
  - Don't create the client ThisCell if no local cell was specified.
  - Improve the leading comment in afs.conf.client.  Users can edit it,
    but any changes other than the setting values will be lost.
  - Remove the openafs-fileserver/bosconfig_moved template, which would
    only be shown on upgrades from pre-1.2.0 versions.
  - Standardize coding style and always quote strings.

debian/changelog
debian/openafs-client.config
debian/openafs-client.postinst
debian/openafs-fileserver.config
debian/openafs-fileserver.templates

index 8b17f710db419d9b9e2e75f1123942c1b1577870..efde5d0c9f8af86481b64cb3ae356e6a288c5655 100644 (file)
@@ -36,6 +36,20 @@ openafs (1.4.8.dfsg1-1) UNRELEASED; urgency=low
     Kaseorg and Lutz Goehring for suggestions.  (LP: #295897)
   * Allow time-daemon to satisfy the openafs-fileserver recommends in
     addition to ntp, allowing for openntpd.  (Closes: #508258)
+  * General improvements to debconf configuration handling.
+    - Do not abort the config script if we have no default realm and
+      dnsdomainname fails.  (LP: #274886, #318132)
+    - Do not abort postinst if we can't resolve any host name for the
+      cell.  Just continue in that case, omitting any configuration for
+      the local cell.  (LP: #322054)
+    - Correctly set the default for AFS_CRYPT from the existing config.
+    - The cache size is high, not critical, since we have a default.
+    - Don't create the client ThisCell if no local cell was specified.
+    - Improve the leading comment in afs.conf.client.  Users can edit it,
+      but any changes other than the setting values will be lost.
+    - Remove the openafs-fileserver/bosconfig_moved template, which would
+      only be shown on upgrades from pre-1.2.0 versions.
+    - Standardize coding style and always quote strings.
   * Update to debhelper compatibility level V7.
     - Use dh where possible in debian/rules.
     - Use dh_lintian to install Lintian overrides.
index 759bbb2f08cbe234c9bedf5b3f999ae2c2ac15da..c5db27e7c4cda73fbe7a68f4444f42dcb936cc57 100644 (file)
@@ -4,40 +4,55 @@ set -e
 . /usr/share/debconf/confmodule
 
 db_version 2.0
+
+# Configure the client cell.  Default to the current ThisCell file and,
+# failing that, the lowercased local domain name, if available.  Ignore errors
+# on read, since it may fail if there's no newline in the file.
 if [ -r /etc/openafs/ThisCell ] ; then
-    read cell </etc/openafs/ThisCell
-    db_set openafs-client/thiscell $cell
-    fi
+    read cell < /etc/openafs/ThisCell
+    db_set openafs-client/thiscell "$cell"
+fi
 db_get openafs-client/thiscell || true
 if [ "x$RET" = "x" ] ; then
-       db_set openafs-client/thiscell `dnsdomainname | tr 'A-Z' 'a-z'`
-       fi
-if [ -r /etc/openafs/cacheinfo ] ; then
-    IFS=: read mountpoint cachedir cachesize  </etc/openafs/cacheinfo
-    db_set openafs-client/cachesize $cachesize
+    domain=`dnsdomainname 2>/dev/null || true`
+    if [ -n "$domain" ] ; then
+        db_set openafs-client/thiscell `echo "$domain" | tr 'A-Z' 'a-z'`
     fi
-db_input high openafs-client/thiscell ||true
-db_input critical openafs-client/cachesize ||true
+fi
+db_input high openafs-client/thiscell || true
+
+# Configure the cache size.  Default to the current value in the cacheinfo
+# configuration file.
+if [ -r /etc/openafs/cacheinfo ] ; then
+    IFS=: read mountpoint cachedir cachesize < /etc/openafs/cacheinfo
+    db_set openafs-client/cachesize "$cachesize"
+fi
+db_input high openafs-client/cachesize || true
 db_go
-test -f /etc/openafs/afs.conf &&. /etc/openafs/afs.conf
+
+# Configure the AFS client parameters set in /etc/openafs/afs.conf, taking
+# defaults from the current file.
+test -f /etc/openafs/afs.conf && . /etc/openafs/afs.conf
 if [ "x$AFS_CLIENT" != "x" ] ; then
-    db_set openafs-client/run-client  $AFS_CLIENT
-    fi
+    db_set openafs-client/run-client "$AFS_CLIENT"
+fi
 db_input low openafs-client/run-client || true
-if [ "x$AFS_AFSDB" != "x" ] ;then
-    db_set openafs-client/afsdb $AFS_AFSDB
-    fi
+if [ "x$AFS_AFSDB" != "x" ] ; then
+    db_set openafs-client/afsdb "$AFS_AFSDB"
+fi
+if [ "x$AFS_CRYPT" != "x" ] ; then
+    db_set openafs-client/crypt "$AFS_CRYPT"
+fi
 if [ "x$AFS_DYNROOT" != "x" ] ; then
-    db_set openafs-client/dynroot $AFS_DYNROOT
-    fi
-if [ x$AFS_FAKESTAT != "x" ] ; then
-    db_set openafs-client/fakestat $AFS_FAKESTAT
+    db_set openafs-client/dynroot "$AFS_DYNROOT"
+fi
+if [ "x$AFS_FAKESTAT" != "x" ] ; then
+    db_set openafs-client/fakestat "$AFS_FAKESTAT"
 fi
-
 db_beginblock
-db_input low openafs-client/afsdb ||true
+db_input low openafs-client/afsdb || true
 db_input low openafs-client/crypt || true
 db_input medium openafs-client/dynroot || true
-db_input low openafs-client/fakestat ||true
+db_input low openafs-client/fakestat || true
 db_endblock
 db_go
index b83816486587e2d401485901f0a33f92bbec51a2..ca3fdf4e537ece4704abdc4104fbc65f253d144a 100644 (file)
@@ -18,21 +18,20 @@ if [ "$1" = configure ] || [ "$1" = reconfigure ] ; then
     db_version 2.0
 
     db_get openafs-client/thiscell
-    echo $RET >/etc/openafs/ThisCell
-    THISCELL=$RET
+    THISCELL="$RET"
+    if [ -n "$THISCELL" ] ; then
+        echo "$THISCELL" > /etc/openafs/ThisCell
+    fi
 
-    if test -f /etc/openafs/CellServDB ; then
-        :
-    else
+    if [ ! -f /etc/openafs/CellServDB ] ; then
         cp /usr/share/openafs/CellServDB /etc/openafs
     fi
 
     # If ThisCell is not in CellServDB, we have to prompt the user for the
     # VLDB servers.  Unfortunately, we can't do this in config because we
-    # need the CellServDB file, which is part of the package.  We have to
-    # override a lintian warning for this since prompts at installation time
-    # are frowned upon.
-    if grep -q -F "$RET" /etc/openafs/CellServDB && [ "x$RET" != "x" ] ; then
+    # need the CellServDB file, which is part of the package.
+    if grep -q -F "$THISCELL" /etc/openafs/CellServDB \
+           && [ "x$THISCELL" != "x" ] ; then
         :
     else
         db_input critical openafs-client/cell-info || true
@@ -40,7 +39,7 @@ if [ "$1" = configure ] || [ "$1" = reconfigure ] ; then
         db_go
         db_get openafs-client/cell-info
         if [ "x$RET" != "x" ] ; then
-            echo \>$THISCELL > /etc/openafs/CellServDB.new
+            echo ">$THISCELL" > /etc/openafs/CellServDB.new
             perl -MSocket -e 'foreach (@ARGV) {' \
                 -e '@a=gethostbyname($_) and ' \
                 -e 'printf("%s\t\t# %s\n",inet_ntoa($a[4]),$a[0]) }' $RET \
@@ -48,12 +47,13 @@ if [ "$1" = configure ] || [ "$1" = reconfigure ] ; then
             if [ `wc -l </etc/openafs/CellServDB.new` -eq 1 ] ; then
                 echo None of the hostnames resolved to an address 2>&1
                 db_reset openafs-client/cell-info || true
-                exit 1
+                rm /etc/openafs/CellServDB.new
+            else
+                cat /etc/openafs/CellServDB.new /etc/openafs/CellServDB \
+                    > /etc/openafs/CellServDB.tmp
+                mv /etc/openafs/CellServDB.tmp /etc/openafs/CellServDB
+                rm /etc/openafs/CellServDB.new
             fi
-            cat /etc/openafs/CellServDB.new /etc/openafs/CellServDB \
-                >/etc/openafs/CellServDB.tmp
-            mv /etc/openafs/CellServDB.tmp /etc/openafs/CellServDB
-            rm /etc/openafs/CellServDB.new
         fi
     fi
                     
@@ -61,21 +61,23 @@ if [ "$1" = configure ] || [ "$1" = reconfigure ] ; then
     echo /afs:/var/cache/openafs:$RET >/etc/openafs/cacheinfo
 
     echo <<'EOF' > /etc/openafs/afs.conf.client
-# This file is managed by debconf.  Do not edit directly.  To modify these
-# settings, run dpkg-reconfigure openafs-client.
+# This file is managed by debconf.  You may change the parameters set below,
+# but any additional lines or comments will be lost when the package is
+# upgraded or reconfigured.  Local modifications other than setting the
+# following parameters should be made in /etc/openafs/afs.conf instead.
 
 EOF
 
     db_get openafs-client/run-client
-    echo AFS_CLIENT=$RET >/etc/openafs/afs.conf.client
+    echo AFS_CLIENT="$RET" > /etc/openafs/afs.conf.client
     db_get openafs-client/afsdb
-    echo AFS_AFSDB=$RET >>/etc/openafs/afs.conf.client
+    echo AFS_AFSDB="$RET" >> /etc/openafs/afs.conf.client
     db_get openafs-client/crypt
-    echo AFS_CRYPT=$RET >>/etc/openafs/afs.conf.client
+    echo AFS_CRYPT="$RET" >> /etc/openafs/afs.conf.client
     db_get openafs-client/dynroot
-    echo AFS_DYNROOT=$RET >>/etc/openafs/afs.conf.client
+    echo AFS_DYNROOT="$RET" >> /etc/openafs/afs.conf.client
     db_get openafs-client/fakestat
-    echo AFS_FAKESTAT=$RET >>/etc/openafs/afs.conf.client
+    echo AFS_FAKESTAT="$RET" >> /etc/openafs/afs.conf.client
 fi
 
 #DEBHELPER#
index 04e3260088ade71c40673d849a6d9d72abfb313e..c333f478457c79b6f8c314618fb755435dcab208 100644 (file)
@@ -5,35 +5,23 @@ set -e
 
 db_version 2.0
 
+# Warn anyone who's trying to run the file server on alpha.
 arch=`dpkg --print-installation-architecture`
-case $arch in
-    alpha)
-    db_input high openafs-fileserver/alpha-broken ||true
-;;
-esac
+if [ "$arch" = "alpha" ] ; then
+    db_input high openafs-fileserver/alpha-broken || true
+fi
 
+# Configure the local cell.  Ignore errors on read since it may fail if
+# there's no newline in the file.  Default to the server ThisCell file and, if
+# that fails, the configured client cell.
 if [ -r /etc/openafs/server/ThisCell ] ; then
-    read cell </etc/openafs/server/ThisCell || true # error if no newline is ignore
-    db_set openafs-fileserver/thiscell $cell
-    fi
-
+    read cell < /etc/openafs/server/ThisCell || true
+    db_set openafs-fileserver/thiscell "$cell"
+fi
 db_get openafs-fileserver/thiscell || true
 if [ "x$RET" = "x" ] ; then
-       db_get openafs-client/thiscell ||true
-       db_set openafs-fileserver/thiscell "$RET"
-       fi
-
-db_input low openafs-fileserver/thiscell || true
-if [ "x$2" != "x" ] ; then
-    if dpkg --compare-versions $2 lt 1.2.0-1 ; then
-       db_input high openafs-fileserver/bosconfig_moved ||true
-       fi
+    db_get openafs-client/thiscell || true
+    db_set openafs-fileserver/thiscell "$RET"
 fi
-
+db_input low openafs-fileserver/thiscell || true
 db_go
-
-db_get openafs-fileserver/bosconfig_moved
-if [ $RET = "false" ] ; then
-    db_reset openafs-fileserver/bosconfig_moved
-    exit 2
-fi
index 46a10b9e51ebde0a3614958e95e23fb44d3cc6a3..0764eb782c37972e776839c964357b8d1ee5dea3 100644 (file)
@@ -5,18 +5,6 @@ _Description: Cell this server serves files for:
  Kerberos service and serve volumes into that cell.  Normally, this cell is
  the same cell as the workstation's client belongs to.
 
-Template: openafs-fileserver/bosconfig_moved
-Type: boolean
-Default: true
-_Description: Upgrading will move files to new locations; continue?
- Between Openafs 1.1 and Openafs 1.2, several files moved.  In particular,
- files in /etc/openafs/server-local have been distributed to other
- locations.  The BosConfig file is now located in /etc/openafs and the
- other files are located in /var/lib/openafs.  If you continue with this
- upgrade, these files will be moved.  You should use the bos restart
- command to reload your servers.  Any configuration changes made before
- you do so will be lost.
-
 Template: openafs-fileserver/alpha-broken
 Type: note
 _Description: OpenAFS file server probably does not work!