Turn the init.d scripts into autoconf config files

This change ensures the paths used by the provided init scripts
always reference the prefixes provided at configure time.  The
@sbindir@ and @sysconfdir@ prefixes will be correctly replaced
at build time.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #336
This commit is contained in:
Kyle Fuller 2011-07-25 01:00:53 +01:00 committed by Brian Behlendorf
parent 7f4afd300b
commit 5faa9c0367
9 changed files with 73 additions and 35 deletions

8
configure vendored
View File

@ -20562,7 +20562,7 @@ fi
$as_echo "$enable_debug" >&6; } $as_echo "$enable_debug" >&6; }
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile lib/libshare/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile cmd/sas_switch_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh" ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/init.d/zfs.arch etc/init.d/zfs.gentoo etc/init.d/zfs.lunar etc/init.d/zfs.fedora etc/init.d/zfs.lsb etc/init.d/zfs.redhat etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile lib/libshare/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile cmd/sas_switch_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
@ -21485,6 +21485,12 @@ do
"etc/udev/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/Makefile" ;; "etc/udev/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/Makefile" ;;
"etc/udev/rules.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/Makefile" ;; "etc/udev/rules.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/Makefile" ;;
"etc/init.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/init.d/Makefile" ;; "etc/init.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/init.d/Makefile" ;;
"etc/init.d/zfs.arch") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.arch" ;;
"etc/init.d/zfs.gentoo") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.gentoo" ;;
"etc/init.d/zfs.lunar") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.lunar" ;;
"etc/init.d/zfs.fedora") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.fedora" ;;
"etc/init.d/zfs.lsb") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.lsb" ;;
"etc/init.d/zfs.redhat") CONFIG_FILES="$CONFIG_FILES etc/init.d/zfs.redhat" ;;
"etc/zfs/Makefile") CONFIG_FILES="$CONFIG_FILES etc/zfs/Makefile" ;; "etc/zfs/Makefile") CONFIG_FILES="$CONFIG_FILES etc/zfs/Makefile" ;;
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
"man/man8/Makefile") CONFIG_FILES="$CONFIG_FILES man/man8/Makefile" ;; "man/man8/Makefile") CONFIG_FILES="$CONFIG_FILES man/man8/Makefile" ;;

View File

@ -61,6 +61,12 @@ AC_CONFIG_FILES([
etc/udev/Makefile etc/udev/Makefile
etc/udev/rules.d/Makefile etc/udev/rules.d/Makefile
etc/init.d/Makefile etc/init.d/Makefile
etc/init.d/zfs.arch
etc/init.d/zfs.gentoo
etc/init.d/zfs.lunar
etc/init.d/zfs.fedora
etc/init.d/zfs.lsb
etc/init.d/zfs.redhat
etc/zfs/Makefile etc/zfs/Makefile
man/Makefile man/Makefile
man/man8/Makefile man/man8/Makefile

View File

@ -35,7 +35,10 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
subdir = etc/init.d subdir = etc/init.d
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/zfs.arch.in $(srcdir)/zfs.fedora.in \
$(srcdir)/zfs.gentoo.in $(srcdir)/zfs.lsb.in \
$(srcdir)/zfs.lunar.in $(srcdir)/zfs.redhat.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \ am__aclocal_m4_deps = \
$(top_srcdir)/config/always-no-unused-but-set-variable.m4 \ $(top_srcdir)/config/always-no-unused-but-set-variable.m4 \
@ -83,7 +86,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/zfs_config.h CONFIG_HEADER = $(top_builddir)/zfs_config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES = zfs.arch zfs.gentoo zfs.lunar zfs.fedora zfs.lsb \
zfs.redhat
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V)) AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@ -296,6 +300,18 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
zfs.arch: $(top_builddir)/config.status $(srcdir)/zfs.arch.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
zfs.gentoo: $(top_builddir)/config.status $(srcdir)/zfs.gentoo.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
zfs.lunar: $(top_builddir)/config.status $(srcdir)/zfs.lunar.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
zfs.fedora: $(top_builddir)/config.status $(srcdir)/zfs.fedora.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
zfs.lsb: $(top_builddir)/config.status $(srcdir)/zfs.lsb.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
zfs.redhat: $(top_builddir)/config.status $(srcdir)/zfs.redhat.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo

