From 66ccae2277d11b3208856a7eef0d320be5680ab2 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Thu, 23 Nov 2000 22:11:35 +0000 Subject: [PATCH] Add rc.d links. Modify init.d script to support force-starte Add debconf support to afs.conf --- debian/openafs-client.config | 9 +++-- debian/openafs-client.templates | 35 ++++++++++++++----- debian/openafs-fileserver.postinst | 3 ++ debian/rules | 5 ++- src/afsd/afs.conf.linux | 6 ++-- src/afsd/afs.rc.linux | 56 ++++++++++++++++++------------ 6 files changed, 75 insertions(+), 39 deletions(-) diff --git a/debian/openafs-client.config b/debian/openafs-client.config index ac513768e..7bf23d03d 100644 --- a/debian/openafs-client.config +++ b/debian/openafs-client.config @@ -4,8 +4,11 @@ db_version 2.0 db_input medium openafs-client/thiscell ||true -db_go - db_input high openafs-client/cachesize ||true - +db_go +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_input low openafs-client/run-client || true db_go diff --git a/debian/openafs-client.templates b/debian/openafs-client.templates index bdae9cd6c..74d419b5c 100644 --- a/debian/openafs-client.templates +++ b/debian/openafs-client.templates @@ -1,3 +1,18 @@ +Template: openafs-client/cell-info +Type: string +Description: What hosts are DB servers for your home cell? + AFS uses the file /etc/openafs/CellServDB to hold the list of servers + that should be contacted to find parts of a cell. The cell you claim + this workstation belongs to is not in that file. Enter the host + names of the database servers separated by spaces. + IMPORTANT: If you are creating a new cell and this machine is to be + a database server in that cell, only enter this machine's name; add + the other servers later after they are functioning. Also, do not + enable the AFS client to start at boot on this server until the cell + is configured. When you are ready you can edit + /etc/openafs/afs.conf.client to enable the client. + + Template: openafs-client/thiscell Type: string Description: What AFS cell does this workstation belong to? @@ -5,7 +20,7 @@ Description: What AFS cell does this workstation belong to? Each workstation belongs to one cell. Usually the cell is the DNS domain name of the workstation. -template: openafs-client/cachesize +Template: openafs-client/cachesize Type: string Default: 50000 Description: How large is your AFS cache (kb)? @@ -15,11 +30,13 @@ Description: How large is your AFS cache (kb)? on. Often, people find it useful to dedicate a partition to their AFS cache. -Template: openafs-client/nohomecell -Type: note -Description: Your home cell is not in CellServDb - AFS uses the file /etc/openafs/CellServDB to hold the list of servers - that should be contacted to find parts of a cell. The cell you claim - this workstation belongs to is not in that file. You must either - change the home cell of this workstation or edit CellServDB to add a - new cell. +Template: openafs-client/run-client +Type: boolean +Default: true +Description: Run Openafs client at boot? + Should the Openafs filesystem be started and mounted at boot? + Normally, most users who install the openafs-client package expect to + run it at boot. However, if you are planning on setting up a new + cell or are on a laptop, you may not want it started at boot time. + If you answer no to this question, run /etc/init.d/openafs-client + force-start to run. diff --git a/debian/openafs-fileserver.postinst b/debian/openafs-fileserver.postinst index accc93c31..edac36cd1 100644 --- a/debian/openafs-fileserver.postinst +++ b/debian/openafs-fileserver.postinst @@ -33,3 +33,6 @@ esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules index 2d3636d8f..06535f561 100755 --- a/debian/rules +++ b/debian/rules @@ -74,8 +74,7 @@ install: build # Add here commands to install the package into debian/tmp. cat debian/filelist |sh debian/movefiles - cp dest/root.client/usr/vice/etc/afs.rc debian/openafs-client/etc/init.d/openafs-client - chmod 755 debian/openafs-client/etc/init.d/openafs-client + cp dest/root.client/usr/vice/etc/afs.rc debian/openafs-client.init cp dest/root.client/usr/vice/etc/afs.conf debian/openafs-client/etc/openafs/afs.conf install -m 755 -o root -g root debian/afs-rootvol debian/openafs-dbserver/usr/sbin (cd debian&&pod2man --section 8 --center "Debian GNU/Linux" \ @@ -126,7 +125,7 @@ binary-arch: build install dh_installmenu # dh_installemacsen # dh_installpam -# dh_installinit + dh_installinit -r dh_installcron # dh_installmanpages dh_installinfo diff --git a/src/afsd/afs.conf.linux b/src/afsd/afs.conf.linux index a36850408..21f877631 100644 --- a/src/afsd/afs.conf.linux +++ b/src/afsd/afs.conf.linux @@ -9,8 +9,10 @@ # Configuration information for AFS client # AFS_CLIENT and AFS_SERVER determine if we should start the client and or -# the bosserver. Possible values are on and off. -AFS_CLIENT=on +# the bosserver. Possible values are true and false. +# These are loaded from files written by debconf +test -f /etc/openafs/afs.conf.client && . /etc/openafs/afs.conf.client + AFS_SERVER=off # AFS client configuration options: diff --git a/src/afsd/afs.rc.linux b/src/afsd/afs.rc.linux index 2d1dd1029..d84cfeb57 100644 --- a/src/afsd/afs.rc.linux +++ b/src/afsd/afs.rc.linux @@ -24,9 +24,9 @@ if [ -f /etc/openafs/afs.conf ]; then . /etc/openafs/afs.conf fi -# is_on returns 1 if value of arg is "on" +# is_on returns 1 if value of arg is "true" is_on() { - if test "$1" = "on" ; then return 0 + if test "$1" = "true" ; then return 0 else return 1 fi } @@ -123,9 +123,21 @@ load_client() { # use the prefix command if required set_prefix - /sbin/insmod ${PREFIX:+-P $PREFIX} -f -m $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1 + LOADED=`/sbin/lsmod | fgrep openafs` + if [ -z "$LOADED" ] ; then + /sbin/insmod ${PREFIX:+-P $PREFIX} -f -m $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1 + fi +} + +# start_client() -- run afsd +start_client() { + start-stop-daemon --start --quiet --exec /usr/sbin/afsd \ + -- ${OPTIONS} + echo -n " afsd" + } + case "$1" in start) # Load kernel extensions @@ -136,40 +148,40 @@ case "$1" in fi echo -n "Starting AFS services: " - # Start bosserver, it if exists - if is_on $AFS_SERVER && test -x /usr/afs/bin/bosserver ; then - start-stop-daemon --start --quiet --pidfile /var/run/bos.pid \ - --exec /usr/afs/bin/bosserver - echo -n " bosserver" - fi - # Start AFS client if is_on $AFS_CLIENT && test -x /usr/sbin/afsd ; then - start-stop-daemon --start --quiet --exec /usr/sbin/afsd \ - -- ${OPTIONS} - echo -n " afsd" - + start_client echo "." $AFS_POST_INIT fi ;; - stop) +force-start) + # Load kernel extensions + if load_client ; then : + else + echo Failed to load AFS client, not starting AFS services. + exit 1 + fi + + echo -n "Starting AFS services: " + # Start AFS client + if test -x /usr/sbin/afsd ; then + start_client + echo "." + $AFS_POST_INIT + fi + ;; + stop|force-stop) # Stop AFS echo -n "Stopping AFS services: " - if is_on $AFS_CLIENT ; then + if mount |grep -q \^AFS ; then umount /afs echo -n " afsd" fi - if is_on $AFS_SERVER && test -x /usr/afs/bin/bos ; then - echo "Stopping AFS bosserver" - /usr/afs/bin/bos shutdown localhost -localauth -wait - start-stop-daemon --stop --quiet --signal 1 \ - --pidfile /var/run/bos.pid - fi LIBAFS=`/sbin/lsmod | fgrep openafs` if [ -n "$LIBAFS" ] ; then -- 2.39.5