Cleanup of pre-systemd files

This commit is contained in:
Silvan Calarco 2021-08-26 10:02:15 +02:00
parent 42d74163a9
commit d640ac2700
90 changed files with 17 additions and 2259 deletions

View File

@ -1,5 +1,5 @@
# Makefile for openmamba initscripts # Makefile for openmamba initscripts
# Copyright (C) 2004-2013 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (C) 2004-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2004-2009 by Davide Madrisan <davide.madrisan@gmail.com> # Copyright (C) 2004-2009 by Davide Madrisan <davide.madrisan@gmail.com>
include VERSION include VERSION
@ -17,7 +17,6 @@ datadir = ${prefix}/share
initrddir = ${sysconfdir}/rc.d/init.d initrddir = ${sysconfdir}/rc.d/init.d
sysconfigdir= ${sysconfdir}/sysconfig sysconfigdir= ${sysconfdir}/sysconfig
localstatedir = /var localstatedir = /var
localesdir = ${datadir}/locale/
srcdir = . srcdir = .
@ -38,27 +37,16 @@ pck_catalogs := $(wildcard po/*.po)
.SUFFIXES: .po .mo .SUFFIXES: .po .mo
.po.mo:; msgfmt $< -o $@ .po.mo:; msgfmt $< -o $@
all: tools locales all: tools
locales: $(pck_catalogs:.po=.mo)
tools: tools:
make -C src make -C src
install-locales: locales
@for f in $(pck_catalogs); do\
lang=`echo $$f | sed 's,.*/\(.*\)\.po,\1,'`;\
echo "installing i18n file for language \`$$lang'...";\
dir="$(DESTDIR)$(localesdir)/$$lang/LC_MESSAGES";\
$(INSTALL_DIR) $$dir;\
$(INSTALL_DATA) $${f/.po/.mo} $$dir/$(PACKAGE).mo;\
done
install-tools: install-tools:
make install -C src make install -C src
install-dirs: install-dirs:
$(INSTALL_DIR) $(DESTDIR)/sbin $(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_DIR) $(DESTDIR)$(localstatedir)/run $(INSTALL_DIR) $(DESTDIR)$(localstatedir)/run
$(INSTALL_DIR) $(DESTDIR)$(localstatedir)/log $(INSTALL_DIR) $(DESTDIR)$(localstatedir)/log
$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/modules.d/ $(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/modules.d/
@ -66,15 +54,15 @@ install-dirs:
install-files: install-files:
touch $(DESTDIR)$(localstatedir)/log/{btmp,lastlog,wtmp} touch $(DESTDIR)$(localstatedir)/log/{btmp,lastlog,wtmp}
cp -a etc lib var usr $(DESTDIR) cp -a etc usr $(DESTDIR)
$(INSTALL_SCRIPT) sbin/* $(DESTDIR)/sbin install -d -m0755 $(DESTDIR)$(sysconfdir)/rc.d
for i in `seq 0 6`; do\ for i in `seq 0 6`; do\
install -d -m0755 $(DESTDIR)$(sysconfdir)/rc.d/rc$$i.d;\
ln -sf rc.d/rc$$i.d/ $(DESTDIR)$(sysconfdir)/rc$$i.d;\ ln -sf rc.d/rc$$i.d/ $(DESTDIR)$(sysconfdir)/rc$$i.d;\
done done
ln -sf rc.d/init.d/ $(DESTDIR)$(sysconfdir)/init.d ln -sf rc.d/init.d/ $(DESTDIR)$(sysconfdir)/init.d
ln -sf rc.d/rcsysinit.d/ $(DESTDIR)$(sysconfdir)/rcsysinit.d
install: install-dirs install-tools install-locales install-files install: install-dirs install-tools install-files
dist: clean dist: clean
@git log > ChangeLog.git @git log > ChangeLog.git

View File

@ -1,51 +0,0 @@
# /etc/inittab - main configuration file of /etc/init
#
# Copyright (c) 2003-2006 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2006 by Davide Madrisan <davide.madrisan@gmail.com>
#
# This is the main configuration file of /etc/init, which is executed
# by the kernel on startup.
# It describes what scripts are used for the different run-levels.
# All scripts for runlevel changes are in /etc/init.d/.
# this is the runlevel which should be entered after system boot
id:3:initdefault:
# first script to be executed during system boot
si::sysinit:/etc/rc.d/init.d/rc.sysinit
# /etc/init.d/rc takes care of runlevel handling:
# runlevel 0 -- system halt (do NOT use this for initdefault)
# runlevel 1 -- maintenance (single user) mode
# runlevel 2 -- local multiuser without remote network
# runlevel 3 -- full multiuser with network
# runlevel 4 -- not used
# runlevel 5 -- full multiuser with network and xdm
# runlevel 6 -- system reboot (do NOT use this for initdefault)
#
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
# what to do when init receives the SIGINT signal (CTRL-ALT-DEL)
# note: 'shutdown -a' to use /etc/shutdown.allow
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# what to do in single-user mode
su:S016:once:/sbin/sulogin
# agetty-programs for the normal runlevels
# note: the id field should be the tty suffix of the corresponding tty,
# e.g. 1 for tty1; otherwise, the login accounting might not work
# correctly
1:234:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600

View File

@ -1,91 +0,0 @@
#!/bin/sh
# checkfs - File System Check
# Based on checkfs script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
# Patch to handle all fsck variants by A. Luebke - luebke@users.sourceforge.net
# Modified and maintained for openmamba by Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc
. $rc_functions
if [ -f /fastboot ]; then
echo "Fast boot requested, will not perform file system checks"
exit 0
fi
echo -n "Checking file systems: "
$PLYMOUTH message --text=$"Checking file systems..."
if [ ! -e /run/initramfs/root-fsck ]; then
echo -n "Mounting root file system in read-only mode: "
mount -n -o remount,ro /
retval=$?
if [ $retval != 0 ]; then
$FAILURE
echo "Cannot check root file system because it could not"
echo "be mounted in read-only mode."
echo
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...operational error!"
echo_warning
echo
else
echo_success
echo
fi
fi
if [ -f /forcefsck ]; then
echo "/forcefsck exists, forcing file system check"
options="-f"
else
options=""
fi
# note: -a option used to be -p; but this fails e.g. on fsck.minix
fsck $options -a -A -C -T
retval=$?
if [ $retval -eq 0 ]; then
$PLYMOUTH message --text=$"Checking file systems...done"
echo_success
echo
elif [ $(($retval & 2)) -eq 2 ]; then
$WARNING
echo "File system errors were found and have been corrected, but"
echo "the nature of the errors require this system to be rebooted."
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...rebooting"
echo_warning
echo
$rc_base/init.d/reboot stop
elif [ $(($retval & 4)) -eq 4 ]; then
$WARNING
echo "File system errors were encountered that couldn't be"
echo "fixed automatically. The system will continue to boot but"
echo "errors need to be fixed manually by a system administrator."
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...unfixable errors"
echo_warning
echo
elif [ $(($retval & 1)) -eq 1 ]; then
$WARNING
echo "File system errors were found and have been corrected."
echo "You may want to double-check that everything was fixed"
echo -n "properly"
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...fixed"
echo_warning
echo
else
$FAILURE
echo "An internal error was encountered while checking file systems."
echo "This system will continue to boot but errors need to be fixed"
echo "by a system administrator."
$NORMAL
$PLYMOUTH message --text=$"Checking file systems...operational error!"" (retval=$retval)"
echo_warning
echo
fi

View File

@ -1,53 +0,0 @@
#!/bin/sh
# cleanfs - Clean file system
# Written by Gerard Beekmans <gerard@linuxfromscratch.org>
# Modified by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
echo -n "Removing lock files: "
find /var/run/ -type f -o -type s | xargs -n 1 rm -f
find /var/lock/ -type f -o -type s | xargs -n 1 rm -f
find /var/tmp/.*-lock -type f -o -type s 2>/dev/null | xargs -n 1 rm -f
evaluate_retval
echo
# remove files and directories located in /tmp at every boot
# (recommended by the FHS 2.3 specifications)
echo -n "Removing files and directories from /tmp: "
rm -fr /tmp/* 2>/dev/null
rm -f /tmp/.fam*
rm -f /tmp/.X*-lock
rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix
rm -rf /tmp/.wine-*
rm -f /var/log/kdm.log
evaluate_retval
echo
echo -n "Removing temporary files created by rpm: "
rm -f /var/lib/rpm/__db* >/dev/null 2>&1
evaluate_retval
echo
echo -n "Creating new /var/run/utmp: "
touch /var/run/utmp && chmod 644 /var/run/utmp
evaluate_retval
echo
# removing possible files /etc/nologin /fastboot /forcefsck
rm -f /etc/nologin /fastboot /forcefsck
# fix a KDE warning message to speed up applications startup
if [ -d /tmp/.ICE-unix ]; then
chown root:root /tmp/.ICE-unix
chmod 1777 /tmp/.ICE-unix
fi
# remove .ICEauthority in home directories to avoid permission problems at user login
for d in `getent passwd | cut -d: -f6`; do [ -e $d/.ICEauthority ] && rm -f $d/.ICEauthority; done
# remove apt cached packages
rm -f /var/cache/apt/archives/*.rpm
rm -f /var/cache/apt/archives/partial/*

View File

@ -1,38 +0,0 @@
#!/bin/sh
# console - Console init script with plymouth support
. /etc/sysconfig/rc
. $rc_functions
INITTY="0 1 2 3 4 5 6"
PLYMOUTHD=/sbin/plymouthd
PLYMOUTH=/bin/plymouth
[ -c /dev/zero ] || mknod -m 0666 /dev/zero c 1 5
[ -c /dev/ptmx ] || mknod -m 0666 /dev/ptmx c 5 2
for tty in 0 1 2 3 4 5 6; do
[ -c /dev/tty$tty ] || mknod -m 0620 /dev/tty$tty c 4 $tty
done
echo -n "Setting i18n, keyboard and console: "
for tty in $INITTY; do
/sbin/console_init tty$tty
done
evaluate_retval
echo
[ -e $PLYMOUTHD ] || exit 0
# do nothing if plymouth was already started in initramfs
pidof plymouthd >/dev/null && exit 0
echo -n "Starting plymouth daemon: "
[ -e /dev/systty ] || ln -s tty0 /dev/systty
[ -c /dev/fb0 ] || mknod -m 0660 /dev/fb0 c 29 0
[ -e /dev/fb ] || ln -s fb0 /dev/fb
mkdir -p -m 0755 /run/plymouth
$PLYMOUTHD --attach-to-session --pid-file /run/plymouth/pid
evaluate_retval
echo
$PLYMOUTH show-splash

View File

@ -1,21 +0,0 @@
#!/bin/sh
# halt - System halt
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
halt -d -f -i -p
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac

View File

@ -1,29 +0,0 @@
#!/bin/sh
# Copyright (C) 2004-2013 Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc
. $rc_functions
KERNELREL=`uname -r`
# check for modules existence or exit
[ -e /lib/modules/$KERNELREL/modules.dep ] || exit 0
[ -r /etc/modprobe.conf ] && modulesfile="/etc/modprobe.conf"
[ -d /etc/modprobe.d ] && modulesfile="$modulesfile /etc/modprobe.d/*.conf"
module_alias=`egrep "^(probeall|alias)( |\t)*on-boot-*( |\t)*" $modulesfile 2>/dev/null | gawk '{ print $2 }'`
module_name=`egrep "^(probeall|alias)( |\t)*on-boot-*( |\t)*" $modulesfile 2>/dev/null | gawk '{ print $3 }'`
for module in $module_name \
`cat /etc/modules 2>/dev/null | grep -v ^#`\
`cat /etc/modules-load.d/*.conf 2>/dev/null | grep -v ^#`; do
echo -n "Loading $module module: "
modprobe $module 2>&1
evaluate_retval
echo
done
[ -e /proc/ide/hd[a-z] ] && \
cat /proc/ide/hd[a-z]/media | \
grep cdrom >/dev/null && modprobe ide-cd 2>/dev/null || :

View File

@ -1,42 +0,0 @@
#!/bin/sh
# localnet - Loopback device
# Based on localnet script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
. /etc/sysconfig/rc
. $rc_functions
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
case "$1" in
start)
echo -n "Bringing up the loopback interface..."
ifconfig lo 127.0.0.1
[ $? -eq 0 ] && echo_success || echo_failure
echo
echo -n "Setting hostname to $HOSTNAME..."
hostname $HOSTNAME
[ $? -eq 0 ] && echo_success || echo_failure
echo
;;
stop)
echo -n "Bringing down the loopback interface..."
ifconfig lo down
[ $? -eq 0 ] && echo_success || echo_failure
echo
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
echo "Hostname is: $(hostname)"
ifconfig lo
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

View File

@ -1,58 +0,0 @@
#!/bin/sh
# mountfs - File System Mount Script
# Based on mountfs script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
# Modified by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
echo -n "Remounting root file system in read-write mode: "
mount -n -o remount,rw /
evaluate_retval
echo
# Dump dmesg to log file
dmesg > /var/log/dmesg.log
# Check that mtab is a symlink to /proc/mounts
[ -L /etc/mtab ] || {
rm -f /etc/mtab # delete if not a symlink
rm -f /etc/mtab~ /etc/mtab~~
ln -s /proc/mounts /etc/mtab
}
$PLYMOUTH --sysinit
# The follow mount command will mount all file systems. If you
# have other (network based) file system that should not be or
# cannot be mounted at this time, add them to the NO_FS variable
# below. All file systems that are added to the variable in the
# form of no<filesystem> will be skipped.
NO_FS="nonfs,nonfs4,nosmbfs,nocifs,noproc,nosysfs,nousbdevfs,nodevfs"
echo -n "Mounting remaining file systems: "
mount -a -t $NO_FS
evaluate_retval
echo
;;
stop)
echo -n "Unmounting all other currently mounted file systems: "
# [ -f /proc/bus/usb/devices ] && umount /proc/bus/usb >/dev/null 2>&1
# umount -l /proc
# umount -l /sys
NO_FS="nonfs,nonfs4,nosmbfs,nocifs,noproc,nosysfs,nousbdevfs,nodevfs"
sync
umount -a -f -r -t $NO_FS >/dev/null 2>&1
evaluate_retval
echo
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -1,47 +0,0 @@
#!/bin/sh
# mountproc - mount /proc and /sysfs (kernel 2.6.x only)
# Copyright (C) 2004-2011 Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2004-2009 Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
[ -e /etc/locale.conf ] && . /etc/locale.conf || . /etc/sysconfig/i18n
LC_ALL=$LANG
TEXTDOMAIN=initscripts
TEXTDOMAINDIR=/usr/share/locale/
if [ ! -e /proc/version ]; then
echo -n "Mounting proc file system: "
mount -n -t proc proc /proc
evaluate_retval
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
echo
fi
progress=5
$PLYMOUTH message --text=$"System booting, please wait..."
$PLYMOUTH update --status="$progress"
if [ ! -e /sys/kernel ]; then
echo -n "Mounting sys file system: "
mount -n -t sysfs sysfs /sys
evaluate_retval
echo
fi
if [ ! "`grep ' /dev ' /proc/mounts`" ]; then
[ "`grep devtmpfs /proc/filesystems`" ] && \
mount -n -t devtmpfs udev /dev || \
mount -n -t tmpfs udev /dev
fi
if [ ! "`grep ' /run ' /proc/mounts`" ]; then
mount -n -t tmpfs tmpfs /run
fi
if [ ! "`grep ' /dev/pts ' /proc/mounts`" ]; then
mkdir -p /dev/pts
mount -n -t devpts devpts /dev/pts -o gid=4,mode=620
fi
if [ ! "`grep ' /dev/shm ' /proc/mounts`" ]; then
mkdir -p /dev/shm
mount -n -t tmpfs devshm /dev/shm
fi

View File

@ -1,33 +0,0 @@
#!/bin/sh
# mountfs - File System Mount Script
# Based on mountfs script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
# Modified by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
NET_FS="nfs,smbfs,cifs"
echo -n "Mounting network file systems: "
mount -a -t $NET_FS
evaluate_retval
echo
;;
stop)
echo -n "Unmounting currently mounted network file systems: "
NET_FS="nfs,smbfs,cifs"
sync
umount -a -f -r -t $NET_FS >/dev/null 2>&1
evaluate_retval
echo
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

View File

@ -1,89 +0,0 @@
#! /bin/sh
# network - Network interfaces start/stop script
# Based on ethnet script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
# Modified by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# chkconfig: 2345 20 97
# description: Network interfaces start/stop script
. /etc/sysconfig/rc
. $rc_functions
. /etc/sysconfig/network
unset MAKEDEFAULT
case "$1" in
start)
if [ -x /usr/sbin/ifrename ] && [ -r /etc/iftab ]; then
echo -n "Renaming interfaces: "
ifrename -t
evaluate_retval
echo
fi
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/network_makefile_$$
trap "rm -f $tempfile" HUP INT QUIT ABRT KILL TERM
for file in `grep -il "ONBOOT=yes" $network_devices/ifcfg-* 2>/dev/null`; do
interface=$(basename $file | sed "s/ifcfg.//")
case "$interface" in
*~) ;;
*) parentinterface=$(echo $interface | sed s/:.*// )
targetinterface=$(echo $interface | sed s/:/-/ )
[ "$parentinterface" = "$targetinterface" ] && unset parentinterface
cat >> $tempfile << EOF
$targetinterface: $parentinterface
@$network_devices/ifup $interface
EOF
MAKEDEFAULT="$targetinterface $MAKEDEFAULT"
;;
esac
done
if [ "$MAKEDEFAULT" != "" ]; then
echo -n $"Bringing up interface(s): $MAKEDEFAULT"
echo "all: $MAKEDEFAULT" >> $tempfile
make -j -k -f $tempfile all 1>/dev/null
evaluate_retval
echo
fi
rm -f $tempfile
;;
stop)
if [ "$GATEWAY" != "" ]; then
echo -n "Removing default gateway: "
route del -net default
evaluate_retval
echo
fi
for file in `grep -il "ONBOOT=yes" $network_devices/ifcfg-* 2>/dev/null`; do
interface=$(basename $file | sed s/ifcfg-//)
case "$interface" in
*~) ;;
*) echo -n $"Bringing down the $interface interface: "
$network_devices/ifdown $interface
evaluate_retval
echo
;;
esac
done
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
[ -x /sbin/ifconfig ] && /sbin/ifconfig || :
for wint in $(find /sys/class/net/wlan[0-9]* \
-maxdepth 0 -type d -printf "%f " 2>/dev/null); do
/usr/sbin/iwconfig $wint
done
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

