freebsd-ports/sysutils/fusefs-kmod/files/setup.sh.in
Alejandro Pulver 6b3f87a53a From [1]:
- Update to version 0.3.9-pre1.20080208 (agreed with author).
- Download directly from the Mercurial reposirory (as tarball), to ease
  maintainence.
- Remove all local patches as they were integrated.
- Convert setup.sh into setup.sh.in, and use SUB_FILES instead of manual
  replacement.
- Use kldload instead of rc.d script in setup.sh.in because the latter gives
  an error.
- Remove "sleep 1" from rc.d script as now the FUSE daemon makes umount wait
  until disks are synced (synchronous unmount).
- Update pkg-message.

From [2]:
- Pass SRC_BASE to the actual build (previously was only used by the port to
  detect if the source was installed, but not passed to the internal Makefile).

PR:		ports/120420 [1], ports/118112 [2]
Submitted by:	alepulver [1], Yuri Pankov <yuri.pankov@gmail.com> [2]
Approved by:	maintainer (timeout) [1], maintainer [2]
2008-02-16 18:05:38 +00:00

52 lines
1.8 KiB
Bash

#!/bin/sh
#
# Automatically setup the loading of the module without polluting /boot/modules
SYSCTL_CONFIG=/etc/sysctl.conf
LOADER_CONFIG=/etc/rc.conf
sysctl kern.module_path | grep "[:space:;=]%%PREFIX%%/modules[;]\?\b" > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 1 ]; then
MODULE_PATH="`sysctl -n kern.module_path`;%%PREFIX%%/modules"
sysctl "kern.module_path=${MODULE_PATH}"
else
MODULE_PATH=`sysctl -n kern.module_path`
fi
grep "kern\.module_path" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
# Variable present
grep "kern\.module_path" ${SYSCTL_CONFIG} | grep "[:space:;=]%%PREFIX%%/modules[;]\?\b" ${SYSCTL_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 1 ]; then
# Not present in variable, so add
ESC_PREFIX=`echo '%%PREFIX%%' | sed -e 's/\//\\\\\//g'`
sed -i .orig -e 's/kern\.module_path[:space:]*=[:space:]*["]*\([[:alnum:][:space:]\.,;\/_-]*\)["]*/kern\.module_path="\1;'${ESC_PREFIX}'\/modules"/g' ${SYSCTL_CONFIG}
fi
else
# Not present.
echo kern.module_path="${MODULE_PATH}" >> ${SYSCTL_CONFIG}
fi
kldstat -n fuse > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
kldunload -n fuse > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -ne 0 ]; then
echo 'NOTICE: Failed to unload the Fuse module!'
echo 'NOTICE: Is fuse.ko in use?'
fi
fi
grep fusefs_enable ${LOADER_CONFIG} > /dev/null 2>&1; RESULT=$?
if [ ${RESULT} -eq 0 ]; then
# Present, we should leave it alone
# sed -e s/fusefs_enable.*/fuse_load=\"YES\"/g -i.orig ${LOADER_CONFIG}
else
# Not present. First time install, so lets start it up
echo 'fusefs_enable="YES"' >> ${LOADER_CONFIG}
fi
kldload fuse > /dev/null 2>&1 ; RESULT=$?
if [ ${RESULT} -ne 0 ]; then
echo 'NOTICE: Failed to load the Fuse module!'
echo 'NOTICE: Unload and load Fuse module manually, or reboot.'
fi