View File

@ -3,6 +3,10 @@
. /etc/rc.conf . /etc/rc.conf
. /etc/rc.d/functions . /etc/rc.d/functions
ZFS="@sbindir@/zfs"
ZPOOL="@sbindir@/zpool"
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
case "$1" in case "$1" in
start) start)
stat_busy "Starting zfs" stat_busy "Starting zfs"
@ -16,8 +20,8 @@ case "$1" in
fi fi
# Import ZFS pools (via cache file) # Import ZFS pools (via cache file)
if [ -f /etc/zfs/zpool.cache ]; then if [ -f $ZPOOL_CACHE ]; then
/usr/sbin/zpool import -c /etc/zfs/zpool.cache -aN 2>/dev/null $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
stat_fail stat_fail
exit 1 exit 1
@ -25,14 +29,14 @@ case "$1" in
fi fi
# Mount ZFS filesystems # Mount ZFS filesystems
/usr/sbin/zfs mount -a $ZFS mount -a
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
stat_fail stat_fail
exit 1 exit 1
fi fi
# Export ZFS flesystems # Export ZFS flesystems
/usr/sbin/zfs share -a $ZFS share -a
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
stat_fail stat_fail
exit 1 exit 1
@ -43,7 +47,7 @@ case "$1" in
;; ;;
stop) stop)
stat_busy "Stopping zfs" stat_busy "Stopping zfs"
zfs umount -a $ZFS umount -a
rm_daemon zfs rm_daemon zfs
stat_done stat_done
;; ;;

View File

@ -30,8 +30,9 @@ export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# script variables # script variables
RETVAL=0 RETVAL=0
ZPOOL=zpool ZFS="@sbindir@/zfs"
ZFS=zfs ZPOOL="@sbindir@/zpool"
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
servicename=zfs servicename=zfs
LOCKFILE=/var/lock/subsys/$servicename LOCKFILE=/var/lock/subsys/$servicename
@ -143,10 +144,10 @@ start()
fi fi
fi fi
if [ -f /etc/zfs/zpool.cache ] ; then if [ -f $ZPOOL_CACHE ] ; then
echo -n $"Importing ZFS pools not yet imported: " echo -n $"Importing ZFS pools not yet imported: "
$ZPOOL import -c /etc/zfs/zpool.cache -aN || true # stupid zpool will fail if all pools are already imported $ZPOOL import -c $ZPOOL_CACHE -aN || true # stupid zpool will fail if all pools are already imported
RETVAL=$? RETVAL=$?
if [ $RETVAL -ne 0 ]; then if [ $RETVAL -ne 0 ]; then
failure "Importing ZFS pools not yet imported: " failure "Importing ZFS pools not yet imported: "

View File

