]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Succeed when the kmod is missing
authorBenjamin Kaduk <kaduk@mit.edu>
Thu, 23 Oct 2014 20:25:30 +0000 (16:25 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 24 Oct 2014 04:08:39 +0000 (00:08 -0400)
Otherwise we get an angry message from dpkg and a disabled state.

debian/openafs-client-precheck
debian/openafs-client.service

index 0dfd6486ac366a23c8370af118772b30db50fff5..e2927118a01aa5ff3e087875ccf37c94411dce0a 100755 (executable)
@@ -7,6 +7,7 @@ if [ -f /etc/openafs/afs.conf ]; then
 fi
 
 CACHEINFO=${CACHEINFO:-/etc/openafs/cacheinfo}
+MODULEROOT=${MODULEROOT:-/lib/modules/`uname -r`}
 
 # Exit if the package is not installed.
 [ -x /sbin/afsd ] || exit 1
@@ -32,7 +33,19 @@ if [ -z $(/sbin/lsmod | fgrep openafs) ]; then
 
     if [ $status -ne 0 ] ; then
        echo "Failed to load openafs.ko.  Does it need to be built?" >&2
-        exit $status
+       # We cannot fail hard on a missing module, though, as that will
+       # cause our unit to be put in a disabled state.
+       if $(grep -q openafs "$MODULEROOT/modules.dep"); then
+           exit $status
+       else
+           cat > /var/cache/openafs-client/openafs-client.env <<EOF
+AFSD_ARGS=-exit
+AFS_SETCRYPT=-help
+AFS_SYSNAME=-help
+KMOD=--version
+EOF
+           exit 0
+       fi
     fi
 fi
 
@@ -75,4 +88,5 @@ cat > /var/cache/openafs-client/openafs-client.env <<EOF
 AFSD_ARGS=${AFSD_OPTIONS}
 AFS_SETCRYPT=${AFS_SETCRYPT}
 AFS_SYSNAME=${AFS_SYSNAME}
+KMOD=openafs
 EOF
index 41595afd36c243c17ccb6fc6196098617b663c50..ab65b44e9e06ddd8a4731d12d550125fb127928c 100755 (executable)
@@ -13,7 +13,7 @@ ExecStartPost=/usr/bin/fs sysname $AFS_SYSNAME
 ExecStop=/bin/grep -qv ^1$ /proc/sys/kernel/modules_disabled
 ExecStop=/bin/umount -a -t afs
 ExecStop=/bin/umount -af -t afs
-ExecStopPost=/sbin/rmmod openafs
+ExecStopPost=/sbin/rmmod $KMOD
 EnvironmentFile=/var/cache/openafs-client/openafs-client.env
 KillMode=none