From: Thibault Godouet Date: Sun, 11 Feb 2001 21:15:44 +0000 (+0000) Subject: support of freebsd X-Git-Tag: ver2_9_4~411 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5bccf813605f41848a572438ebed6df5c427156;p=thirdparty%2Ffcron.git support of freebsd --- diff --git a/script/boot-install b/script/boot-install index a276297..297b7ed 100755 --- a/script/boot-install +++ b/script/boot-install @@ -2,7 +2,7 @@ # Install fcron under SysV system. # -# $Id: boot-install,v 1.24 2001-02-02 16:54:38 thib Exp $ +# $Id: boot-install,v 1.25 2001-02-11 21:16:23 thib Exp $ # take 5 arguments : the name of the BSD-like install program (with "-o" and the correct username) # the DESTSBIN directory @@ -21,8 +21,8 @@ fi if test $3 -eq 1; then exit fi -#DEBUG=$3 -DEBUG=1 +DEBUG=$3 +#DEBUG=1 FCRONTABS=$4 ANSWER=$5 @@ -32,6 +32,12 @@ else STARTCMD="fcron -b" fi +if test `uname -s` = "FreeBSD"; then + IS_FREEBSD=1 +else + IS_FREEBSD=0 +fi + echo echo "Fcron should be started by your init scripts." echo "The installation process is going to try to install fcron in them." @@ -42,6 +48,41 @@ SYSV=0 RESTARTED=0 INSTALLED=0 +if $IS_FREEBSD -eq 1; then + if test -x /usr/local/etc/rc.d/fcron.sh; then + echo "Fcron is already in /etc/rc.d/rc.local." + INSTALLED=1 + else + if test $ANSWER -eq 2; then + while test \( ! -z "$INSTALL" \) -a \( "$INSTALL" != "y" \) -a \( "$INSTALL" != "n" \); + do + echo "Would you like to add fcron.sh script in the directory /usr/local/etc/rc.d/ ?" + read -p "Please answer with 'y' or 'n' (default: 'y'): " INSTALL NOTHING + done + # automatic answer given by configure script (option --with-answer-all) + elif test $ANSWER -eq 1; then + INSTALL="y" + else + INSTALL="n" + fi + if test \( -z "$INSTALL" \) -o \( "$INSTALL" = "y" \); then + cp -f script/fcron.sh /usr/local/etc/rc.d/ + if test $DEBUG -eq 1; then + cat /usr/local/etc/rc.d/fcron.sh | sed 's: -b: -b -d:' > /usr/local/etc/rc.d/fcron.sh2 + mv -f /usr/local/etc/rc.d/fcron.sh2 /usr/local/etc/rc.d/fcron.sh + fi + cat /usr/local/etc/rc.d/fcron.sh | sed "s:@@DESTSBIN@:$2:" > /usr/local/etc/rc.d/fcron.sh2 + mv -f /usr/local/etc/rc.d/fcron.sh2 /usr/local/etc/rc.d/fcron.sh + chmod +x /usr/local/etc/rc.d/fcron.sh + INSTALLED=1 + else + INSTALLED=0 + fi + fi +fi + + +INSTALL="nothing" if test -f /etc/rc.d/rc.M; then # Slackware if ! cat /etc/rc.d/rc.local | grep "$STARTCMD"; then @@ -128,7 +169,6 @@ fi INSTALL="nothing" if test \( ! "$INSTALLED" -eq 1 \) -a \( -f /etc/rc \) ; then - # FreeBSD if ! cat /etc/rc.local | grep "$STARTCMD"; then if cat /etc/rc.local | grep fcron; then echo "Fcron seems to be in /etc/rc.local, but not with the appropriate options :" diff --git a/script/boot-uninstall b/script/boot-uninstall index b836d9c..347578b 100755 --- a/script/boot-uninstall +++ b/script/boot-uninstall @@ -2,17 +2,20 @@ # Uninstall fcron under SysV system. # -# $Id: boot-uninstall,v 1.4 2000-11-18 14:51:29 thib Exp $ +# $Id: boot-uninstall,v 1.5 2001-02-11 21:15:44 thib Exp $ PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" -ROOTDIR="" -if test -f /etc/rc.d/init.d/fcron; then +if test `uname -s` = "FreeBSD"; then + rm -f /usr/local/etc/rc.d/fcron.sh +else + ROOTDIR="" + if test -f /etc/rc.d/init.d/fcron; then ROOTDIR="/etc/rc.d" -elif test -f /etc/init.d/fcron; then + elif test -f /etc/init.d/fcron; then ROOTDIR="/etc" -fi -if test $ROOTDIR != ""; then + fi + if test $ROOTDIR != ""; then rm -f $ROOTDIR/init.d/fcron rm -f $ROOTDIR/rc2.d/S40fcron @@ -22,8 +25,9 @@ if test $ROOTDIR != ""; then rm -f $ROOTDIR/rc0.d/K60fcron rm -f $ROOTDIR/rc6.d/K60fcron -else + else echo echo "You may delete fcron from your boot script manually" echo -fi + fi +fi \ No newline at end of file diff --git a/script/user-group b/script/user-group index 27c48d7..eeafed3 100755 --- a/script/user-group +++ b/script/user-group @@ -4,7 +4,7 @@ # them if necessary. # -# $Id: user-group,v 1.4 2001-01-27 15:32:46 thib Exp $ +# $Id: user-group,v 1.5 2001-02-11 21:16:08 thib Exp $ # take 3 arguments : username # groupname @@ -23,6 +23,12 @@ ANSWER=$3 INSTALL="nothing" INSTALLED=0 +if test `uname -s` = "FreeBSD"; then + IS_FREEBSD=1 +else + IS_FREEBSD=0 +fi + echo -n "Checking if $USERNAME is in /etc/passwd ... " if grep "^$USERNAME:" /etc/passwd > /dev/null; then echo "yes." @@ -34,6 +40,8 @@ else CMD="useradd -c '$USERNAME' $USERNAME" elif adduser -D 2> /dev/null; then CMD="adduser -c '$USERNAME' $USERNAME" + elif test $IS_FREEBSD -eq 1; then + CMD="pw useradd $USERNAME -c $USERNAME" fi if test -z "$CMD"; then echo "Could not determine the command to use to add a user." @@ -71,7 +79,12 @@ fi INSTALL="nothing" INSTALLED=0 -CMD="groupadd $GROUPNAME" + +if test $IS_FREEBSD -eq 1; then + CMD="pw groupadd $GROUPNAME" +else + CMD="groupadd $GROUPNAME" +fi echo -n "Checking if $GROUPNAME is in /etc/group ... " if grep "^$GROUPNAME:" /etc/group > /dev/null; then