@ -11,9 +11,9 @@ depend()
keyword -lxc -openvz -prefix -vserver keyword -lxc -openvz -prefix -vserver
} }
CACHEFILE=/etc/zfs/zpool.cache ZFS="@sbindir@/zfs"
ZPOOL=/sbin/zpool ZPOOL="@sbindir@/zpool"
ZFS=/sbin/zfs ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
ZFS_MODULE=zfs ZFS_MODULE=zfs
checksystem() { checksystem() {
@ -55,11 +55,11 @@ start() {
# Import all pools described by the cache file, and then mount # Import all pools described by the cache file, and then mount
# all filesystem based on their properties. # all filesystem based on their properties.
if [ -f $CACHEFILE ]; then if [ -f $ZPOOL_CACHE ]; then
einfo "Importing ZFS pools" einfo "Importing ZFS pools"
# as per fedora script, import can fail if all pools are already imported # as per fedora script, import can fail if all pools are already imported
# The check for $rv makes no sense...but someday, it will work right. # The check for $rv makes no sense...but someday, it will work right.
$ZPOOL import -c $CACHEFILE -aN 2>/dev/null || true $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null || true
rv=$? rv=$?
if [ $rv -ne 0 ]; then if [ $rv -ne 0 ]; then
eerror "Failed to import not-yet imported pools." eerror "Failed to import not-yet imported pools."

View File

@ -31,9 +31,9 @@
RETVAL=0 RETVAL=0
LOCKFILE=/var/lock/zfs LOCKFILE=/var/lock/zfs
CACHEFILE=/etc/zfs/zpool.cache ZFS="@sbindir@/zfs"
ZPOOL=/sbin/zpool ZPOOL="@sbindir@/zpool"
ZFS=/sbin/zfs ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
[ -x $ZPOOL ] || exit 1 [ -x $ZPOOL ] || exit 1
[ -x $ZFS ] || exit 2 [ -x $ZFS ] || exit 2
@ -66,9 +66,9 @@ start()
# Import all pools described by the cache file, and then mount # Import all pools described by the cache file, and then mount
# all filesystem based on their properties. # all filesystem based on their properties.
if [ -f $CACHEFILE ] ; then if [ -f $ZPOOL_CACHE ] ; then
log_begin_msg "Importing ZFS pools" log_begin_msg "Importing ZFS pools"
$ZPOOL import -c $CACHEFILE -aN 2>/dev/null $ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null
log_end_msg $? log_end_msg $?
log_begin_msg "Mounting ZFS filesystems" log_begin_msg "Mounting ZFS filesystems"

View File

@ -10,6 +10,10 @@
# using SPL (Solaris Porting Layer) by zfsonlinux.org. # using SPL (Solaris Porting Layer) by zfsonlinux.org.
# probe: true # probe: true
ZFS="@sbindir@/zfs"
ZPOOL="@sbindir@/zpool"
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
case $1 in case $1 in
start) echo "$1ing ZFS filesystems" start) echo "$1ing ZFS filesystems"
@ -35,16 +39,16 @@ case $1 in
while IFS= read -r -d $'\n' dev; do while IFS= read -r -d $'\n' dev; do
mdev=$(echo "$dev" | awk '{ print $1; }') mdev=$(echo "$dev" | awk '{ print $1; }')
echo -n "mounting $mdev..." echo -n "mounting $mdev..."
if zfs mount $mdev; then if $ZFS mount $mdev; then
echo -e "done"; echo -e "done";
else else
echo -e "failed"; echo -e "failed";
fi fi
done < <(zfs list -H); done < <($ZFS list -H);
# export the filesystems # export the filesystems
echo -n "exporting ZFS filesystems..." echo -n "exporting ZFS filesystems..."
if zfs share -a; then if $ZFS share -a; then
echo -e "done"; echo -e "done";
else else
echo -e "failed"; echo -e "failed";
@ -60,14 +64,14 @@ case $1 in
while IFS= read -r -d $'\n' dev; do while IFS= read -r -d $'\n' dev; do
mdev=$(echo "$dev" | awk '{ print $1 }'); mdev=$(echo "$dev" | awk '{ print $1 }');
echo -n "umounting $mdev..."; echo -n "umounting $mdev...";
if zfs umount $mdev; then if $ZFS umount $mdev; then
echo -e "done"; echo -e "done";
else else
echo -e "failed"; echo -e "failed";
fi fi
# the next line is, because i have to reverse the # the next line is, because i have to reverse the
# output, otherwise it wouldn't work as it should # output, otherwise it wouldn't work as it should
done < <(zfs list -H | tac); done < <($ZFS list -H | tac);
# and finally let's rmmod the module # and finally let's rmmod the module
rmmod zfs rmmod zfs

View File

@ -30,8 +30,9 @@ export PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
# script variables # script variables
RETVAL=0 RETVAL=0
ZPOOL=zpool ZFS="@sbindir@/zfs"
ZFS=zfs ZPOOL="@sbindir@/zpool"
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
servicename=zfs servicename=zfs
LOCKFILE=/var/lock/subsys/$servicename LOCKFILE=/var/lock/subsys/$servicename