wok-current rev 15577

Update some start scripts
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Nov 29 11:43:20 2013 +0000 (2013-11-29)
parents 02e59bb0cae1
children 5c8c6743afe9
files connman/stuff/etc/init.d/connman cups/stuff/etc/init.d/cupsd gpm/stuff/etc/init.d/gpm hostapd/stuff/hostapd lighttpd-modules/receipt lighttpd/receipt mpd/stuff/etc/init.d/mpd ofono/receipt ofono/stuff/etc/init.d/ofono wicd/stuff/wicd
line diff
     1.1 --- a/connman/stuff/etc/init.d/connman	Fri Nov 29 08:51:47 2013 +0000
     1.2 +++ b/connman/stuff/etc/init.d/connman	Fri Nov 29 11:43:20 2013 +0000
     1.3 @@ -17,33 +17,32 @@
     1.4  
     1.5  case "$1" in
     1.6    start)
     1.7 -    if [ -d $PIDFILE ] ; then
     1.8 +    if active_pidfile $PIDFILE connmand ; then
     1.9        echo "$NAME already running."
    1.10        exit 1
    1.11      fi
    1.12 -	killall udhcpc 2>/dev/null
    1.13 +    killall udhcpc 2>/dev/null
    1.14      echo -n "Starting $DESC: $NAME... "
    1.15      $DAEMON $OPTIONS
    1.16      status
    1.17      ;;
    1.18    stop)
    1.19 -    if [ -z "$(pidof connmand)" ] ; then
    1.20 +    if ! active_pidfile $PIDFILE connmand ; then
    1.21        echo "$NAME is not running."
    1.22 -	  rm -rf $PIDFILE
    1.23        exit 1
    1.24      fi
    1.25      echo -n "Stopping $DESC: $NAME... "
    1.26 -	rm -rf $PIDFILE
    1.27 -	kill $(pidof connmand)
    1.28 -	status
    1.29 +    rm -rf $PIDFILE
    1.30 +    kill $(pidof connmand)
    1.31 +    status
    1.32      ;;
    1.33    restart)
    1.34 -    if [ -z "$(pidof connmand)" ]; then
    1.35 +    if ! active_pidfile $PIDFILE connmand ; then
    1.36        echo "$NAME is not running."
    1.37        exit 1
    1.38      fi
    1.39      echo -n "Restarting $DESC: $NAME... "
    1.40 -	rm -rf $PIDFILE
    1.41 +    rm -rf $PIDFILE
    1.42      kill $(pidof connmand) &&
    1.43      sleep 2 &&
    1.44      $DAEMON $OPTIONS
     2.1 --- a/cups/stuff/etc/init.d/cupsd	Fri Nov 29 08:51:47 2013 +0000
     2.2 +++ b/cups/stuff/etc/init.d/cupsd	Fri Nov 29 11:43:20 2013 +0000
     2.3 @@ -23,8 +23,7 @@
     2.4  		status
     2.5  		;;
     2.6  	start)
     2.7 -		pgrep -f cupsd > /dev/null || rm -f $PIDFILE 2> /dev/null
     2.8 -		if [ ! -e $PIDFILE ]; then
     2.9 +		if ! active_pidfile $PIDFILE cupsd ; then
    2.10  			echo -n "Starting $DESC: $NAME... "
    2.11  			$DAEMON $OPTIONS
    2.12  			status
     3.1 --- a/gpm/stuff/etc/init.d/gpm	Fri Nov 29 08:51:47 2013 +0000
     3.2 +++ b/gpm/stuff/etc/init.d/gpm	Fri Nov 29 11:43:20 2013 +0000
     3.3 @@ -16,14 +16,26 @@
     3.4  
     3.5  case "$1" in
     3.6    start)
     3.7 +    if active_pidfile $PIDFILE gpm ; then
     3.8 +      echo "$NAME already running."
     3.9 +      exit 1
    3.10 +    fi
    3.11      $DAEMON $OPTIONS
    3.12      status
    3.13      ;;
    3.14    stop)
    3.15 +    if ! active_pidfile $PIDFILE gpm ; then
    3.16 +      echo "$NAME is not running."
    3.17 +      exit 1
    3.18 +    fi
    3.19      $DAEMON -k
    3.20      status
    3.21      ;;
    3.22    restart)
    3.23 +    if ! active_pidfile $PIDFILE gpm ; then
    3.24 +      echo "$NAME is not running."
    3.25 +      exit 1
    3.26 +    fi
    3.27      $DAEMON -k
    3.28      status
    3.29      $DAEMON $OPTIONS
     4.1 --- a/hostapd/stuff/hostapd	Fri Nov 29 08:51:47 2013 +0000
     4.2 +++ b/hostapd/stuff/hostapd	Fri Nov 29 11:43:20 2013 +0000
     4.3 @@ -14,7 +14,7 @@
     4.4  
     4.5  case "$1" in
     4.6    start)
     4.7 -    if [ -f $PIDFILE ] ; then
     4.8 +    if active_pidfile $PIDFILE hostapd ; then
     4.9        echo "$NAME already running."
    4.10        exit 1
    4.11      fi
    4.12 @@ -23,7 +23,7 @@
    4.13      status
    4.14      ;;
    4.15    stop)
    4.16 -    if [ ! -f $PIDFILE ] ; then
    4.17 +    if ! active_pidfile $PIDFILE hostapd ; then
    4.18        echo "$NAME is not running."
    4.19        exit 1
    4.20      fi
    4.21 @@ -32,7 +32,7 @@
    4.22      status
    4.23      ;;
    4.24    restart)
    4.25 -    if [ ! -f $PIDFILE ] ; then
    4.26 +    if ! active_pidfile $PIDFILE hostapd ; then
    4.27        echo "$NAME is not running."
    4.28        exit 1
    4.29      fi
     5.1 --- a/lighttpd-modules/receipt	Fri Nov 29 08:51:47 2013 +0000
     5.2 +++ b/lighttpd-modules/receipt	Fri Nov 29 11:43:20 2013 +0000
     5.3 @@ -28,7 +28,7 @@
     5.4  {
     5.5  	# Modules.
     5.6  	mkdir -p $fs/usr/
     5.7 -	cp -a $_pkg/usr/lib $fs/usr
     5.8 +	cp -a $install/usr/lib $fs/usr
     5.9  	for module in $BASE_MODULES
    5.10  	do
    5.11  		rm -f $fs/usr/lib/lighttpd/mod_${module}.so
     6.1 --- a/lighttpd/receipt	Fri Nov 29 08:51:47 2013 +0000
     6.2 +++ b/lighttpd/receipt	Fri Nov 29 11:43:20 2013 +0000
     6.3 @@ -31,19 +31,15 @@
     6.4  {
     6.5  	cd $src
     6.6  	sed -i '/addrs_left/d' src/mod_extforward.c
     6.7 -	if [ ! done.fastcgi_detach.patch ]; then
     6.8 -		patch -i $stuff/fastcgi_detach.patch || return 1
     6.9 -		touch done.fastcgi_detach.patch
    6.10 -	fi
    6.11  	./configure \
    6.12  		--enable-shared \
    6.13  		--disable-ipv6 \
    6.14  		--prefix=/usr \
    6.15 -    	--libdir=/usr/lib/lighttpd \
    6.16 -    	--mandir=/usr/share/man \
    6.17 -    	$CONFIGURE_ARGS &&
    6.18 +		--libdir=/usr/lib/lighttpd \
    6.19 +		--mandir=/usr/share/man \
    6.20 +	$CONFIGURE_ARGS &&
    6.21  	make &&
    6.22 -	make DESTDIR=$PWD/_pkg install
    6.23 +	make DESTDIR=$DESTDIR install
    6.24  }
    6.25  
    6.26  # Rules to gen a SliTaz package suitable for Tazpkg.
    6.27 @@ -51,14 +47,14 @@
    6.28  genpkg_rules()
    6.29  {
    6.30  	mkdir -p $fs/usr
    6.31 -	#cp -a $_pkg/usr/bin $fs/usr
    6.32 -	cp -a $_pkg/usr/sbin $fs/usr
    6.33 +	#cp -a $install/usr/bin $fs/usr
    6.34 +	cp -a $install/usr/sbin $fs/usr
    6.35  
    6.36  	# Modules.
    6.37  	mkdir -p $fs/usr/lib/lighttpd
    6.38  	for module in $BASE_MODULES
    6.39  	do
    6.40 -		cp $_pkg/usr/lib/lighttpd/mod_${module}.so $fs/usr/lib/lighttpd
    6.41 +		cp $install/usr/lib/lighttpd/mod_${module}.so $fs/usr/lib/lighttpd
    6.42  		echo -n "Copying : mod_${module}.so" && status
    6.43  	done
    6.44  
     7.1 --- a/mpd/stuff/etc/init.d/mpd	Fri Nov 29 08:51:47 2013 +0000
     7.2 +++ b/mpd/stuff/etc/init.d/mpd	Fri Nov 29 11:43:20 2013 +0000
     7.3 @@ -11,21 +11,35 @@
     7.4  DESC="Music Player Daemon"
     7.5  DAEMON=/usr/sbin/mpd
     7.6  OPTION="/etc/mpd.conf"
     7.7 +PIDFILE="/var/run/mpd.pid"
     7.8  
     7.9  case "$1" in
    7.10  start)
    7.11 +	if active_pidfile $PIDFILE mpd ; then
    7.12 +		echo "$NAME already running."
    7.13 +		exit 1
    7.14 +	fi
    7.15  	echo -n "Starting $DESC: $NAME... "
    7.16  	$DAEMON $OPTION 2> /dev/null
    7.17  	status
    7.18 +	pidof $NAME > $PIDFILE
    7.19  	;;
    7.20  stop)
    7.21 +	if ! active_pidfile $PIDFILE mpd ; then
    7.22 +		echo "$NAME is not running."
    7.23 +		exit 1
    7.24 +	fi
    7.25  	echo -n "Stopping $DESC: $NAME... "
    7.26 -	$DAEMON --kill 2> /dev/null
    7.27 +	kill $(pidof $NAME)
    7.28  	status
    7.29  	;;
    7.30  restart)
    7.31 +	if ! active_pidfile $PIDFILE mpd ; then
    7.32 +		echo "$NAME is not running."
    7.33 +		exit 1
    7.34 +	fi
    7.35  	echo -n "Restarting $DESC: $NAME... "
    7.36 -	$DAEMON --kill 2> /dev/null
    7.37 +	kill $(pidof $NAME)
    7.38  	sleep 2
    7.39  	$DAEMON $OPTION 2> /dev/null
    7.40  	status
     8.1 --- a/ofono/receipt	Fri Nov 29 08:51:47 2013 +0000
     8.2 +++ b/ofono/receipt	Fri Nov 29 11:43:20 2013 +0000
     8.3 @@ -5,11 +5,12 @@
     8.4  CATEGORY="network"
     8.5  SHORT_DESC="Stack for mobile telephony (GSM/UMTS) applications."
     8.6  MAINTAINER="slaxemulator@gmail.com"
     8.7 +LICENSE="GPL2"
     8.8  TARBALL="$PACKAGE-$VERSION.tar.xz"
     8.9  WEB_SITE="http://ofono.org"
    8.10  WGET_URL="http://linux-kernel.uio.no/pub/linux/network/$PACKAGE/$TARBALL"
    8.11  
    8.12 -DEPENDS="dbus glib udev"
    8.13 +DEPENDS="dbus glib udev bluez"
    8.14  BUILD_DEPENDS="dbus-dev udev-dev glib-dev bluez-dev \
    8.15  mobile-broadband-provider-info-dev"
    8.16  
    8.17 @@ -23,7 +24,7 @@
    8.18  		--infodir=/usr/share/info \
    8.19  		--mandir=/usr/share/man \
    8.20  		$CONFIGURE_ARGS &&
    8.21 -	make && make DESTDIR=$PWD/_pkg install
    8.22 +	make && make DESTDIR=$DESTDIR install
    8.23  }
    8.24  
    8.25  # Rules to gen a SliTaz package suitable for Tazpkg.
    8.26 @@ -31,8 +32,9 @@
    8.27  {
    8.28  	# sysconfdir
    8.29  	mkdir -p $fs/etc
    8.30 -	cp -a $_pkg/etc/* $fs/etc
    8.31 +	cp -a $install/etc/* $fs/etc
    8.32 +	cp -a $stuff/etc/* $fs/etc
    8.33  	# sbin
    8.34  	mkdir -p $fs/usr
    8.35 -	cp -a $_pkg/usr/sbin $fs/usr
    8.36 +	cp -a $install/usr/sbin $fs/usr
    8.37  }
     9.1 --- a/ofono/stuff/etc/init.d/ofono	Fri Nov 29 08:51:47 2013 +0000
     9.2 +++ b/ofono/stuff/etc/init.d/ofono	Fri Nov 29 11:43:20 2013 +0000
     9.3 @@ -13,43 +13,43 @@
     9.4  DESC="Mobile telephony Manager"
     9.5  DAEMON=/usr/sbin/ofonod
     9.6  OPTIONS=$OFONO_OPTIONS
     9.7 -PIDFILE=/run/ofono
     9.8 +PIDFILE=/var/run/ofono.pid
     9.9  
    9.10  case "$1" in
    9.11    start)
    9.12 -    if [ -d $PIDFILE ] ; then
    9.13 +    if active_pidfile $PIDFILE ofonod ; then
    9.14        echo "$NAME already running."
    9.15        exit 1
    9.16      fi
    9.17      echo -n "Starting $DESC: $NAME... "
    9.18      $DAEMON $OPTIONS
    9.19      status
    9.20 +    pidof ofonod > $PIDFILE
    9.21      ;;
    9.22    stop)
    9.23 -    if [ -z "$(pidof ofonod)" ] ; then
    9.24 +    if ! active_pidfile $PIDFILE ofonod ; then
    9.25        echo "$NAME is not running."
    9.26 -	  rm -rf $PIDFILE
    9.27        exit 1
    9.28      fi
    9.29      echo -n "Stopping $DESC: $NAME... "
    9.30 -	rm -rf $PIDFILE
    9.31 -	kill $(pidof ofonod)
    9.32 -	status
    9.33 +    rm -rf $PIDFILE
    9.34 +    kill $(pidof ofonod)
    9.35 +    status
    9.36      ;;
    9.37    restart)
    9.38 -    if [ -z "$(pidof ofonod)" ]; then
    9.39 +    if ! active_pidfile $PIDFILE ofonod ; then
    9.40        echo "$NAME is not running."
    9.41        exit 1
    9.42      fi
    9.43      echo -n "Restarting $DESC: $NAME... "
    9.44 -	rm -rf $PIDFILE
    9.45 +    rm -rf $PIDFILE
    9.46      kill $(pidof ofonod) &&
    9.47      sleep 2 &&
    9.48      $DAEMON $OPTIONS
    9.49      status
    9.50      ;;
    9.51    *)
    9.52 -	printf "\n\033[1mUsage:\033[0m /etc/init.d/%b [start|stop|restart]\n" \
    9.53 +    printf "\n\033[1mUsage:\033[0m /etc/init.d/%b [start|stop|restart]\n" \
    9.54  		"$(basename $0)"
    9.55      exit 1
    9.56      ;;
    10.1 --- a/wicd/stuff/wicd	Fri Nov 29 08:51:47 2013 +0000
    10.2 +++ b/wicd/stuff/wicd	Fri Nov 29 11:43:20 2013 +0000
    10.3 @@ -16,7 +16,7 @@
    10.4  
    10.5  case "$1" in
    10.6    start)
    10.7 -    if [ -f $PIDFILE ] ; then
    10.8 +    if active_pidfile $PIDFILE wicd ; then
    10.9        echo "$NAME already running."
   10.10        exit 1
   10.11      fi
   10.12 @@ -25,7 +25,7 @@
   10.13      status
   10.14      ;;
   10.15    stop)
   10.16 -    if [ ! -f $PIDFILE ] ; then
   10.17 +    if ! active_pidfile $PIDFILE wicd ; then
   10.18        echo "$NAME is not running."
   10.19        exit 1
   10.20      fi
   10.21 @@ -35,7 +35,7 @@
   10.22      status
   10.23      ;;
   10.24    restart)
   10.25 -    if [ ! -f $PIDFILE ] ; then
   10.26 +    if ! active_pidfile $PIDFILE wicd ; then
   10.27        echo "$NAME is not running."
   10.28        exit 1
   10.29      fi