slitaz-base-files rev 109

rc.shutdown --> rc.functions
author Christophe Lincoln <pankso@slitaz.org>
date Tue Mar 20 09:05:04 2012 +0100 (2012-03-20)
parents b43c75fab1f6
children d1457c979903
files rootfs/etc/init.d/rc.functions rootfs/etc/init.d/rc.shutdown rootfs/usr/lib/slitaz/httphelper
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/rootfs/etc/init.d/rc.functions	Tue Mar 20 09:05:04 2012 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/rc.functions: SliTaz boot scripts functions.
     1.6 +#
     1.7 +
     1.8 +# Status functions.
     1.9 +status() {
    1.10 +	echo -en "\\033[70G[ "
    1.11 +	if [ $? = 0 ]; then
    1.12 +		echo -en "\\033[1;32mOK"
    1.13 +	else
    1.14 +		echo -en "\\033[1;31mFailed"
    1.15 +	fi
    1.16 +	echo -e "\\033[0;39m ]"
    1.17 +}
    1.18 +
    1.19 +# Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON
    1.20 +active_pidfile()
    1.21 +{
    1.22 +	if [ ! -e $1 ]; then
    1.23 +		return 1
    1.24 +	elif grep -qs "Name:.$(basename $2)$" \
    1.25 +			/proc/$(sed 's/[^0-9]//g' < $1 | head -n 1)/status ; then
    1.26 +		return 0
    1.27 +	else
    1.28 +		rm -f $1
    1.29 +		return 2
    1.30 +	fi
    1.31 +}
     2.1 --- a/rootfs/etc/init.d/rc.shutdown	Sun Mar 18 00:56:03 2012 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,37 +0,0 @@
     2.4 -#!/bin/sh
     2.5 -# /etc/init.d/rc.shutdown - This script is used by /etc/inittab to stop
     2.6 -# all daemons and shutdown the system.
     2.7 -#
     2.8 -. /etc/init.d/rc.functions
     2.9 -. /etc/rcS.conf
    2.10 -
    2.11 -log=/var/lib/shutdown.log
    2.12 -
    2.13 -# Bold info message with uptime
    2.14 -clear && echo "System is going down for reboot or halt." > $log
    2.15 -uptime >> $log
    2.16 -
    2.17 -# Store last alsa settings.
    2.18 -if [ -x /usr/sbin/alsactl ]; then
    2.19 -	alsactl store
    2.20 -fi
    2.21 -
    2.22 -# Stop all daemons started at boot time.
    2.23 -for daemon in $RUN_DAEMONS
    2.24 -do
    2.25 -	if [ -x /etc/init.d/$daemon ]; then
    2.26 -		/etc/init.d/$daemon stop >> $log
    2.27 -	fi
    2.28 -done
    2.29 -
    2.30 -# Sync all filesystems.
    2.31 -sync
    2.32 -
    2.33 -# Swap off.
    2.34 -/sbin/swapoff -a
    2.35 -
    2.36 -# Kill all processes.
    2.37 -killall5
    2.38 -
    2.39 -# Umount filesystems.
    2.40 -/bin/umount -a -r 2>/dev/null
     3.1 --- a/rootfs/usr/lib/slitaz/httphelper	Sun Mar 18 00:56:03 2012 +0100
     3.2 +++ b/rootfs/usr/lib/slitaz/httphelper	Tue Mar 20 09:05:04 2012 +0100
     3.3 @@ -2,12 +2,12 @@
     3.4  #
     3.5  # SliTaz Helper for SHell CGI scripts - See httphelper function
     3.6  #
     3.7 -# The initial script was found in Busybox 1.18.4 but was removed upstream
     3.8 -# it is used in TazPanel, Pizza and other SliTaz CGI tools and services.
     3.9 -# The goal is to maintain it according to the needs of the project and 
    3.10 -# Busybox httpd server applet since it is used for URL [en|de]coding
    3.11 +# This helper is used in TazPanel, Pizza and other SliTaz CGI tools and 
    3.12 +# services. The goal is to maintain it according to the needs of the 
    3.13 +# project and Busybox httpd server applet since it is used for URL 
    3.14 +# [en|de]coding.
    3.15  #
    3.16 -# Copyright (C) SliTaz/Busybox 2012 - GNU gpl v2
    3.17 +# Copyright (C) SliTaz 2012 - GNU gpl v2
    3.18  #
    3.19  
    3.20  alias urlencode='httpd -e'