From 0b69fd6d5631482a786c2223a7dec0b2c9a07f92 Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Tue, 29 Mar 2011 22:26:50 -0400 Subject: [PATCH] Unbreak make dest for FBSD It turns out that we do need an afs.rc.fbsd that is set up for transarc paths in this directory. To get it to work properly will require the user to symlink to it from a dir that gets checked by rcorder, but them's the breaks. Change-Id: I1786e4862768127f29a6d309097536829da3e029 Reviewed-on: http://gerrit.openafs.org/4378 Reviewed-by: Derrick Brashear Tested-by: BuildBot --- src/afsd/afs.rc.fbsd | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/afsd/afs.rc.fbsd diff --git a/src/afsd/afs.rc.fbsd b/src/afsd/afs.rc.fbsd new file mode 100644 index 0000000..afc78eb --- /dev/null +++ b/src/afsd/afs.rc.fbsd @@ -0,0 +1,74 @@ +#!/bin/sh +# +# PROVIDE: afsd +# REQUIRE: named +# KEYWORD: shutdown +# +# Symlink from /usr/local/etc/rc.d/afsd to /usr/vice/etc/afs.rc.fbsd +# and add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# afsd_enable (bool): Set to NO by default. +# Set it to YES to enable afsd. +# +# Suggested values for a "large" configuration: +# afsd_flags="-stat 2800 -daemons 5 -volumes 128" +# +# Suggested values for a "medium" configuration: +# afsd_flags="-stat 2000 -daemons 3 -volumes 70" +# +# Suggested values for a "small" configuration: +# afsd_flags="-stat 300 -daemons 2 -volumes 50" + +. /etc/rc.subr + +name="afsd" +rcvar="afsd_enable" + +command="/usr/vice/etc/afsd" +command_args="-dynroot -fakestat-all -afsdb -memcache" + +start_precmd="afsd_prestart" +start_postcmd="afsd_poststart" +stop_cmd="afsd_stop" + +kmod="libafs" +vicedir="/usr/vice/etc" +required_modules="libafs:afs" +required_files="${vicedir}/cacheinfo ${vicedir}/ThisCell ${vicedir}/CellServDB" + +load_rc_config "$name" + +: ${afsd_enable:="NO"} +: ${afsd_flags:="-stat 2800 -daemons 6 -volumes 128"} + +afsd_prestart() +{ + local dir + + # need a mountpoint and a cache dir (well, if we have a disk cache) + # Should use required_dirs, but no good way to extract from cacheinfo + for dir in $(awk -F: '{print $1, $2}' ${vicedir}/cacheinfo); do + if [ ! -d "${dir}" ]; then + err 1 "Directory ${dir} does not exist. Not starting AFS client." + fi + done +} + +afsd_poststart() +{ + /usr/local/bin/fs setcrypt -crypt on +} + +afsd_stop() +{ + local afsdir + + afsdir=$(awk -F: '{print $1}' ${vicedir}/cacheinfo) + if ! umount $afsdir; then + [ -n "${rc_force}" ] && umount -f ${afsdir} + fi + kldunload ${kmod} +} + +run_rc_command "$1" -- 1.9.4