View File

@ -1,159 +0,0 @@
#! /bin/sh
#
# network-functions: Network functions script for openmamba
#
# Copyright (c) 2003-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2005,2011 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
# ip_check_args()
#
# parameters:
# $1 : ip/bitmask (like 192.168.0.1/24) -or-
# $1 $2 : ip netmask (like 192.168.0.1 255.255.255.0)
# description:
# This function checks if its first / first two arguments are
# a valid ipv4 address.
# If it is a valid one, returns '1' and set the variables
# $ip (ip address)
# $mask_bit (number of active bits in the maks)
# $mask (mask)
# otherwise returns '0'
ip_check_args ()
{
local i
# checks if the first argument is a valid one, that is something
# like "192.168.0.1" or "192.168.0.1/24"
if ! echo $1 | grep -Eq "^([0-9]+\.){3}[0-9]+(/[0-9]+){0,1}$"; then
return 0
fi
ip=`echo $1 | cut -f1 -d/`
for i in `seq 1 4`; do # check for range in [0..255]
local byte=`echo $ip | cut -f$i -d.`
[ $byte -le 255 ] || return 0
done
# gets the mask from $1, if $1 is like '192.168.0.1/24',
# otherwise 'mask_bit' is set to ""
mask_bits=`echo $1 | cut -f2 -s -d/`
if [ $mask_bits ]; then # 'mask_bit' is not ""
[ $mask_bits -le 32 ] || return 0 # illegal 'mask_bit'
# set 'mask'. i.e. mask_bits = 24 --> mask = 255.255.255.0
local mb=$mask_bits
for i in `seq 1 4`; do
if [ $mb -ge 8 ]; then
mask=$mask"255"
mb=$(($mb - 8))
else
mask=$mask$(( 256 - (2 << (7-$mb)) ))
[ $mb -gt 0 ] && mb=0
fi
[ $i -lt 4 ] && mask=$mask"."
done
else # $2 should be a network mask (like 255.255.255.0)
if ! echo $2 | grep -Eq "^([0-9]+\.){3}[0-9]+$"; then
return 0
fi
mask=$2
local prev_byte=255
local prev_bit=1
mask_bits=0
for i in `seq 1 4`; do
local byte=`echo $mask | cut -f$i -d.`
[ $byte -gt 255 ] && return 0
# if the previous was < 255, the current one must be 0
[ $prev_byte -lt 255 -a $byte -ne 0 ] && return 0
# internal loop to set 'mask_bits'
for j in `seq 7 0`; do
local bit_value=$(( ($byte >> j) & 1 ))
# if the previous bit was '0', the current can't be '1'
[ $prev_bit -eq 0 -a $bit_value -eq 1 ] && return 0
[ $bit_value -eq 1 ] && mask_bits=$(( $mask_bits + 1 ))
prev_bit=$bit_value
done
prev_byte=$byte
done
fi
return 1
}
# calculate_ip_parameters()
#
# parameters:
# $1 : ip
# $2 : netmask
# description:
# This function set the variables
# $network (network address)
# $broadcast (broadcast address)
# $wildcard (wildcard mask)
# calculated using as input the ip/network address $1/$2.
# If $1/$2 is a valid ipv4 address, returns '0', otherwise
# returns '1'
calculate_ip_parameters ()
{
local i
unset network broadcast wildcard
ip_check_args $1 $2
[ $? -eq 0 ] && return 1
for i in 1 2 3 4; do
ip_byte=`echo $ip | cut -f$i -d.`
mask_byte=`echo $mask | cut -f$i -d.`
ip_and_mask=$(( $ip_byte & $mask_byte ))
mask_cplm=$(( 255 - $mask_byte ))
wildcard=$wildcard$mask_cplm
network=$network$ip_and_mask
broadcast=$broadcast$((ip_and_mask + mask_cplm))
if [ $i -lt 4 ]; then
network=$network"."
broadcast=$broadcast"."
wildcard=$wildcard"."
fi
done
return 0
}
# get_interface_parameters()
#
# parameters:
# $1 : interface name (i.e. eth0)
# description:
# If no error occurs, this function return '0' and set the variables
# $int_ip
# $int_netmask
# $int_network
# $int_broadcast
# $int_static_ip (0: static IP; 1: dynamic IP (DHCP))
# to the system values found for interface $1, otherwise returns '1'
get_interface_parameters ()
{
local int_name="$1"
[ x"$int_name" != x ] || return 1
int_ip=`/sbin/ifconfig $int_name 2>/dev/null | \
sed -n '/inet addr/{s,.*inet addr:\([^ \t]*\).*,\1,;p}'`
int_broadcast=`/sbin/ifconfig $int_name 2>/dev/null | \
sed -n '/inet addr:.*Bcast:/{s,.*Bcast:\([^ \t]*\).*,\1,;p}'`
int_netmask=`/sbin/ifconfig $int_name 2>/dev/null | \
sed -n '/inet addr:.*Mask:/{s,.*Mask:\([^ \t]*\).*,\1,;p}'`
# note: loopback interface has null 'int_broadcast' value
[ -z "$int_ip" -o -z "$int_netmask" ] && return 1
int_static_ip=1
# this check was written to avoid backward compatibility issues
if [ -r $network_devices/ifcfg-$int_name ]; then
if grep -Eq "^BOOTPROTO=dhcp" $network_devices/ifcfg-$int_name; then
int_static_ip=0
fi
fi
calculate_ip_parameters "$int_ip" "$int_netmask"
int_network=$network
return 0
}

