From: HOSAKA Eiichi <ei@foc.jp>
To: autofs@linux.kernel.org
Subject: Patch for autofs-4.1.0
Date: Tue, 27 Jan 2004 00:36:17 +0900 [thread overview]
Message-ID: <040127003617.M0119515@bureau.foc.jp> (raw)
Patch for autofs-4.1.0
to port the file samples/rc.autofs for the Slackware Linux.
diff -ru autofs-4.1.0/samples/Makefile autofs-4.1.0slack1.4/samples/Makefile
--- autofs-4.1.0/samples/Makefile 2003-09-29 17:22:35.000000000 +0900
+++ autofs-4.1.0slack1.4/samples/Makefile
@@ -10,7 +10,11 @@
CFLAGS += -I../include
LIBS = -lldap -llber
+ifeq ($(LDAP),1)
all: autofs-ldap-auto-master rc.autofs
+else
+all: rc.autofs
+endif
autofs-ldap-auto-master: $(OBJS)
$(CC) $(LDFLAGS) -o autofs-ldap-auto-master $(OBJS) $(LIBS)
@@ -28,10 +32,18 @@
-mv -f $(INSTALLROOT)/etc/auto.misc $(INSTALLROOT)/etc/auto.misc.old
install -c auto.misc -m 644 $(INSTALLROOT)/etc
install -c auto.net -m 755 $(INSTALLROOT)/etc
+ifneq ($(initdir),)
install -d -m 755 $(INSTALLROOT)/$(initdir)
install -c rc.autofs -m 755 $(INSTALLROOT)$(initdir)/autofs
+else
+ if test -d $(INSTALLROOT)/etc/rc.d ; then \
+ install -c rc.autofs -m 755 $(INSTALLROOT)/etc/rc.d ; \
+ fi
+endif
+ifeq ($(LDAP),1)
install -d -m 755 $(INSTALLROOT)$(autofslibdir)
install -c autofs-ldap-auto-master -m 755 $(INSTALLROOT)$(autofslibdir)
+endif
clean:
rm -f *.o *.s autofs-ldap-auto-master rc.autofs
diff -ru autofs-4.1.0/samples/rc.autofs.in autofs-4.1.0slack1.4/samples/rc.autofs.in
--- autofs-4.1.0/samples/rc.autofs.in 2003-11-24 23:36:51.000000000 +0900
+++ autofs-4.1.0slack1.4/samples/rc.autofs.in
@@ -7,7 +7,7 @@
# map with that name
#
# On most distributions, this file should be called:
-# /etc/rc.d/init.d/autofs or /etc/init.d/autofs
+# /etc/rc.d/init.d/autofs, /etc/init.d/autofs or /etc/rc.d/rc.autofs
#
# For Redhat-ish systems
@@ -41,6 +41,8 @@
system=debian
elif [ -f /etc/redhat-release ]; then
system=redhat
+elif [ -f /etc/slackware-version ]; then
+ system=slackware
else
echo "$0: Unknown system, please port and contact autofs@linux.kernel.org" 1>&2
exit 1
@@ -169,12 +171,12 @@
: echo DAEMONOPTIONS OPTIONS $daemonoptions $options
startupoptions=
if echo "$daemonoptions" | grep -q -- '-t' ; then
- startupoptions="--timeout=$(echo $daemonoptions $options | \
+ startupoptions="--timeout=$(echo $daemonoptions | \
sed 's/.*--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/\2/g')"
fi
# Override timeout in $daemonoptions with map $options
if echo "$options" | grep -q -- '-t' ; then
- startupoptions="--timeout=$(echo $daemonoptions $options | \
+ startupoptions="--timeout=$(echo $options | \
sed 's/.*--*t\(imeout\)*[ \t=]*\([0-9][0-9]*\).*$/\2/g')"
fi
if echo "$daemonoptions $options" | grep -q -- '-g' ; then
@@ -402,11 +404,74 @@
esac
}
+#
+# Slackware start/stop function.
+#
+function slackware()
+{
+ local lock=/var/lock/$prog
+ case "$1" in
+ (start)
+ if ! ln -s /dev/null $lock 2>/dev/null ; then
+ echo "$prog is now running or already killed abnormally" >&2
+ exit 1
+ fi
+ echo "Starting $prog:"
+ getmounts | while read line ; do echo " $line" ; $line ; sleep 1 ; done
+ ;;
+ (stop)
+ echo -n "Stopping $prog "
+ local count
+ (( count = 0 ))
+ while [ -n "$( ps axw | grep "[0-9]:[0-9][0-9] $DAEMON " )" ] ; do
+ (( count++ >= 10 )) &&
+ { echo -n ' give up' ; killall -TERM $DAEMON ; break ; }
+ echo -n .
+ killall -USR2 $DAEMON
+ sleep 3
+ done
+ echo
+ umount -a -f -t autofs
+ rm -f $lock
+ ;;
+ (reload|restart)
+ test -e $lock || { echo "Maybe $prog is not running" >&2 ; exit 1 ; }
+ echo "Checking for changes to /etc/auto.master:"
+ local nline new[] pid tt stat time oline old[]
+ while read nline ; do new[${#new[@]}]="$nline" ; done <<__EOF__
+$( getmounts )
+__EOF__
+ while read pid tt stat time oline ; do
+ old[${#old[@]}]="$oline"
+ for nline in "${new[@]}" ; do
+ test "$oline" = "$nline" && { oline= ; break ; }
+ done
+ test -n "$oline" &&
+ { echo " stop: $oline" ; kill -USR2 $pid ; sleep 1 ; }
+ done <<__EOF__
+$( ps axw | grep "[0-9]:[0-9][0-9] $DAEMON " )
+__EOF__
+ for nline in "${new[@]}" ; do
+ for oline in "${old[@]}" ; do
+ test "$nline" = "$oline" && { nline= ; break ; }
+ done
+ test -n "$nline" &&
+ { echo " start: $nline" ; $nline ; sleep 1 ; }
+ done
+ killall -HUP $DAEMON
+ sleep 1
+ ;;
+ (status)
+ status
+ ;;
+ (*)
+ echo "Usage: $0 {start|stop|reload|restart|status}" >&2
+ exit 1
+ ;;
+ esac
+}
+
RETVAL=0
-if [ $system = debian ]; then
- debian "$@"
-elif [ $system = redhat ]; then
- redhat "$@"
-fi
+$system "$@"
exit $RETVAL
reply other threads:[~2004-01-26 15:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=040127003617.M0119515@bureau.foc.jp \
--to=ei@foc.jp \
--cc=autofs@linux.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.