View File

@ -1,49 +0,0 @@
#!/bin/sh
# random - save system entropy pool at shutdown and reload it at boot time
# to increase the quality of random number generation
[ -c /dev/urandom ] || exit 0
. /etc/sysconfig/rc
. $rc_functions
PATH=/sbin:/usr/sbin:/bin:/usr/bin
RANDOMSEED=/var/lib/misc/random-seed
POOLSIZE=512
[ -r /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
case "$1" in
start)
echo -n $"Initializing random number generator: "
if [ -f $RANDOMSEED ]; then
cat $RANDOMSEED > /dev/urandom
else
touch $RANDOMSEED
fi
chmod 600 $RANDOMSEED
dd if=/dev/urandom of=$RANDOMSEED count=1 bs=$POOLSIZE >/dev/null 2>&1
evaluate_retval
echo
;;
stop)
echo -n $"Saving random seed: "
touch $RANDOMSEED
chmod 600 $RANDOMSEED
dd if=/dev/urandom of=$RANDOMSEED count=1 bs=$POOLSIZE >/dev/null 2>&1
evaluate_retval
echo
;;
status)
echo -n $"Checking for random generator: "
echo_success
echo
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
*) echo "Usage: $0 start|stop|status"
exit 1
;;
esac

View File

@ -1,170 +0,0 @@
#!/bin/sh
# rc - Main Run Level Control Script
#
# Copyright (c) 2003-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009,2011-2012 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
if [ -r $rc_base/init.d/rc.embedded ]; then
. $rc_base/init.d/rc.embedded
exit 0
fi
. $rc_functions
[ -e /etc/locale.conf ] && . /etc/locale.conf || . /etc/sysconfig/i18n
LC_ALL=$LANG
TEXTDOMAIN=initscripts
TEXTDOMAINDIR=/usr/share/locale/
HOME="/root"; export HOME
trap "" INT QUIT TSTP
# detect kernel command line parameters
# $CMDLINE is exported from mkinitramfs
[ -z "$CMDLINE" ] && CMDLINE="`cat /proc/cmdline 2>/dev/null`"
debug=0
for cmd in $CMDLINE; do
case "$cmd" in
debug) debug=1 ;;
debug=*) debug=${cmd/debug=/} ;;
multithread=*) multithread=${cmd/multithread=/} ;;
esac
done
[ $debug -gt 0 ] && {
MAKEADD="DEBUG=1"
LOGFILE=/dev/console
}
# set current (new) and previous runlevels
runlevel=$1; export runlevel
previous=${PREVLEVEL:-N}
rex="[0-9][0-9]"
[ "$runlevel" ] ||
{ echo "Usage: $0 <runlevel>" >&2; exit 1; }
[ -d $rc_base/rc$runlevel.d ] ||
{ echo $"$rc_base/rc$runlevel.d does not exist" >&2; exit 1; }
[ "$previous" = "$runlevel" ] && exit 0
export RUNLEVEL
[ "$previous" != "N" ] && progressbase=10 || progressbase=65
if [ "$runlevel" = "0" -o "$runlevel" = "6" ]; then
$PLYMOUTHD --attach-to-session
$PLYMOUTH --show-splash
if [ "$runlevel" = "0" ]; then
$PLYMOUTH message --text=$"System shutting down, please wait..."
else
$PLYMOUTH message --text=$"System rebooting, please wait..."
fi
else
[ -e /run/plymouth/pid ] || {
# workaround for plymouthd stopping at runlevel change with non-KMS drivers
$PLYMOUTHD --attach-to-session --pid-file /run/plymouth/pid
$PLYMOUTH --show-splash
WORKAROUND=1
}
$PLYMOUTH message --text=$"Starting services..."
fi
if [ "$runlevel" == "5" -a "$previous" == "N" ]; then
[ -e /run/plymouth/pid ] && touch /var/spool/gdm/force-display-on-active-vt
else
rm -f /var/spool/gdm/force-display-on-active-vt || true
fi
allservicesnum=`ls -1 $rc_base/rc$runlevel.d/[S,K]* 2>/dev/null | wc -l`
if [ "$previous" != "N" ]; then
if [ "$multithread" = "1" ]; then
/bin/echo -e $"Stopping runlevel $runlevel services...""\r" >&2
make -C /var/init --no-print-directory -i -j -f /var/init/runlevel.mk \
JOB=stop \
PROGRESS_TOT=${allservicesnum} \
PROGRESS_BASE=${progressbase} \
ALLSERVICESNUM=$allservicesnum $MAKEADD
else
[ $debug -eq 0 ] && {
LOGFILE=/var/log/initd.$runlevel.stop
> $LOGFILE
}
i=0
for servicefile in `ls $rc_base/rc$runlevel.d/K* 2>/dev/null`; do
check_link $servicefile &&
{ service=${servicefile#$rc_base/rc$runlevel.d/K$rex}
prev_start=$rc_base/rc$previous.d/S$rex$service
sysinit_start=$rc_base/rcsysinit.d/S$rex$service
if [ "$runlevel" != "0" ] && [ "$runlevel" != "6" ]; then
[ ! -f $prev_start ] && [ ! -f $sysinit_start ] && continue
fi
progress=`expr $progressbase + $i \* \( 100 - $progressbase \) / ${allservicesnum}`
[ -w $LOGFILE ] && $servicefile stop >> $LOGFILE || $servicefile stop
i=`expr $i + 1`
}
done
[ "$progress" ] && progressbase=$progress
fi
fi
echo -e $"Starting runlevel $runlevel services...""\r"
if [ "$multithread" = "1" ]; then
# recreate multithreaded dependencies
depinit >/dev/null 2>&1
# now start multithreaded init
rm -f /var/lock/subsys/local
make -C /var/init --no-print-directory -i -j -k -f /var/init/runlevel.mk \
JOB=start \
PROGRESS_TOT=${allservicesnum} \
PROGRESS_BASE=${progressbase} \
$MAKEADD 2>/dev/null &
while [ ! -e /var/lock/subsys/local ]; do
[ "`jobs`" ] || break
sleep 1
done
else
[ $debug -eq 0 ] && {
LOGFILE=/var/log/initd.$runlevel.start
> $LOGFILE
}
i=0
for servicefile in `ls $rc_base/rc$runlevel.d/S* 2> /dev/null`; do
check_link $servicefile || { i=`expr $i + 1`; continue; }
if [ "$previous" != "N" ]; then
service=${servicefile#$rc_base/rc$runlevel.d/S$rex}
stop=$rc_base/rc$runlevel.d/K$rex$service
prev_start=$rc_base/rc$previous.d/S$rex$service
[ -f $prev_start ] && [ ! -f $stop ] && continue
fi
progress=`expr $progressbase + $i \* \( 100 - $progressbase \) / ${allservicesnum}`
$servicefile start >> $LOGFILE
i=`expr $i + 1`
done
fi
if [ ! "$runlevel" = "5" ]; then
chvt 1
$PLYMOUTH quit
else
$PLYMOUTH message --text=""
if [ "$WORKAROUND" ]; then
# FIXME: when plymouth crashes and is restarted above the ENTER key X restart bug
# comes back if not quit
$PLYMOUTH quit
fi
fi

View File

@ -1,104 +0,0 @@
#!/bin/sh
# rc.sysinit - System initialization control script
# Copyright (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Modified by Davide Madrisan <davide.madrisan@gmail.com>
#
. /etc/sysconfig/rc
# first look for an embedded rc.sysinit
if [ -r $rc_base/init.d/rc.sysinit.embedded ]; then
. $rc_base/init.d/rc.sysinit.embedded
exit 0
fi
. $rc_functions
[ -e /etc/locale.conf ] && . /etc/locale.conf || . /etc/sysconfig/i18n
LC_ALL=$LANG
TEXTDOMAIN=initscripts
TEXTDOMAINDIR=/usr/share/locale/
trap "" INT QUIT TSTP
runlevel=sysinit
rex="[0-9][0-9]"
# detect kernel command line parameters
# $CMDLINE may be exported from mkinitramfs
[ "$CMDLINE" ] || {
[ -e /proc/cmdline ] || {
mount -n -t proc proc /proc
fin=/proc/cmdline
}
[ "$fin" -a -e $fin ] && CMDLINE="`cat $fin`" || CMDLINE=""
}
debug=0 # debug must be defined
for cmd in $CMDLINE; do
case "$cmd" in
debug) debug=1 ;;
debug=*) debug=${cmd/debug=/} ;;
esac
done
[ $debug -gt 0 ] && logfile="/dev/console" || logfile="/dev/null"
if [ ! -d $rc_base/rc$runlevel.d ]; then
echo $"$rc_base/rc$runlevel.d does not exist"
exit 1
fi
# set dns-resolving safe hostname for sysinit to successfully run
hostname localhost
startservices="`ls -1 $rc_base/rc$runlevel.d/S* 2>/dev/null`"
startservicesnum=`echo $startservices | wc -w`
i=0
for servicefile in $startservices; do
# write log to file as soon as writable filesystem is available
[ $logfile = "/dev/null" -a -w "/run" ] && {
logfile="/run/.sysinit.start"
> $logfile
}
if [ "$previous" != "N" ]; then
service=${servicefile#$rc_base/rc$runlevel.d/S$rex}
stop=$rc_base/rc$runlevel.d/K$rex$service
prev_start=$rc_base/rc$previous.d/S$rex$service
[ -f "$prev_start" ] && [ ! -f "$stop" ] && continue
fi
check_link $servicefile || continue
[ -x /bin/date ] &&
echo $"Begin sysinit $service at `/bin/date`" >> $logfile
progress=`expr 5 + $i \* 45 / $startservicesnum`
$PLYMOUTH update --status="$progress"
if [ "$service" = "postplug" ]; then
$servicefile start
else
$servicefile start >> $logfile 2>&1
fi
error_value=$?
if [ $error_value -ne 0 ]; then
echo "
You should not be reading this error message.
It means that an unforseen error took place in $servicefile,
which exited with a return value of $error_value
" >> $logfile
fi
[ -x /bin/date ] &&
echo $"End sysinit $service at `/bin/date`" >> $logfile
i=`expr $i + 1`
done
# rootfs should now be mounted rw, we can move logs there and umount tmpfs...
[ $debug -eq 0 ] && mv $logfile /var/log/initd.sysinit.start
# ...and remove garbage temp files
rm -f /tmp/.runlevel.start.* 2>/dev/null
rm -f /var/lock/subsys/local

View File

@ -1,23 +0,0 @@
#!/bin/sh
# reboot - System Reboot
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
reboot -d -f -i
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:

View File

@ -1,33 +0,0 @@
#!/bin/sh
# sendsignals - Sendsignals Script
#
# Based on sendsignals script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans <gerard@linuxfromscratch.org>
# Support for 2.6.x kernels by Davide Madrisan <davide.madrisan@gmail.com>
# Also modified by Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc
. $rc_functions
case "${1}" in
stop)
echo -n "Sending all processes the TERM signal..."
killall5 -15
error_value=$?
[ "$error_value" = 0 ] && echo_success || echo_failure
echo
sleep 2
echo -n "Sending all processes the KILL signal: "
killall5 -9
error_value=$?
[ "$error_value" = 0 ] && echo_success || echo_failure
echo
sleep 2
;;
*)
echo "Usage: ${0} {stop}"
exit 1
;;
esac

View File

@ -1,52 +0,0 @@
#!/bin/sh
# setclock - setting Linux clock
# Based on setclock script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
[ -e /proc/driver/rtc ] || exit 0
. /etc/sysconfig/rc
. $rc_functions
[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock
CLOCKPARAMS="--directisa"
case "$UTC" in
yes|true|1)
CLOCKPARAMS="$CLOCKPARAMS --utc"
;;
no|false|0)
CLOCKPARAMS="$CLOCKPARAMS --localtime"
;;
esac
case "$1" in
start)
echo -n "Setting clock: "
hwclock --hctosys $CLOCKPARAMS
evaluate_retval
echo
Y=`date +%Y`
[ $Y -gt 2010 ] || {
echo -n "Fixing broken hardware clock: "
date -s 2010/01/01
evaluate_retval
echo
}
;;
stop)
echo -n "Setting clock: "
hwclock --systohc $CLOCKPARAMS
evaluate_retval
echo
;;
status)
hwclock $CLOCKPARAMS
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac

View File

@ -1,34 +0,0 @@
#!/bin/sh
# swap - swap control script
# Written by Gerard Beekmans <gerard@linuxfromscratch.org>
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
echo -n "Activating all swap files/partitions: "
swapon -a
evaluate_retval
echo
;;
stop)
echo -n "Deactivating all swap files/partitions: "
swapoff -a
evaluate_retval
echo
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
echo -n "Retrieving swap status..."
echo
swapon -s
;;
*) echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac

View File

@ -1,14 +0,0 @@
#!/bin/sh
# sysctl - System initialization control script
#
# Written by Silvan Calarco <silvan.calarco@mambasoft.it>
. /etc/sysconfig/rc
. $rc_functions
trap "" INT QUIT TSTP
echo -n "Configuring kernel parameters: "
sysctl -p /etc/sysctl.conf >/dev/null 2>&1
evaluate_retval
echo

View File

@ -1,89 +0,0 @@
#!/bin/sh
# sysinit - System initialization control script
#
# Copyright 2003-2010 (C) Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright 2004-2007,2011 (C) Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
KERNELVER=`uname -r`
trap "" INT QUIT TSTP
if [ ! -L /dev/root ]; then
rootdev=
rootuuid=
for token in `cat /proc/cmdline 2>/dev/null`; do
set -- $token
case "$1" in
root=UUID=*)
rootuuid="${1##*=}"
[ -L /dev/disk/by-uuid/$rootuuid ] &&
rootdev=$(readlink -f /dev/disk/by-uuid/$rootuuid 2>/dev/null) ;;
root=*) rootdev="${1##*=}" ;;
esac
done
if [ -b "$rootdev" ]; then
rm -f /dev/root # to prevent duplicate entries
echo -n "Creating root device link on /dev: "
ln -s $rootdev /dev/root
evaluate_retval
echo
fi
fi
[ -e /lib/modules/$KERNELVER ] || mkdir -p /lib/modules/$KERNELVER
if [ ! "$no_auto_depmod" ]; then
DEPMOD_NEEDED="`find /lib/modules/$KERNELVER -type d -cnewer /lib/modules/$KERNELVER/modules.dep`"
if [ "$DEPMOD_NEEDED" -o ! -s /lib/modules/$KERNELVER/modules.dep ]; then
echo -n "Updating modules dependencies: "
depmod -a
evaluate_retval
echo
fi
fi
if [ ! "$no_auto_ldconfig" ]; then
# do some tests to check if ld.so should rebuild its cache
if [ -s /etc/ld.so.cache ]; then
LIBDIRS="/lib /usr/lib /usr/local/lib"
LIB64DIRS="/lib64 /usr/lib64 /usr/local/lib64"
for DIR in $LIBDIRS $LIB64DIRS \
`LANG=C grep -he "^/.*" \
/etc/ld.so.conf /etc/ld.so.conf.d/* 2>/dev/null`; do
if [ -x /sbin/ldconfig -a $DIR -nt /etc/ld.so.cache ]; then
echo -n "Setting up linker cache using ldconfig: "
/sbin/ldconfig 2>&1
evaluate_retval
echo
break
fi
done
fi
fi
if [ -w /usr/src -a -e /usr/src/linux-$KERNELVER ]; then
echo -n "Creating current kernel sources symlink /usr/src/linux: "
[ -L /usr/src/linux ] && rm -f /usr/src/linux
ln -s linux-$KERNELVER /usr/src/linux
evaluate_retval
echo
fi
if [ -e /boot/vmlinuz-$KERNELVER -a -w /boot ]; then
echo -n "Creating current kernel symlinks in /boot: "
if [ -e /boot/vmlinuz-$KERNELVER ]; then
[ -L /boot/vmlinuz ] && rm -f /boot/vmlinuz
ln -s vmlinuz-$KERNELVER /boot/vmlinuz
fi
if [ -e /boot/initramfs-$KERNELVER.img ]; then
[ -L /boot/initramfs.img ] && rm /boot/initramfs.img
ln -s initramfs-$KERNELVER.img /boot/initramfs.img
fi
evaluate_retval
echo
fi

View File

@ -1,50 +0,0 @@
#!/bin/sh
#
# chkconfig: 2345 xx xx
# description: ...
. /etc/sysconfig/rc
. $rc_functions
NAME=service
DAEMON=/usr/sbin/$NAME
DAEMONPID=/var/run/$NAME.pid
DAEMONLOCK=/var/lock/subsys/$NAME
OPTIONS=
[ -x $DAEMON ] || exit 0
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
case "$1" in
start)
echo -n $"Starting"" $NAME: "
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
echo
;;
stop)
echo -n $"Stopping"" $NAME: "
killproc -p $DAEMONPID $DAEMON -TERM
echo
;;
reload)
echo -n $"Reloading"" $NAME: "
reloadproc $DAEMON
echo
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
condrestart)
[ -e "$DAEMONLOCK" ] && $0 restart || :
;;
status)
statusproc $DAEMON
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|reload|restart|force-reload|condrestart|status}"
exit 1
;;
esac

View File

@ -1 +0,0 @@
../init.d/setclock

View File

@ -1 +0,0 @@
../init.d/netfs

View File

@ -1 +0,0 @@
../init.d/random

View File

@ -1 +0,0 @@
../init.d/sendsignals

View File

@ -1 +0,0 @@
../init.d/mountfs

View File

@ -1 +0,0 @@
../init.d/swap

View File

@ -1 +0,0 @@
../init.d/localnet

View File

@ -1 +0,0 @@
../init.d/halt

View File

@ -1 +0,0 @@
../init.d/sysinit

View File

@ -1 +0,0 @@
../init.d/random

View File

@ -1 +0,0 @@
../init.d/sysinit

View File

@ -1 +0,0 @@
../init.d/rc.local

View File

@ -1 +0,0 @@
../init.d/random

View File

@ -1 +0,0 @@
../init.d/sysinit

View File

@ -1 +0,0 @@
../init.d/netfs

View File

@ -1 +0,0 @@
../init.d/rc.local

View File

@ -1 +0,0 @@
../init.d/sysinit

View File

@ -1 +0,0 @@
../init.d/netfs

View File

@ -1 +0,0 @@
../init.d/rc.local

View File

@ -1 +0,0 @@
../init.d/random

View File

@ -1 +0,0 @@
../init.d/sysinit

View File

@ -1 +0,0 @@
../init.d/netfs

View File

@ -1 +0,0 @@
../init.d/rc.local

View File

@ -1 +0,0 @@
../init.d/setclock

View File

@ -1 +0,0 @@
../init.d/netfs

View File

@ -1 +0,0 @@
../init.d/random

View File

@ -1 +0,0 @@
../init.d/sendsignals

View File

@ -1 +0,0 @@
../init.d/mountfs

View File

@ -1 +0,0 @@
../init.d/swap

View File

@ -1 +0,0 @@
../init.d/network

View File

@ -1 +0,0 @@
../init.d/localnet

View File

@ -1 +0,0 @@
../init.d/reboot

View File

@ -1 +0,0 @@
../init.d/mountproc

View File

@ -1 +0,0 @@
../init.d/console

View File

@ -1 +0,0 @@
../init.d/localnet

View File

@ -1 +0,0 @@
../init.d/sysctl

View File

@ -1 +0,0 @@
../init.d/loadmodules

View File

@ -1 +0,0 @@
../init.d/setclock

View File

@ -1 +0,0 @@
../init.d/checkfs

View File

@ -1 +0,0 @@
../init.d/mountfs

View File

@ -1 +0,0 @@
../init.d/cleanfs

View File

@ -1 +0,0 @@
../init.d/swap

0
etc/rc.d/init.d/functions → etc/sysconfig/functions Executable file → Normal file
View File

View File

@ -1,3 +0,0 @@
# DEPRECATION WARNING:
# this file is deprecated and provided empty only for legacy init scripts which expect to find it or fail
NETWORKING=yes

View File

@ -1 +0,0 @@
/sbin/ifdown

View File

@ -1 +0,0 @@
/sbin/ifup

View File

@ -1,15 +0,0 @@
#!/bin/sh
# adds static routes which go through device $1
DEVICE="$1"
if [ -z "${DEVICE}" ]; then
echo $"usage: ifup-routes <net-device>"
exit 1
fi
[ -r /etc/sysconfig/static-routes ] || exit 0
grep -v "^#\|^[ \t]*$" /etc/sysconfig/static-routes | while read dev args; do
[ "$dev" = "${DEVICE}" ] && /sbin/route add ${args} dev ${dev}
done

View File

@ -1,169 +0,0 @@
#!/bin/sh
# Copyright (c) 2003-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009,2013 by Davide Madrisan <davide.madrisan@gmail.com>
# Only meant to be called from ifup.
# Configure wireless network device options.
# Valid variables:
# WIRELESS_ESSID
# WIRELESS_MODE
# WIRELESS_ENCMODE:
# WIRELESS_NWID
# WIRELESS_CHANNEL
# WIRELESS_FREQUENCY
# WIRELESS_AP
# WIRELESS_FREQ
# WIRELESS_RATE
# WIRELESS_ENC
unset WIRELESS_OPTS WIRELESS_OPTS2
if [ "$WIRELESS_ESSID" ]; then
tmpfile=`tempfile 2>/dev/null`
tmpfile1=`tempfile 2>/dev/null`
if [ "$tmpfile" ]; then
ifconfig ${DEVICE} up
unset vname found_essid
# Note: iwlist scan essid option does not work with all drivers
# (see man iwlist) so we split cell information below
iwlist ${DEVICE} scan essid $WIRELESS_ESSID > $tmpfile
# Note: sometimes iwlist scan fails with "Device or resource busy",
# so we try again
[ -s $tmpfile ] ||
{ ifconfig ${DEVICE} down
ifconfig ${DEVICE} up
iwlist ${DEVICE} scan essid $WIRELESS_ESSID > $tmpfile; }
while read line; do
if [ "${line:0:5}" = "Cell " ]; then
[ "$found_essid" ] && break || > $tmpfile1
fi
echo $line >> $tmpfile1
[ "$line" = "ESSID:\"$WIRELESS_ESSID\"" ] && found_essid=1
done < $tmpfile
> $tmpfile
while read line; do
vname=${line/:*}
if [ "${line:0:4}" = "Cell" ]; then
vname="${line/* }"
vval=${line/*Address:}
vname="Address"
elif [ "${line/Unknown:}" != "$line" ]; then
continue
else
vname=${line/:*}
vname=`echo ${vname} | tr ' ' _`
vname=${vname/_(1)}
vval=${line/*:}
fi
vname=WIRELESS_AUTO_${vname/* }
vval=${vval/ }
vval=\"${vval/GHz*}\"
if [ "$vname" = "WIRELESS_AUTO_Mode" -o \
"$vname" = "WIRELESS_AUTO_Channel" -o \
"$vname" = "WIRELESS_AUTO_Address" -o \
"$vname" = "WIRELESS_AUTO_Frequency" -o \
"$vname" = "WIRELESS_AUTO_IE" -o \
"$vname" = "WIRELESS_AUTO_Group_Cipher" -o \
"$vname" = "WIRELESS_AUTO_Pairwise_Ciphers" -o \
"$vname" = "WIRELESS_AUTO_Authentication_Suites" ]; then
echo $vname=$vval >> $tmpfile
fi
done < $tmpfile1
. $tmpfile
else
echo "\
Warning: unable to create temporary file; skipping wireless autodetection"
fi
rm -f $tmpfile $tmpfile1
fi
[ "$WIRELESS_ENCMODE" ] || WIRELESS_ENCMODE="open"
[ "$WIRELESS_MODE" ] && WIRELESS_OPTS="$WIRELESS_OPTS mode $WIRELESS_MODE"
[ "$WIRELESS_ESSID" ] && WIRELESS_OPTS="$WIRELESS_OPTS essid $WIRELESS_ESSID"
[ "$WIRELESS_NWID" ] && WIRELESS_OPTS="$WIRELESS_OPTS nwid $WIRELESS_NWID"
if [ "$WIRELESS_CHANNEL" ]; then
WIRELESS_OPTS="$WIRELESS_OPTS channel $WIRELESS_CHANNEL"
elif [ "$WIRELESS_AUTO_Channel" ]; then
WIRELESS_OPTS="$WIRELESS_OPTS channel $WIRELESS_AUTO_Channel"
fi
if [ "$WIRELESS_FREQUENCY" ]; then
WIRELESS_OPTS="$WIRELESS_OPTS freq $WIRELESS_FREQUENCY"
elif [ "$WIRELESS_AUTO_Frequency" ]; then
WIRELESS_OPTS="$WIRELESS_OPTS freq ${WIRELESS_AUTO_Frequency}G"
fi
if [ "$WIRELESS_AP" ]; then
WIRELESS_OPTS2="$WIRELESS_OPTS2 ap $WIRELESS_AP"
elif [ "$WIRELESS_AUTO_Address" ]; then
WIRELESS_OPTS2="$WIRELESS_OPTS2 ap $WIRELESS_AUTO_Address"
fi
[ "$WIRELESS_FREQ" ] && WIRELESS_OPTS2="$WIRELESS_OPTS2 freq $WIRELESS_FREQ"
[ "$WIRELESS_RATE" ] && WIRELESS_OPTS2="$WIRELESS_OPTS2 rate $WIRELESS_RATE"
# Note: WIRELESS_ENC must appear as the last option
[ "$WIRELESS_ENC" -a "${WIRELESS_AUTO_IE:0:3}" != "WPA" ] &&
WIRELESS_OPTS="$WIRELESS_OPTS key $WIRELESS_ENCMODE $WIRELESS_ENC"
if [ "$WIRELESS_ESSID" -o "$WIRELESS_ENC" ]; then
echo -n "Setting wireless options for ${DEVICE}: "
ifconfig ${DEVICE} down
iwconfig ${DEVICE} $WIRELESS_OPTS
[ "$WIRELESS_OPTS2" ] && iwconfig ${DEVICE} $WIRELESS_OPTS2
evaluate_retval
echo
if [ "${WIRELESS_AUTO_IE:0:3}" = "WPA" -a ! -e /var/run/wpa_supplicant/${DEVICE} ]; then
echo -n "Setting WPA options for ${DEVICE}: "
[ "$WIRELESS_AUTO_Authentication_Suites" ] ||
WIRELESS_AUTO_Authentication_Suites=PSK
[ "$WIRELESS_AUTO_Pairwise_Ciphers" ] ||
WIRELESS_AUTO_Pairwise_Ciphers=TKIP
[ "$WIRELESS_AUTO_Group_Cipher" ] ||
WIRELESS_AUTO_Group_Cipher=TKIP
if [ "${WIRELESS_ENC:0:2}" = "s:" ]; then
WPA_PSK=\"${WIRELESS_ENC/s:}\"
else
WPA_PSK=${WIRELESS_ENC}
fi
tmpfile1=`tempfile 2>/dev/null`
cat >> $tmpfile1 << _EOF
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=0
ssid="$WIRELESS_ESSID"
proto=WPA
key_mgmt=WPA-$WIRELESS_AUTO_Authentication_Suites
pairwise=$WIRELESS_AUTO_Pairwise_Ciphers
group=$WIRELESS_AUTO_Group_Cipher
psk=$WPA_PSK
}
_EOF
wpa_supplicant -Dwext -i${DEVICE} -c $tmpfile1 -B
evaluate_retval
echo
rm -f $tmpfile1
fi
fi

View File

@ -2,7 +2,4 @@
# this file is deprecated and provided only for legacy init scripts which expect to find it or fail # this file is deprecated and provided only for legacy init scripts which expect to find it or fail
rc_base=/etc/rc.d rc_base=/etc/rc.d
rc_functions=$rc_base/init.d/functions rc_functions=/etc/sysconfig/functions
rc_networkfunctions=$rc_base/init.d/network-functions
network_devices=/etc/sysconfig/network-scripts

View File

@ -1,2 +0,0 @@
alias net-pf-10 off
blacklist ipv6

View File

@ -1,48 +0,0 @@
# French messages for openmamba initscripts
# Copyright (C) 2006 Stefano Brugiolo <davide.madrisan@qinet.it>
# Copyright (C) 2009 Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2009 Natalia Garcia Morales <natalia@openmamba.org>
# This file is distributed under the same license as the openmamba distribution.
#: initscripts
msgid "System booting, please wait..."
msgstr "Iniciando el sistema, espere por favor..."
#
msgid "Checking file systems..."
msgstr "Control de los archivos de sistema..."
#
msgid "Checking file systems...done"
msgstr "Control de los archivos de sistema...completado"
#
msgid "Checking file systems...fixed"
msgstr "Control de los archivos de sistema...errores corregidos"
#
msgid "Checking file systems...rebooting"
msgstr "Control de los archivos de sistema...reinicio"
#
msgid "Checking file systems...unfixable errors"
msgstr "Control de los archivos de sistema...errores no corregibles"
#
msgid "Checking file systems...operational error!"
msgstr "Control de los archivos de sistema...error operativo!"
#
msgid "Starting services..."
msgstr "Iniciando los servicios..."
#
msgid "System rebooting, please wait..."
msgstr "Reiniciando el sistema, espere por favor..."
#
msgid "System shutting down, please wait..."
msgstr "Cerrando el sistema, espere por favor..."
#
msgid "Stopping runlevel $runlevel services..."
msgstr "Parando los servicios de runlevel $runlevel..."
#
msgid "Starting runlevel $runlevel services..."
msgstr "Iniciando los servicios de runlevel $runlevel..."
#
msgid "Starting graphical environment..."
msgstr "Iniciando el ambiente grafico..."
#
msgid "System up and running"
msgstr "Sistema activo y en ejecucion"

View File

@ -1,26 +0,0 @@
# French messages for openmamba initscripts
# Copyright (C) 2006 Davide Madrisan <davide.madrisan@qilinux.it>
# Copyright (C) 2009 Silvan Calarco <silvan.calarco@mambasoft.it>
# This file is distributed under the same license as the openmamba distribution.
#: initscripts
msgid "System booting, please wait..."
msgstr "Démarrage du système en cours..."
#
msgid "Starting services..."
msgstr "Démarrage des services en cours..."
#
msgid "System rebooting, please wait..."
msgstr "Redémarrage du système en cours..."
#
msgid "System shutting down, please wait..."
msgstr "Arrête du système en cours..."
#
msgid "Stopping runlevel $runlevel services..."
msgstr "Arrête des services du niveau d'exécution $runlevel..."
#
msgid "Starting runlevel $runlevel services..."
msgstr "Démarrage des services du niveau d'exécution $runlevel..."
#
msgid "Starting graphical environment..."
msgstr "Démarrage de l'environnement graphique..."

View File

@ -1,46 +0,0 @@
# Italian messages for openmamba initscripts
# Copyright (C) 2005-2009 Silvan Calarco <silvan.calarco@mambasoft.it>
# This file is distributed under the same license as the openmamba distribution.
#: initscripts
msgid "System booting, please wait..."
msgstr "Avvio in corso..."
#
msgid "Checking file systems..."
msgstr "Controllo delle partizioni..."
#
msgid "Checking file systems...done"
msgstr "Controllo delle partizioni...completato"
#
msgid "Checking file systems...fixed"
msgstr "Controllo delle partizioni...errori corretti"
#
msgid "Checking file systems...rebooting"
msgstr "Controllo delle partizioni...riavvio"
#
msgid "Checking file systems...unfixable errors"
msgstr "Controllo delle partizioni...errori non corretti"
#
msgid "Checking file systems...operational error!"
msgstr "Controllo delle partizioni...errore interno!"
#
msgid "Starting services..."
msgstr "Avvio dei servizi..."
#
msgid "System rebooting, please wait..."
msgstr "Riavvio in corso..."
#
msgid "System shutting down, please wait..."
msgstr "Spegnimento in corso..."
#
msgid "Stopping runlevel $runlevel services..."
msgstr "Si stanno fermando i servizi del runlevel $runlevel..."
#
msgid "Starting runlevel $runlevel services..."
msgstr "Avvio dei servizi del runlevel $runlevel..."
#
msgid "Starting graphical environment..."
msgstr "Avvio dell'ambiente grafico..."
#
msgid "System up and running"
msgstr "Sistema avviato ed attivo"

View File

@ -1,70 +0,0 @@
#!/bin/bash
#
# Generate init.d database files required by multithreaded init system
#
# (c) 2003-2009 by Silvan Calarco - silvan.calarco@mambasoft.it
rcldir=/var/init
function get_runlevel_files() {
unset ALL_RUNLEVEL
runlevel=$1
startstop=$2
if [ $startstop = "S" ]; then
min="$start_min"
else
min="$stop_min"
fi
for i in $(ls -v /etc/rc$runlevel.d/$startstop* 2>/dev/null); do
#suffix=${i#/etc/rc$runlevel.d/$startstop}
service=${i#/etc/rc$runlevel.d/$startstop[0-9][0-9]}
#seqnum=${suffix:0:2}
ALL_RUNLEVEL="$ALL_RUNLEVEL $service"
done
}
get_runlevel_files 0 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/0.start.rcl
get_runlevel_files 1 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/1.start.rcl
cp $rcldir/1.start.rcl $rcldir/S.start.rcl
get_runlevel_files 2 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/2.start.rcl
get_runlevel_files 3 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/3.start.rcl
get_runlevel_files 4 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/4.start.rcl
get_runlevel_files 5 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/5.start.rcl
get_runlevel_files 6 S
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/6.start.rcl
get_runlevel_files 0 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/0.stop.rcl
get_runlevel_files 1 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/1.stop.rcl
cp $rcldir/1.stop.rcl $rcldir/S.stop.rcl
get_runlevel_files 2 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/2.stop.rcl
get_runlevel_files 3 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/3.stop.rcl
get_runlevel_files 4 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/4.stop.rcl
get_runlevel_files 5 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/5.stop.rcl
get_runlevel_files 6 K
echo "ALL_RUNLEVEL =$ALL_RUNLEVEL" > $rcldir/6.stop.rcl

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Copyright (c) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009,2013 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
DEVICE=${1}
if [ -z "$DEVICE" ]; then
echo "Usage: ifdown <device name>" 1>&2
exit 1
fi
[ -r $network_devices/ifcfg-${DEVICE} ] &&
. $network_devices/ifcfg-${DEVICE}
[ "$NM_CONTROLLED" = "no" ] || exit 0
if [ -x $network_devices/ifdown-${DEVICE} ]; then
$network_devices/ifdown-${DEVICE}
else
if [ -r /var/run/wpa_supplicant/${DEVICE} ]; then
wpa_cli -i${DEVICE} terminate >/dev/null
fi
if [ -r /var/run/dhclient.${DEVICE}.pid ]; then
/sbin/dhclient ${DEVICE} -r -pf /var/run/dhclient.${DEVICE}.pid
kill -9 `cat /var/run/dhclient.${DEVICE}.pid` 2>/dev/null
rm -f /var/run/dhclient.${DEVICE}.pid
fi
/sbin/ifconfig ${DEVICE} down
fi

View File

@ -1,11 +0,0 @@
#!/bin/bash
# Copyright (c) 2005-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# ifrestart: restart insterface script
#
# usage: ifrestart <interface>
[ "$1" ] || exit 1
/sbin/ifdown $1
/sbin/ifup $1

View File

@ -1,87 +0,0 @@
#!/bin/bash
# Copyright (c) 2003-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2003-2009,2013 by Davide Madrisan <davide.madrisan@gmail.com>
. /etc/sysconfig/rc
. $rc_functions
. $rc_networkfunctions
DEVICE=${1}
if [ -z "$DEVICE" ]; then
echo "Usage: ifup <device name>" 1>&2
exit 1
fi
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
[ -r $network_devices/ifcfg-${DEVICE} ] && . $network_devices/ifcfg-${DEVICE}
[ "$NM_CONTROLLED" = "no" ] || exit 0
if [ "$2" = "--udev" ]; then
case "$ONBOOT" in
yes|true|1)
# udev boot: exit if root filesystem is read only
[ -w /var/run ] || exit 0
;;
*) exit 0
;;
esac
fi
if [ -x $network_devices/ifup-${DEVICE} ]; then
$network_devices/ifup-${DEVICE}
exit 0
fi
[ -r $network_devices/ifup-wireless ] && . $network_devices/ifup-wireless
if [ "$BOOTPROTO" = "dhcp" ]; then
if [ ! -r /var/run/dhclient.${DEVICE}.pid ]; then
echo -n "Bringing up the ${DEVICE} interface: "
/sbin/ifconfig ${DEVICE} up
dhclient -q ${DEVICE} -nw -pf /var/run/dhclient.${DEVICE}.pid >/dev/null
evaluate_retval
echo
else
echo -n "Error: dhclient is already running for the interface"
fi
else
[ "$IPADDR" ] || IPADDR=$IP
if [ "$IPADDR" ]; then
if [ -z "$NETMASK" ]; then
echo "\
NETMASK variable missing in ifcfg-${DEVICE}, echo using 255.255.255.0"
NETMASK=255.255.255.0
fi
[ "$BROADCAST" ] || eval `/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}`
echo -n "Bringing up the ${DEVICE} interface: "
/sbin/ifconfig ${DEVICE} $IPADDR netmask $NETMASK broadcast $BROADCAST
evaluate_retval
echo
else
# if IPADDR is missing interface is brought up anyway without address
echo -n "Bringing up the ${DEVICE} interface with no address: "
/sbin/ifconfig ${DEVICE} up
evaluate_retval
echo
fi
if [ -n "$ETHTOOL_OPTS" ] ; then
/usr/sbin/ethtool -s ${DEVICE} $ETHTOOL_OPTS
fi
if [[ "$GATEWAY_IF" = "${DEVICE}" && -n "$GATEWAY" ]]; then
echo -n "Setting up default gateway: "
route add default gateway $GATEWAY metric 1 dev $GATEWAY_IF
evaluate_retval
echo
fi
fi
[ -r $network_devices/ifup-routes ] && . $network_devices/ifup-routes ${DEVICE}
exit 0

View File

@ -10,6 +10,7 @@ USLEEP_OBJS = usleep.o
prefix = /usr prefix = /usr
exec_prefix = ${prefix} exec_prefix = ${prefix}
sysconfdir = /etc sysconfdir = /etc
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin sbindir = ${exec_prefix}/sbin
mandir = ${prefix}/share/man mandir = ${prefix}/share/man
localstatedir = /var localstatedir = /var
@ -43,24 +44,18 @@ usernetctl: usernetctl.c usernetctl.o
$(CC) $(LDFLAGS) -pie -o $@ $@.o $(CC) $(LDFLAGS) -pie -o $@ $@.o
install: install:
$(INSTALL_DIR) $(DESTDIR)/bin $(INSTALL_DIR) $(DESTDIR)$(bindir)
$(INSTALL_DIR) $(DESTDIR)/sbin
$(INSTALL_DIR) $(DESTDIR)$(sbindir) $(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_DIR) $(DESTDIR)$(mandir)/man{1,8} $(INSTALL_DIR) $(DESTDIR)$(mandir)/man{1,8}
$(INSTALL_DIR) $(DESTDIR)$(sysconfdir) $(INSTALL_DIR) $(DESTDIR)$(sysconfdir)
$(INSTALL_DIR) $(DESTDIR)$(localstatedir)/run/netreport/ $(INSTALL_PROGRAM) doexec $(DESTDIR)$(bindir)/doexec
$(INSTALL_PROGRAM) doexec $(DESTDIR)/bin/doexec $(INSTALL_PROGRAM) usleep $(DESTDIR)$(bindir)/usleep
$(INSTALL_PROGRAM) usleep $(DESTDIR)/bin/usleep $(INSTALL_PROGRAM) ipcalc $(DESTDIR)$(bindir)/ipcalc
$(INSTALL_PROGRAM) ipcalc $(DESTDIR)/bin/ipcalc $(INSTALL_PROGRAM) consoletype $(DESTDIR)$(sbindir)/consoletype
$(INSTALL_PROGRAM) netreport $(DESTDIR)/sbin/netreport $(INSTALL_PROGRAM) genhostid $(DESTDIR)$(sbindir)/genhostid
$(INSTALL_PROGRAM) consoletype $(DESTDIR)/sbin/consoletype $(INSTALL_PROGRAM) getkey $(DESTDIR)$(sbindir)/getkey
$(INSTALL_PROGRAM) fstab-decode $(DESTDIR)/sbin/fstab-decode $(INSTALL_PROGRAM) minilogd $(DESTDIR)$(sbindir)/minilogd
$(INSTALL_PROGRAM) genhostid $(DESTDIR)/sbin/genhostid
$(INSTALL_PROGRAM) getkey $(DESTDIR)/sbin/getkey
$(INSTALL_PROGRAM) initlog $(DESTDIR)/sbin/initlog
$(INSTALL_PROGRAM) minilogd $(DESTDIR)/sbin/minilogd
$(INSTALL_PROGRAM) usernetctl $(DESTDIR)$(sbindir)/usernetctl $(INSTALL_PROGRAM) usernetctl $(DESTDIR)$(sbindir)/usernetctl
$(INSTALL_DATA) initlog.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) genhostid.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) genhostid.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) doexec.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) doexec.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) getkey.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) getkey.1 $(DESTDIR)$(mandir)/man1
@ -68,11 +63,7 @@ install:
$(INSTALL_DATA) usleep.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) usleep.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) ipcalc.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) ipcalc.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) consoletype.1 $(DESTDIR)$(mandir)/man1 $(INSTALL_DATA) consoletype.1 $(DESTDIR)$(mandir)/man1
$(INSTALL_DATA) fstab-decode.8 $(DESTDIR)$(mandir)/man8
$(INSTALL_DATA) usernetctl.8 $(DESTDIR)$(mandir)/man8 $(INSTALL_DATA) usernetctl.8 $(DESTDIR)$(mandir)/man8
$(INSTALL_DATA) initlog.conf $(DESTDIR)$(sysconfdir)
# install -m 2755 netreport $(DESTDIR)/sbin/netreport
# install -m 4755 usernetctl $(DESTDIR)$(sbindir)/usernetctl
clean: clean:
rm -f $(PROGS) *.o rm -f $(PROGS) *.o

0
sbin/service → usr/sbin/service Normal file → Executable file
View File

View File

@ -1,83 +0,0 @@
# GNU Makefile listing dependencies between services when services are
# started.
# Copyright (c) 2006-2011 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# The following services have already been activated at this point:
#
# devfsd mountproc loadkeys localnet hotplug loadmodules hdparm
# swap setclock checkfs mountfs cleanfs
#
acpid : syslog
alsa : sysinit
apmd : syslog
bluetooth : messagebus
consolekit : haldaemon
cpufreqd : syslog acpid macbook-tools
crond : syslog
cups : syslog messagebus
dhcpd : network NetworkManager iptables
drbd : network NetworkManager iptables
fuse :
gpm : syslog
haldaemon : messagebus acpid alsa
heartbeat : drbd network NetworkManager iptables
httpd : network NetworkManager iptables
ipsec : network NetworkManager iptables
iptables : network NetworkManager
ipvsadm : network NetworkManager iptables
ivman : haldaemon
laptop-mode :
lisa : network NetworkManager
lisa4 : network NetworkManager haldaemon
logrotate :
macbook-tools :
mailman : mysql postfix
mambawelcome : sshd
messagebus : syslog
mrtg : snmpd
msysklogd : random
mysql : syslog
named : network NetworkManager iptables
nessusd : network NetworkManager iptables
network : syslog
NetworkManager : syslog messagebus
netfs : network NetworkManager samba nfs-lock
nfs-lock :
nscd : syslog
ntop : network NetworkManager iptables
ntpd : network NetworkManager iptables
openldap : syslog
portmap :
postfix : syslog mysql postgresql
postgresql : syslog
random :
samba : network NetworkManager iptables cups
snmpd : network NetworkManager iptables
snort : network NetworkManager
squid : network NetworkManager iptables
sshd : network NetworkManager iptables
sysklogd : random
sysinit : syslog
syslog : syslog-ng msysklogd sysklogd
syslog-ng :
udev-post : messagebus
xinetd : network NetworkManager iptables
wine : syslog
wicd : haldaemon
VirtualBox :
endlocal : local
@sleep 5
rc.local : $(filter-out rc.local, $(ALL_RUNLEVEL))
$(STARTAFTER_RUNLEVEL) : endlocal
#
# when local is started a semaphore file indicates that
# init can proceed
#
local: $(LOCAL)
@$(ECHO) "Begin \"$(JOB) $@\" at `$(DATE)`" > $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).$@ 2>&1; \
rm -f $(PROG_FILE); \
$(ECHO) "" > /var/lock/subsys/local; \
[ "$(TEST)" = "1" ] && $(ECHO) local; \
$(ECHO) "End \"$(JOB) $@\" at `$(DATE)`" >> $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).$@ 2>&1;
# EOF

View File

@ -1,56 +0,0 @@
# GNU Makefile listing dependencies between services when services are
# stopped
#
# rc[1-5].d dependencies
acpid : sendsignals
alsa :
consolekit :
cpufreqd : sendsignals
crond :
cups :
drbd : heartbeat
gpm :
haldaemon : wicd
heartbeat :
httpd :
iptables : sendsignals
lisa :
lisa4 :
localnet : network NetworkManager
logrotate :
mountfs : sendsignals network NetworkManager swap create_final_log
mrtg :
mysql :
named :
nessusd :
network : netfs vmware heartbeat drbd
NetworkManager : netfs vmware heartbeat drbd
netfs : samba
nscd :
ntpd :
openldap :
postgresql :
random :
samba :
snort :
splash :
sshd :
swap : sendsignals
udev : mountfs
virtualbox :
vmware :
wine :
xinetd :
wicd :
# services to be started last
sysklogd : $(filter-out sysklogd udev mountfs sendsignals create_final_log swap reboot halt,$(ALL_RUNLEVEL))
sendsignals : $(filter-out sendsignals acpid iptables localnet network udev mountfs network cpufreqd swap reboot halt,$(ALL_RUNLEVEL))
reboot : $(filter-out reboot,$(ALL_RUNLEVEL))
halt : $(filter-out halt,$(ALL_RUNLEVEL))
local :
create_final_log : sendsignals swap
@$(LS) -Srt $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).* | $(XARGS) $(CAT) > $(FINAL_OUTPUT_FILE) 2>/dev/null
@$(RM) -f $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).* 2>/dev/null
# EOF

View File

@ -1,195 +0,0 @@
########################################################################
# Description : Gnu Makefile to control the services in the specified
# runlevel. It will run the required services, and log
# the output of the services to the file
# /var/log/initd.$runlevel.start (for service startup) and
# /var/log/initd.$runlevel.stop (for service shutdown).
#
# This controlling program is designed to be invoked by
# the "/etc/rc.d/rc" script.
#
# Author : jameshunt@uk.ibm.com
# Modified by : Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Notes :
#
# - Run as,
#
# make [-n] -j -f runlevel.mk \
# RUNLEVEL={0|1|2|3|4|5|6} \
# JOB={start|stop|restart|status}
#
# - $(JOB) is not validated - that is left to the service program.
# - $(RUNLEVEL) is not validated - that is left to the calling program
# (usually /etc/rc.d/rc).
# - It wouldn't take too much effort to auto-generate this Makefile.
#
########################################################################
# passed as a parameter
export RUNLEVEL := $(shell echo $$RUNLEVEL)
PREV_RUNLEVEL := $(shell echo $$PREVLEVEL)
PREV_RUNLEVEL_DIR = /etc/rc.d/rc$(PREV_RUNLEVEL).d
SERVICE= /sbin/service
# passed as a parameter (start, stop, status, etc)
JOB =
JB = `case $(JOB) in "start") echo S;; "stop") echo K;; esac`
# set to a value to enable debug output
DEBUG =
# with TEST=1 only print service startup order
TEST =
########################################################################
# START CONFIGURATION
# system commands used by this facility
CAT = /bin/cat
RM = /bin/rm
ECHO = /bin/echo
DATE = /bin/date
LS = /bin/ls
XARGS = /usr/bin/xargs
# Directory containing scripts/programs to run.
INITD_DIR := /etc/init.d
# Directory into which a lock file is created when a service starts.
# (Note that the lock file is created by the service).
SUBSYS_FILE_DIR := /var/lock/subsys
# Rcl init database/dependecies file dir
RCL_DIR := /var/init
# Used to create temporary files, before collating them all into
# $(FINAL_OUTPUT_FILE).
TMP_DIR := /tmp
ifneq ($(DEBUG),)
DEBUG_FILE = /dev/stdout
else
DEBUG_FILE = /dev/null
endif
TMPFILE_PREFIX := .runlevel
TMP_FILE = $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).$@
# Variable used for splash progress bar
PROGRESS_TOT := 0
PROGRESS_BASE := 0
PROGRESS_FILEDIR := /dev/shm/progcounter
# File that contains all output of programs/scripts run.
FINAL_OUTPUT_FILE := /var/log/initd.$(RUNLEVEL).$(JOB)
#
# List of all runlevel services to be started/stopped
#
include $(RCL_DIR)/$(RUNLEVEL).$(JOB).rcl
START_RUNLEVEL = $(ALL_RUNLEVEL)
STARTAFTER_RUNLEVEL =
LOCAL = openldap messagebus haldaemon
ifeq ($(JOB)$(RUNLEVEL),start5)
START_RUNLEVEL = random sysinit syslog-ng sysklogd msysklogd network iptables wicd acpid apmd
# LOCAL: list of services that have to be started before KDM
LOCAL = openldap messagebus haldaemon alsa bluetooth consolekit mambawelcome
STARTAFTER_RUNLEVEL = $(filter-out $(LOCAL) $(START_RUNLEVEL), $(ALL_RUNLEVEL))
endif
ifeq ($(JOB)$(RUNLEVEL),start4)
START_RUNLEVEL = random sysinit syslog-ng sysklogd msysklogd network iptables wicd acpid apmd
# LOCAL: list of services that have to be started before KDM
LOCAL = openldap messagebus haldaemon alsa bluetooth consolekit
STARTAFTER_RUNLEVEL = $(filter-out $(LOCAL) $(START_RUNLEVEL), $(ALL_RUNLEVEL))
endif
ifeq ($(JOB)$(RUNLEVEL),start3)
START_RUNLEVEL = random sysinit syslog-ng sysklogd msysklogd network iptables wicd acpid apmd
# LOCAL: list of services that have to be started before agetty
LOCAL = openldap messagebus haldaemon
STARTAFTER_RUNLEVEL = $(filter-out $(LOCAL) $(START_RUNLEVEL), $(ALL_RUNLEVEL))
endif
ifeq ($(JOB)$(RUNLEVEL),start2)
# runlevel 2: don't wait for network before agetty
START_RUNLEVEL = random sysinit syslog-ng sysklogd msysklogd acpid apmd
# LOCAL: list of services that have to be started before agetty
LOCAL = openldap
STARTAFTER_RUNLEVEL = $(filter-out $(LOCAL) $(START_RUNLEVEL), $(ALL_RUNLEVEL))
endif
# END CONFIGURATION
########################################################################
# Check command-line parameters
ifndef RUNLEVEL
$(error must specify RUNLEVEL, so I know what to run)
endif
ifndef JOB
$(error must specify JOB, so I know what to do)
endif
default: prep $(START_RUNLEVEL) local $(STARTAFTER_RUNLEVEL) create_final_output_file
prep:
@mkdir -p $(PROGRESS_FILEDIR) || rm -f $(PROGRESS_FILEDIR)/*
@rm -f $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).*
ifeq ($(DEBUG),2)
@$(ECHO) "RUNLEVEL=$(RUNLEVEL)" >> $(DEBUG_FILE)
@$(ECHO) "JOB=$(JOB)" >> $(DEBUG_FILE)
@$(ECHO) "FINAL_OUTPUT_FILE=$(FINAL_OUTPUT_FILE)" >> $(DEBUG_FILE)
@$(ECHO) "TMP_FILE=$(TMP_FILE)" >> $(DEBUG_FILE)
@$(ECHO) "ALL_RUNLEVEL=|$(ALL_RUNLEVEL)|" >> $(DEBUG_FILE)
@$(ECHO) "START_RUNLEVEL=|$(START_RUNLEVEL)|" >> $(DEBUG_FILE)
@$(ECHO) "STARTAFTER_RUNLEVEL=|$(STARTAFTER_RUNLEVEL)|" >> $(DEBUG_FILE)
@$(ECHO) "LOCAL=|$(LOCAL)|" >> $(DEBUG_FILE)
@$(ECHO) "($(JB)$(RUNLEVEL),S5)" >> $(DEBUG_FILE)
@$(ECHO) >> $(DEBUG_FILE)
endif
##############################################################
# Rule that executes all services jobs
#
$(ALL_RUNLEVEL):
@if [ "$(TEST)" = "1" ]; then echo $@; sleep 1; fi
@if [ ! -e $(PREV_RUNLEVEL_DIR)/$(JB)??$@ ]; then \
$(ECHO) "Begin \"$(JOB) $@\" at `$(DATE)`" | tee -a $(TMP_FILE) >$(DEBUG_FILE); \
RUNLEVEL=$(RUNLEVEL) $(INITD_DIR)/$@ $(JOB) 2>&1 | tee -a $(TMP_FILE) >$(DEBUG_FILE); \
$(ECHO) "End \"$(JOB) $@\" at `$(DATE)`" | tee -a $(TMP_FILE) >$(DEBUG_FILE); \
else \
$(ECHO) "Already running \"$(JOB) $@\" at `$(DATE)`" | tee -a $(TMP_FILE) >$(DEBUG_FILE); \
fi; \
if [ -d $(PROGRESS_FILEDIR) ]; then \
>$(PROGRESS_FILEDIR)/$@ \
i=`ls $(PROGRESS_FILEDIR) | wc -w`; \
. /etc/init.d/functions; \
progress=`expr $(PROGRESS_BASE) + $$i \* \( 100 - $(PROGRESS_BASE) \) / $(PROGRESS_TOT)`; \
fi;
##############################################################
# List of services that have dependencies.
#
# (Note: It is not necessary to list services that have no
# dependencies).
# Include the relevant dependencies. If you intend to use this facility,
# you must provide 2 makefiles / runlevel, one for starting the services
# in the runlevel, and one for stopping the services in the runlevel.
#
# WARNING: If make attempts to include a file that does not exist, it will
# exit. This could cause your system to boot in an unfamiliar way.
include $(RCL_DIR)/deps.$(JOB).mk
# Lastly, merge all the service output files into a single file.
# Note that the order of the service output in the merged file is not
# chronological.
create_final_output_file: $(START_RUNLEVEL) $(STARTAFTER_RUNLEVEL)
@$(LS) -Srt $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).* 2>/dev/null | $(XARGS) $(CAT) > $(FINAL_OUTPUT_FILE) 2>/dev/null
@$(RM) -f $(TMP_DIR)/$(TMPFILE_PREFIX).$(JOB).* 2>/dev/null
# EOF