From b28b0bd5f13135d64dca024f629100b3e30d47b2 Mon Sep 17 00:00:00 2001 From: rhatto Date: Tue, 24 Jul 2007 02:01:18 +0000 Subject: fixed a bug on 0.5 and tagged as 0.5.1 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@407 04377dda-e619-0410-9926-eae83683ac58 --- tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc | 11 + .../templates/vserver/vserver.d/etc/rc.d/rc.0 | 110 ++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.4 | 256 ++++++++++++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.6 | 110 ++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.K | 88 ++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.M | 256 ++++++++++++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.S | 294 +++++++++++++++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.httpd | 21 ++ .../templates/vserver/vserver.d/etc/rc.d/rc.inet2 | 129 +++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.inetd | 36 +++ .../vserver/vserver.d/etc/rc.d/rc.ip_forward | 64 +++++ .../templates/vserver/vserver.d/etc/rc.d/rc.local | 5 + .../templates/vserver/vserver.d/etc/rc.d/rc.mysqld | 80 ++++++ .../vserver/vserver.d/etc/rc.d/rc.postfix | 45 ++++ .../vserver/vserver.d/etc/rc.d/rc.sendmail | 38 +++ .../templates/vserver/vserver.d/etc/rc.d/rc.serial | 132 +++++++++ .../templates/vserver/vserver.d/etc/rc.d/rc.sshd | 50 ++++ .../templates/vserver/vserver.d/etc/rc.d/rc.syslog | 42 +++ .../vserver/vserver.d/etc/rc.d/rc.sysvinit | 58 ++++ 19 files changed, 1825 insertions(+) create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.0 create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.4 create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.6 create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.K create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.M create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.S create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.httpd create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inet2 create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inetd create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.local create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.mysqld create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.postfix create mode 100644 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sendmail create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.serial create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sshd create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.syslog create mode 100755 tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit (limited to 'tags/0.5.1/templates/vserver/vserver.d/etc/rc.d') diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc new file mode 100755 index 0000000..eefbcc5 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ "$1" == "3" ]; then + /etc/rc.d/rc.M +elif [ "$1" == "6" ]; then + /etc/rc.d/rc.6 +else + echo "Invalid level." + exit 1 +fi + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.0 b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.0 new file mode 100755 index 0000000..bfec90a --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.0 @@ -0,0 +1,110 @@ +#! /bin/sh +# +# rc.6 This file is executed by init when it goes into runlevel +# 0 (halt) or runlevel 6 (reboot). It kills all processes, +# unmounts file systems and then either halts or reboots. +# +# Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001 +# +# Author: Miquel van Smoorenburg +# Modified by: Patrick J. Volkerding, +# + +# Set the path. +PATH=/sbin:/etc:/bin:/usr/bin + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Set linefeed mode to avoid staircase effect. +stty onlcr + +echo "Running shutdown script $0:" + +# Find out how we were called. +case "$0" in + *0) + command="halt" + ;; + *6) + command=reboot + ;; + *) + echo "$0: call me as \"rc.0\" or \"rc.6\" please!" + exit 1 + ;; +esac + +# Stop the Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + /etc/rc.d/rc.httpd stop +fi + +# Stop the MySQL database: +if [ -r /var/run/mysql/mysql.pid ]; then + . /etc/rc.d/rc.mysqld stop +fi + +# Stop the Samba server: +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba stop +fi + +# Try to kill dhcpcd so the DHCP leases can be returned: +killall -15 dhcpcd 1> /dev/null 2> /dev/null + +# Try to shut down pppd: +PS="$(ps ax)" +if echo "$PS" | grep -q -w pppd ; then + if [ -x /usr/sbin/ppp-off ]; then + /usr/sbin/ppp-off + fi +fi + +# Turn off process accounting: +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + echo "Turning off process accounting." + /sbin/accton +fi + +# Kill all processes. +# INIT is supposed to handle this entirely now, but this didn't always +# work correctly without this second pass at killing off the processes. +# Since INIT already notified the user that processes were being killed, +# we'll avoid echoing this info this time around. +if [ "$1" != "fast" ]; then # shutdown did not already kill all processes + killall5 -15 + sleep 5 + killall5 -9 +fi + +# Carry a random seed between reboots. +echo "Saving random seed from /dev/urandom in /etc/random-seed." +# Use the pool size from /proc, or 512 bytes: +if [ -r /proc/sys/kernel/random/poolsize ]; then + dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null +else + dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null +fi +chmod 600 /etc/random-seed + +# Before unmounting file systems write a reboot or halt record to wtmp. +$command -w + +# Clear /var/lock/subsys. +if [ -d /var/lock/subsys ]; then + rm -f /var/lock/subsys/* +fi + +# This never hurts: +sync + +# sleep 1 fixes problems with some hard drives that don't +# otherwise finish syncing before reboot or poweroff +sleep 1 + +# This is to ensure all processes have completed on SMP machines: +wait + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.4 b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.4 new file mode 100644 index 0000000..b972052 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.4 @@ -0,0 +1,256 @@ +#!/bin/sh +# +# rc.M This file is executed by init(8) when the system is being +# initialized for one of the "multi user" run levels (i.e. +# levels 1 through 6). It usually does mounting of file +# systems et al. +# +# Version: @(#)/etc/rc.d/rc.M 2.23 Wed Feb 26 19:20:58 PST 2003 +# +# Author: Fred N. van Kempen, +# Heavily modified by Patrick Volkerding +# + +# Tell the viewers what's going to happen. +echo "Going multiuser..." + +# Screen blanks after 15 minutes idle time, and powers down in one hour +# if the kernel supports APM or ACPI power management: +#/bin/setterm -blank 15 -powersave powerdown -powerdown 60 + +# Set the hostname. +#if [ -r /etc/HOSTNAME ]; then +# /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .) +#else + # fall back on this old default: +# echo "darkstar.example.net" > /etc/HOSTNAME +# /bin/hostname darkstar +#fi + +# Save the contents of 'dmesg': +#/bin/dmesg -s 65536 > /var/log/dmesg + +# Start the system logger. +if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then + . /etc/rc.d/rc.syslog start +fi + +# Initialize PCMCIA devices: +# +# NOTE: This used to be started near the top of rc.S so that PCMCIA devices +# could be fsck'ed along with the other drives. This had some unfortunate +# side effects, however, since root isn't yet read-write, and /var might not +# even be mounted the .pid files can't be correctly written in /var/run and +# the pcmcia system can't be correctly shut down. If you want some PCMCIA +# partition to be mounted at boot (or when the card is inserted) then add +# the appropriate lines to /etc/pcmcia/scsi.opts. +# +if [ -x /etc/rc.d/rc.pcmcia ] ; then + . /etc/rc.d/rc.pcmcia start + # The cards might need a little extra time here to initialize. + if [ -r /var/run/cardmgr.pid ]; then + sleep 5 + fi +fi + +# Initialize the networking hardware. If your network driver is a module +# and you haven't loaded it manually, this will be deferred until after +# the hotplug system loads the module below. +#if [ -x /etc/rc.d/rc.inet1 ]; then +# . /etc/rc.d/rc.inet1 +#fi + +# Initialize the hotplugging subsystem for Cardbus, IEEE1394, PCI, and USB devices: +if [ -x /etc/rc.d/rc.hotplug -a -r /proc/modules ]; then + # Don't run hotplug if 'nohotplug' was given at boot. + if ! grep nohotplug /proc/cmdline 1> /dev/null 2> /dev/null ; then + echo "Activating hardware detection: /etc/rc.d/rc.hotplug start" + . /etc/rc.d/rc.hotplug start + fi +fi + +# Start networking daemons: +if [ -x /etc/rc.d/rc.inet2 ]; then + . /etc/rc.d/rc.inet2 +fi + +# Remove stale locks and junk files (must be done after mount -a!) +/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null + +# Remove stale hunt sockets so the game can start. +if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then + echo "Removing your stale hunt sockets from /tmp." + /bin/rm -f /tmp/hunt* +fi + +# Ensure basic filesystem permissions sanity. +chmod 755 / 2> /dev/null +chmod 1777 /tmp /var/tmp + +# Update all the shared library links: +if [ -x /sbin/ldconfig ]; then + echo "Updating shared library links: /sbin/ldconfig" + /sbin/ldconfig +fi + +# Update the X font indexes: +if [ -x /usr/X11R6/bin/fc-cache ]; then + echo "Updating X font indexes: /usr/X11R6/bin/fc-cache" + /usr/X11R6/bin/fc-cache +fi + +# Start the print spooling system. This will usually be LPRng (lpd) or CUPS. +if [ -x /etc/rc.d/rc.cups ]; then + # Start CUPS: + /etc/rc.d/rc.cups start +elif [ -x /etc/rc.d/rc.lprng ]; then + # Start LPRng (lpd): + . /etc/rc.d/rc.lprng start +fi + +# Start netatalk. (a file/print server for Macs using Appletalk) +if [ -x /etc/rc.d/rc.atalk ]; then + /etc/rc.d/rc.atalk +fi + +# Start smartd, which monitors the status of S.M.A.R.T. compatible +# hard drives and reports any problems. Note some devices (which aren't +# smart, I guess ;) will hang if probed by smartd, so it's commented out +# by default. +#if [ -x /usr/sbin/smartd ]; then +# /usr/sbin/smartd +#fi + +# Monitor the UPS with genpowerd. +# To use this, uncomment this section and edit your settings in +# /etc/genpowerd.conf (serial device, UPS type, etc). For more information, +# see "man genpowerd" or the extensive documentation in the +# /usr/doc/genpower-1.0.3 directory. +# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want +# support for stopping the UPS's inverter after the machine halts. +#if [ -x /sbin/genpowerd ]; then +# echo "Starting genpowerd daemon..." +# /sbin/genpowerd +#fi + +# Turn on process accounting. To enable process accounting, make sure the +# option for BSD process accounting is enabled in your kernel, and then +# create the file /var/log/pacct (touch /var/log/pacct). By default, process +# accounting is not enabled (since /var/log/pacct does not exist). This is +# because the log file can get VERY large. +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + /sbin/accton /var/log/pacct + chmod 640 /var/log/pacct + echo "Process accounting turned on." +fi + +# Start crond (Dillon's crond): +# If you want cron to actually log activity to /var/log/cron, then change +# -l10 to -l8 to increase the logging level. +if [ -x /usr/sbin/crond ]; then + /usr/sbin/crond -l10 >>/var/log/cron 2>&1 +fi + +# Start atd (manages jobs scheduled with 'at'): +if [ -x /usr/sbin/atd ]; then + /usr/sbin/atd -b 15 -l 1 +fi + +# Slackware-Mini-Quota-HOWTO: +# To really activate quotas, you'll need to add 'usrquota' and/or 'grpquota' to +# the appropriate partitions as listed in /etc/fstab. Here's an example: +# +# /dev/hda2 /home ext3 defaults,usrquota 1 1 +# +# You'll then need to setup initial quota files at the top of the partitions +# to support quota, like this: +# touch /home/aquota.user /home/aquota.group +# chmod 600 /home/aquota.user /home/aquota.group +# +# Then, reboot to activate the system. +# To edit user quotas, use 'edquota'. See 'man edquota'. Also, the +# official Quota Mini-HOWTO has lots of useful information. That can be found +# here: /usr/doc/Linux-HOWTOs/Quota + +# Check quotas and then turn quota system on: +if grep -q quota /etc/fstab ; then + if [ -x /sbin/quotacheck ]; then + echo "Checking filesystem quotas: /sbin/quotacheck -avugm" + /sbin/quotacheck -avugm + fi + if [ -x /sbin/quotaon ]; then + echo "Activating filesystem quotas: /sbin/quotaon -avug" + /sbin/quotaon -avug + fi +fi + +# Start the sendmail daemon: +if [ -x /etc/rc.d/rc.sendmail ]; then + . /etc/rc.d/rc.sendmail start +fi + +# Start the APM daemon if APM is enabled in the kernel: +if [ -x /usr/sbin/apmd ]; then + if cat /proc/apm 1> /dev/null 2> /dev/null ; then + echo "Starting APM daemon: /usr/sbin/apmd" + /usr/sbin/apmd + fi +fi + +# Start the ACPI (Advanced Configuration and Power Interface) daemon: +if [ -x /etc/rc.d/rc.acpid ]; then + . /etc/rc.d/rc.acpid start +fi + +# Load ALSA (sound) defaults: +if [ -x /etc/rc.d/rc.alsa ]; then + . /etc/rc.d/rc.alsa +fi + +# Load a custom screen font if the user has an rc.font script. +if [ -x /etc/rc.d/rc.font ]; then + . /etc/rc.d/rc.font +fi + +# Load a custom keymap if the user has an rc.keymap script. +if [ -x /etc/rc.d/rc.keymap ]; then + . /etc/rc.d/rc.keymap +fi + +# Initialize HP Officejet support: +if [ -x /etc/rc.d/rc.hpoj ]; then + . /etc/rc.d/rc.hpoj start +fi + +# Start the MySQL database: +if [ -x /etc/rc.d/rc.mysqld ]; then + . /etc/rc.d/rc.mysqld start +fi + +# Start Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + . /etc/rc.d/rc.httpd start +fi + +# Start Samba (a file/print server for Win95/NT machines). +# Samba can be started in /etc/inetd.conf instead. +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba start +fi + +# Start the GPM mouse server: +if [ -x /etc/rc.d/rc.gpm ]; then + . /etc/rc.d/rc.gpm start +fi + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Start the local setup procedure. +if [ -x /etc/rc.d/rc.local ]; then + . /etc/rc.d/rc.local +fi + +# All done. diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.6 b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.6 new file mode 100755 index 0000000..bfec90a --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.6 @@ -0,0 +1,110 @@ +#! /bin/sh +# +# rc.6 This file is executed by init when it goes into runlevel +# 0 (halt) or runlevel 6 (reboot). It kills all processes, +# unmounts file systems and then either halts or reboots. +# +# Version: @(#)/etc/rc.d/rc.6 2.47 Sat Jan 13 13:37:26 PST 2001 +# +# Author: Miquel van Smoorenburg +# Modified by: Patrick J. Volkerding, +# + +# Set the path. +PATH=/sbin:/etc:/bin:/usr/bin + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Set linefeed mode to avoid staircase effect. +stty onlcr + +echo "Running shutdown script $0:" + +# Find out how we were called. +case "$0" in + *0) + command="halt" + ;; + *6) + command=reboot + ;; + *) + echo "$0: call me as \"rc.0\" or \"rc.6\" please!" + exit 1 + ;; +esac + +# Stop the Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + /etc/rc.d/rc.httpd stop +fi + +# Stop the MySQL database: +if [ -r /var/run/mysql/mysql.pid ]; then + . /etc/rc.d/rc.mysqld stop +fi + +# Stop the Samba server: +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba stop +fi + +# Try to kill dhcpcd so the DHCP leases can be returned: +killall -15 dhcpcd 1> /dev/null 2> /dev/null + +# Try to shut down pppd: +PS="$(ps ax)" +if echo "$PS" | grep -q -w pppd ; then + if [ -x /usr/sbin/ppp-off ]; then + /usr/sbin/ppp-off + fi +fi + +# Turn off process accounting: +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + echo "Turning off process accounting." + /sbin/accton +fi + +# Kill all processes. +# INIT is supposed to handle this entirely now, but this didn't always +# work correctly without this second pass at killing off the processes. +# Since INIT already notified the user that processes were being killed, +# we'll avoid echoing this info this time around. +if [ "$1" != "fast" ]; then # shutdown did not already kill all processes + killall5 -15 + sleep 5 + killall5 -9 +fi + +# Carry a random seed between reboots. +echo "Saving random seed from /dev/urandom in /etc/random-seed." +# Use the pool size from /proc, or 512 bytes: +if [ -r /proc/sys/kernel/random/poolsize ]; then + dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null +else + dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null +fi +chmod 600 /etc/random-seed + +# Before unmounting file systems write a reboot or halt record to wtmp. +$command -w + +# Clear /var/lock/subsys. +if [ -d /var/lock/subsys ]; then + rm -f /var/lock/subsys/* +fi + +# This never hurts: +sync + +# sleep 1 fixes problems with some hard drives that don't +# otherwise finish syncing before reboot or poweroff +sleep 1 + +# This is to ensure all processes have completed on SMP machines: +wait + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.K b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.K new file mode 100755 index 0000000..00a1501 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.K @@ -0,0 +1,88 @@ +#! /bin/sh +# +# rc.K This file is executed by init when it goes into runlevel +# 1, which is the administrative state. It kills all +# daemons and then puts the system into single user mode. +# Note that the file systems are kept mounted. +# +# Version: @(#)/etc/rc.d/rc.K 3.1415 Sat Jan 13 13:37:26 PST 2001 +# +# Author: Miquel van Smoorenburg +# Modified by: Patrick J. Volkerding +# + +# Set the path. +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Try to turn off quota: +if grep -q quota /etc/fstab ; then + if [ -x /sbin/quotaoff ]; then + echo "Turning off filesystem quotas." + /sbin/quotaoff -a + fi +fi + +# Try to turn off accounting: +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + echo "Turning off accounting." + /sbin/accton +fi + +# Stop the Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + /etc/rc.d/rc.httpd stop +fi + +# Stop the Samba server: +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba stop +fi + +# Shut down the NFS server: +if [ -x /etc/rc.d/rc.nfsd ]; then + /etc/rc.d/rc.nfsd stop +fi + +# Shut down PCMCIA devices: +if [ -x /etc/rc.d/rc.pcmcia ] ; then + . /etc/rc.d/rc.pcmcia stop + # The cards might need a little extra time here to initialize. + sleep 5 +fi + +# Kill all processes. +echo +echo "Sending all processes the SIGHUP signal." +killall5 -1 +echo -n "Waiting for processes to hang up" +for loop in 0 1 2 3 4 5 ; do + sleep 1 + echo -n "." +done +echo +echo "Sending all processes the SIGTERM signal." +killall5 -15 +echo -n "Waiting for processes to terminate" +for loop in 0 1 2 3 4 5 ; do + sleep 1 + echo -n "." +done +echo +echo "Sending all processes the SIGKILL signal." +killall5 -9 +echo -n "Waiting for processes to exit" +for loop in 0 1 2 3 4 5 ; do + sleep 1 + echo -n "." +done +echo + +# Now go to the single user level +echo "Going to single user mode..." +telinit -t 1 1 + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.M b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.M new file mode 100755 index 0000000..0cb3343 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.M @@ -0,0 +1,256 @@ +#!/bin/sh +# +# rc.M This file is executed by init(8) when the system is being +# initialized for one of the "multi user" run levels (i.e. +# levels 1 through 6). It usually does mounting of file +# systems et al. +# +# Version: @(#)/etc/rc.d/rc.M 2.23 Wed Feb 26 19:20:58 PST 2003 +# +# Author: Fred N. van Kempen, +# Heavily modified by Patrick Volkerding +# + +# Tell the viewers what's going to happen. +echo "Going multiuser..." + +# Screen blanks after 15 minutes idle time, and powers down in one hour +# if the kernel supports APM or ACPI power management: +#/bin/setterm -blank 15 -powersave powerdown -powerdown 60 + +# Set the hostname. +#if [ -r /etc/HOSTNAME ]; then +# /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .) +#else + # fall back on this old default: +# echo "darkstar.example.net" > /etc/HOSTNAME +# /bin/hostname darkstar +#fi + +# Save the contents of 'dmesg': +#/bin/dmesg -s 65536 > /var/log/dmesg + +# Start the system logger. +if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then + . /etc/rc.d/rc.syslog start +fi + +# Initialize PCMCIA devices: +# +# NOTE: This used to be started near the top of rc.S so that PCMCIA devices +# could be fsck'ed along with the other drives. This had some unfortunate +# side effects, however, since root isn't yet read-write, and /var might not +# even be mounted the .pid files can't be correctly written in /var/run and +# the pcmcia system can't be correctly shut down. If you want some PCMCIA +# partition to be mounted at boot (or when the card is inserted) then add +# the appropriate lines to /etc/pcmcia/scsi.opts. +# +if [ -x /etc/rc.d/rc.pcmcia ] ; then + . /etc/rc.d/rc.pcmcia start + # The cards might need a little extra time here to initialize. + if [ -r /var/run/cardmgr.pid ]; then + sleep 5 + fi +fi + +# Initialize the networking hardware. If your network driver is a module +# and you haven't loaded it manually, this will be deferred until after +# the hotplug system loads the module below. +#if [ -x /etc/rc.d/rc.inet1 ]; then +# . /etc/rc.d/rc.inet1 +#fi + +# Initialize the hotplugging subsystem for Cardbus, IEEE1394, PCI, and USB devices: +if [ -x /etc/rc.d/rc.hotplug -a -r /proc/modules ]; then + # Don't run hotplug if 'nohotplug' was given at boot. + if ! grep nohotplug /proc/cmdline 1> /dev/null 2> /dev/null ; then + echo "Activating hardware detection: /etc/rc.d/rc.hotplug start" + . /etc/rc.d/rc.hotplug start + fi +fi + +# Start networking daemons: +if [ -x /etc/rc.d/rc.inet2 ]; then + . /etc/rc.d/rc.inet2 +fi + +# Remove stale locks and junk files (must be done after mount -a!) +/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/core /core 2> /dev/null + +# Remove stale hunt sockets so the game can start. +if [ -r /tmp/hunt -o -r /tmp/hunt.stats ]; then + echo "Removing your stale hunt sockets from /tmp." + /bin/rm -f /tmp/hunt* +fi + +# Ensure basic filesystem permissions sanity. +chmod 755 / 2> /dev/null +chmod 1777 /tmp /var/tmp + +# Update all the shared library links: +if [ -x /sbin/ldconfig ]; then + echo "Updating shared library links: /sbin/ldconfig" + /sbin/ldconfig +fi + +# Update the X font indexes: +if [ -x /usr/X11R6/bin/fc-cache ]; then + echo "Updating X font indexes: /usr/X11R6/bin/fc-cache" + /usr/X11R6/bin/fc-cache +fi + +# Start the print spooling system. This will usually be LPRng (lpd) or CUPS. +if [ -x /etc/rc.d/rc.cups ]; then + # Start CUPS: + /etc/rc.d/rc.cups start +elif [ -x /etc/rc.d/rc.lprng ]; then + # Start LPRng (lpd): + . /etc/rc.d/rc.lprng start +fi + +# Start netatalk. (a file/print server for Macs using Appletalk) +if [ -x /etc/rc.d/rc.atalk ]; then + /etc/rc.d/rc.atalk +fi + +# Start smartd, which monitors the status of S.M.A.R.T. compatible +# hard drives and reports any problems. Note some devices (which aren't +# smart, I guess ;) will hang if probed by smartd, so it's commented out +# by default. +#if [ -x /usr/sbin/smartd ]; then +# /usr/sbin/smartd +#fi + +# Monitor the UPS with genpowerd. +# To use this, uncomment this section and edit your settings in +# /etc/genpowerd.conf (serial device, UPS type, etc). For more information, +# see "man genpowerd" or the extensive documentation in the +# /usr/doc/genpower-1.0.3 directory. +# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want +# support for stopping the UPS's inverter after the machine halts. +#if [ -x /sbin/genpowerd ]; then +# echo "Starting genpowerd daemon..." +# /sbin/genpowerd +#fi + +# Turn on process accounting. To enable process accounting, make sure the +# option for BSD process accounting is enabled in your kernel, and then +# create the file /var/log/pacct (touch /var/log/pacct). By default, process +# accounting is not enabled (since /var/log/pacct does not exist). This is +# because the log file can get VERY large. +if [ -x /sbin/accton -a -r /var/log/pacct ]; then + /sbin/accton /var/log/pacct + chmod 640 /var/log/pacct + echo "Process accounting turned on." +fi + +# Start crond (Dillon's crond): +# If you want cron to actually log activity to /var/log/cron, then change +# -l10 to -l8 to increase the logging level. +if [ -x /usr/sbin/crond ]; then + /usr/sbin/crond -l10 >>/var/log/cron 2>&1 +fi + +# Start atd (manages jobs scheduled with 'at'): +if [ -x /usr/sbin/atd ]; then + /usr/sbin/atd -b 15 -l 1 +fi + +# Slackware-Mini-Quota-HOWTO: +# To really activate quotas, you'll need to add 'usrquota' and/or 'grpquota' to +# the appropriate partitions as listed in /etc/fstab. Here's an example: +# +# /dev/hda2 /home ext3 defaults,usrquota 1 1 +# +# You'll then need to setup initial quota files at the top of the partitions +# to support quota, like this: +# touch /home/aquota.user /home/aquota.group +# chmod 600 /home/aquota.user /home/aquota.group +# +# Then, reboot to activate the system. +# To edit user quotas, use 'edquota'. See 'man edquota'. Also, the +# official Quota Mini-HOWTO has lots of useful information. That can be found +# here: /usr/doc/Linux-HOWTOs/Quota + +# Check quotas and then turn quota system on: +if grep -q quota /etc/fstab ; then + if [ -x /sbin/quotacheck ]; then + echo "Checking filesystem quotas: /sbin/quotacheck -avugm" + /sbin/quotacheck -avugm + fi + if [ -x /sbin/quotaon ]; then + echo "Activating filesystem quotas: /sbin/quotaon -avug" + /sbin/quotaon -avug + fi +fi + +# Start the sendmail daemon: +if [ -x /etc/rc.d/rc.sendmail ]; then + . /etc/rc.d/rc.sendmail start +fi + +# Start the APM daemon if APM is enabled in the kernel: +if [ -x /usr/sbin/apmd ]; then + if cat /proc/apm 1> /dev/null 2> /dev/null ; then + echo "Starting APM daemon: /usr/sbin/apmd" + /usr/sbin/apmd + fi +fi + +# Start the ACPI (Advanced Configuration and Power Interface) daemon: +if [ -x /etc/rc.d/rc.acpid ]; then + . /etc/rc.d/rc.acpid start +fi + +# Load ALSA (sound) defaults: +if [ -x /etc/rc.d/rc.alsa ]; then + . /etc/rc.d/rc.alsa +fi + +# Load a custom screen font if the user has an rc.font script. +if [ -x /etc/rc.d/rc.font ]; then + . /etc/rc.d/rc.font +fi + +# Load a custom keymap if the user has an rc.keymap script. +if [ -x /etc/rc.d/rc.keymap ]; then + . /etc/rc.d/rc.keymap +fi + +# Initialize HP Officejet support: +if [ -x /etc/rc.d/rc.hpoj ]; then + . /etc/rc.d/rc.hpoj start +fi + +# Start the MySQL database: +if [ -x /etc/rc.d/rc.mysqld ]; then + . /etc/rc.d/rc.mysqld start +fi + +# Start Apache web server: +if [ -x /etc/rc.d/rc.httpd ]; then + . /etc/rc.d/rc.httpd start +fi + +# Start Samba (a file/print server for Win95/NT machines). +# Samba can be started in /etc/inetd.conf instead. +if [ -x /etc/rc.d/rc.samba ]; then + . /etc/rc.d/rc.samba start +fi + +# Start the GPM mouse server: +if [ -x /etc/rc.d/rc.gpm ]; then + . /etc/rc.d/rc.gpm start +fi + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Start the local setup procedure. +if [ -x /etc/rc.d/rc.local ]; then + . /etc/rc.d/rc.local +fi + +# All done. diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.S b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.S new file mode 100755 index 0000000..05c75b4 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.S @@ -0,0 +1,294 @@ +#!/bin/sh +# +# /etc/rc.d/rc.S: System initialization script. +# +# Mostly written by: Patrick J. Volkerding, +# + +PATH=/sbin:/usr/sbin:/bin:/usr/bin + +# Mount /proc right away: +/sbin/mount -v proc /proc -n -t proc + +# If 'nohotplug' was given at boot, or rc.hotplug has been turned off +# (is not executable), then shut off hotplugging in the kernel now. +# Turning off hotplug is *not* recommended, and will break some things. +if [ -w /proc/sys/kernel/hotplug ]; then + if grep -w nohotplug /proc/cmdline 1> /dev/null 2> /dev/null ; then + echo "/dev/null" > /proc/sys/kernel/hotplug + elif [ ! -x /etc/rc.d/rc.hotplug ]; then + echo "/dev/null" > /proc/sys/kernel/hotplug + fi +fi + +# Start devfsd if necessary. On newer kernels, udev should be used instead. +if [ -x /etc/rc.d/rc.devfsd ]; then + /etc/rc.d/rc.devfsd start +fi + +# Mount sysfs next, if the kernel supports it: +if [ -d /sys ]; then + if cat /proc/filesystems | grep -w sysfs 1> /dev/null 2> /dev/null ; then + if ! cat /proc/mounts | grep -w sysfs 1> /dev/null 2> /dev/null ; then + /sbin/mount -v sysfs /sys -n -t sysfs + fi + fi +fi + +# Initialize udev to manage /dev entries for 2.6.x kernels: +if [ -x /etc/rc.d/rc.udev ]; then + if ! grep -w nohotplug /proc/cmdline 1> /dev/null 2> /dev/null ; then + /etc/rc.d/rc.udev + fi +fi + +# Enable swapping: +/sbin/swapon -a + +# Test to see if the root partition is read-only, like it ought to be. +READWRITE=no +if touch /fsrwtestfile 2>/dev/null; then + rm -f /fsrwtestfile + READWRITE=yes +else + echo "Testing root filesystem status: read-only filesystem" +fi + +# See if a forced filesystem check was requested at shutdown: +if [ -r /etc/forcefsck ]; then + FORCEFSCK="-f" +fi + +# Check the root filesystem: +if [ ! $READWRITE = yes ]; then + RETVAL=0 + if [ ! -r /etc/fastboot ]; then + echo "Checking root filesystem:" + /sbin/fsck $FORCEFSCK -C -a / + RETVAL=$? + fi + # An error code of 2 or higher will require a reboot. + if [ $RETVAL -ge 2 ]; then + # An error code equal to or greater than 4 means that some errors + # could not be corrected. This requires manual attention, so we + # offer a chance to try to fix the problem in single-user mode: + if [ $RETVAL -ge 4 ]; then + echo + echo "***********************************************************" + echo "*** An error occurred during the root filesystem check. ***" + echo "*** You will now be given a chance to log into the ***" + echo "*** system in single-user mode to fix the problem. ***" + echo "*** ***" + echo "*** If you are using the ext2 filesystem, running ***" + echo "*** 'e2fsck -v -y ' might help. ***" + echo "***********************************************************" + echo + echo "Once you exit the single-user shell, the system will reboot." + echo + PS1="(Repair filesystem) \#"; export PS1 + sulogin + else # With an error code of 2 or 3, reboot the machine automatically: + echo + echo "***********************************" + echo "*** The filesystem was changed. ***" + echo "*** The system will now reboot. ***" + echo "***********************************" + echo + fi + echo "Unmounting file systems." + /sbin/umount -a -r + /sbin/mount -n -o remount,ro / + echo "Rebooting system." + sleep 2 + reboot -f + fi + # Remount the root filesystem in read-write mode + echo "Remounting root device with read-write enabled." + /sbin/mount -w -v -n -o remount / + if [ $? -gt 0 ] ; then + echo + echo "Attempt to remount root device as read-write failed! This is going to" + echo "cause serious problems." + echo + echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition" + echo "read-write! You can make sure the root filesystem is getting mounted " + echo "read-write with the 'rw' flag to Loadlin:" + echo + echo "loadlin vmlinuz root=/dev/hda1 rw (replace /dev/hda1 with your root device)" + echo + echo "Normal bootdisks can be made to mount a system read-write with the rdev command:" + echo + echo "rdev -R /dev/fd0 0" + echo + echo "You can also get into your system by using a boot disk with a command like this" + echo "on the LILO prompt line: (change the root partition name as needed)" + echo + echo "LILO: mount root=/dev/hda1 rw" + echo + echo "Please press ENTER to continue, then reboot and use one of the above methods to" + echo -n "get into your machine and start looking for the problem. " + read junk; + fi +else + echo "Testing root filesystem status: read-write filesystem" + if cat /etc/fstab | grep ' / ' | grep umsdos 1> /dev/null 2> /dev/null ; then + ROOTTYPE="umsdos" + fi + if [ ! "$ROOTTYPE" = "umsdos" ]; then # no warn for UMSDOS + echo + echo "*** ERROR: Root partition has already been mounted read-write. Cannot check!" + echo + echo "For filesystem checking to work properly, your system must initially mount" + echo "the root partition as read only. Please modify your kernel with 'rdev' so that" + echo "it does this. If you're booting with LILO, add a line:" + echo + echo " read-only" + echo + echo "to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it." + echo + echo "If you boot from a kernel on a floppy disk, put it in the drive and type:" + echo " rdev -R /dev/fd0 1" + echo + echo "If you boot from a bootdisk, or with Loadlin, you can add the 'ro' flag." + echo + echo "This will fix the problem *AND* eliminate this annoying message. :^)" + echo + echo -n "Press ENTER to continue. " + read junk; + fi +fi # Done checking root filesystem + +# Any /etc/mtab that exists here is old, so we delete it to start over: +/bin/rm -f /etc/mtab* +# Remounting the / partition will initialize the new /etc/mtab: +/sbin/mount -w -o remount / + +# Fix /etc/mtab to list sys and proc if they were not yet entered in +# /etc/mtab because / was still mounted read-only: +if [ -d /proc/sys ]; then + /sbin/mount -f proc /proc -t proc +fi +if [ -d /sys/bus ]; then + /sbin/mount -f sysfs /sys -t sysfs +fi + +# Set the system time from the hardware clock using hwclock --hctosys. +if [ -x /sbin/hwclock ]; then + if grep "^UTC" /etc/hardwareclock 1> /dev/null 2> /dev/null ; then + echo "Setting system time from the hardware clock (UTC)." + /sbin/hwclock --utc --hctosys + else + echo "Setting system time from the hardware clock (localtime)." + /sbin/hwclock --localtime --hctosys + fi +fi + +# Configure ISA Plug-and-Play devices: +if [ -r /etc/isapnp.conf ]; then + if [ -x /sbin/isapnp ]; then + /sbin/isapnp /etc/isapnp.conf + fi +fi + +# This loads any kernel modules that are needed. These might be required to +# use your ethernet card, sound card, or other optional hardware. +if [ -x /etc/rc.d/rc.modules -a -r /proc/modules ]; then + . /etc/rc.d/rc.modules +fi + +# Configure runtime kernel parameters: +if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then + /sbin/sysctl -e -p /etc/sysctl.conf +fi + +# Initialize the Logical Volume Manager. +# This won't start unless we find /etc/lvmtab (LVM1) or +# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to +# use LVM you must run /sbin/vgscan yourself the first time (and +# create some VGs and LVs). +if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then + echo "Initializing LVM (Logical Volume Manager):" + # Check for device-mapper support. + if ! cat /proc/devices | grep -w device-mapper 1> /dev/null 2> /dev/null ; then + # If device-mapper exists as a module, try to load it. + if [ -r /lib/modules/$(cat /proc/sys/kernel/osrelease)/kernel/drivers/md/dm-mod.ko ]; then + insmod /lib/modules/$(cat /proc/sys/kernel/osrelease)/kernel/drivers/md/dm-mod.ko + fi + fi + # Scan for new volume groups: + /sbin/vgscan 2> /dev/null + if [ $? = 0 ]; then + # This needs a moment to register. + sleep 10 + # Make volume groups available to the kernel. + # This should also make logical volumes available. + /sbin/vgchange -ay + # Enable swapping again in case any LVs are used for swap. Ignore previous error. :-) + /sbin/swapon -a + fi +fi + +# Check all the non-root filesystems: +if [ ! -r /etc/fastboot ]; then + echo "Checking non-root filesystems:" + /sbin/fsck $FORCEFSCK -C -R -A -a +fi + +# mount non-root file systems in fstab (but not NFS or SMB +# because TCP/IP is not yet configured, and not proc because +# that has already been mounted): +/sbin/mount -a -v -t nonfs,nosmbfs,noproc + +# Clean up some temporary files: +( cd /var/log/setup/tmp && rm -rf * ) +/bin/rm -f /var/run/utmp /var/run/*pid /etc/nologin /var/run/lpd* \ + /var/run/ppp* /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot + +# Attempt to umount and remove any leftover /initrd: +if [ -d /initrd ]; then + /sbin/umount /initrd 2> /dev/null + rmdir /initrd 2> /dev/null + blockdev --flushbufs /dev/ram0 2> /dev/null +fi + +# Create a fresh utmp file: +touch /var/run/utmp +chown root.utmp /var/run/utmp +chmod 664 /var/run/utmp + +if [ "$ROOTTYPE" = "umsdos" ]; then # we need to update any files added in DOS: + echo "Synchronizing UMSDOS directory structure:" + echo " /sbin/umssync -r99 -v- /" + /sbin/umssync -r99 -v- / +fi + +# Setup the /etc/motd to reflect the current kernel level: +# THIS WIPES ANY CHANGES YOU MAKE TO /ETC/MOTD WITH EACH BOOT. +# COMMENT THIS OUT IF YOU WANT TO MAKE A CUSTOM VERSION. +echo "$(/bin/uname -sr)." > /etc/motd + +# If there are SystemV init scripts for this runlevel, run them. +if [ -x /etc/rc.d/rc.sysvinit ]; then + . /etc/rc.d/rc.sysvinit +fi + +# Run serial port setup script: +# (CAREFUL! This can make some systems hang if the rc.serial script isn't +# set up correctly. If this happens, you may have to edit the file from a +# boot disk) +# +# . /etc/rc.d/rc.serial + +# Carry an entropy pool between reboots to improve randomness. +if [ -f /etc/random-seed ]; then + echo "Using /etc/random-seed to initialize /dev/urandom." + cat /etc/random-seed > /dev/urandom +fi +# Use the pool size from /proc, or 512 bytes: +if [ -r /proc/sys/kernel/random/poolsize ]; then + dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null +else + dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null +fi +chmod 600 /etc/random-seed + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.httpd b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.httpd new file mode 100644 index 0000000..00b8837 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.httpd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# /etc/rc.d/rc.httpd +# +# Start/stop/restart the Apache web server. +# +# To make Apache start automatically at boot, make this +# file executable: chmod 755 /etc/rc.d/rc.httpd +# + +case "$1" in + 'start') + /usr/sbin/apachectl start ;; + 'stop') + /usr/sbin/apachectl stop ;; + 'restart') + /usr/sbin/apachectl restart ;; + *) + echo "usage $0 start|stop|restart" ;; +esac + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inet2 b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inet2 new file mode 100755 index 0000000..db56589 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inet2 @@ -0,0 +1,129 @@ +#!/bin/sh +# +# rc.inet2 This shell script boots up the entire network system. +# Note, that when this script is used to also fire +# up any important remote NFS disks (like the /usr +# directory), care must be taken to actually +# have all the needed binaries online _now_ ... +# +# Uncomment or comment out sections depending on which +# services your site requires. +# +# Author: Fred N. van Kempen, +# Modified for Slackware by Patrick Volkerding + + +# At this point, we are ready to talk to The World... + + +# Mount remote (NFS) filesystems: +if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then + # Start the RPC portmapper if we find NFS volumes defined in /etc/fstab, + # since it will need to be running in order to mount them. If portmap + # is not running, attempting to mount an NFS partition will cause mount + # to hang. Keep this in mind if you plan to mount unlisted partitions... + if [ -x /etc/rc.d/rc.portmap ]; then + . /etc/rc.d/rc.portmap start + else + # Warn about a possible NFS problem. It's also possible to mount NFS partitions + # without rpc.portmap by using '-o nolock' (not a good idea in most cases). + echo "WARNING: NFS partitions found in /etc/fstab, but /etc/rc.d/rc.portmap is" + echo " not executable. If you do not run portmap, NFS partitions will" + echo " not mount properly. To start rpc.portmap at boot, change the" + echo " permissions on /etc/rc.d/rc.portmap: chmod 755 /etc/rc.d/rc.portmap" + sleep 10 + fi + echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs" + /sbin/mount -a -t nfs # This may be our /usr runtime! + # Show the mounted volumes: + /sbin/mount -v -t nfs +fi + +# Load the RPC portmapper if /etc/rc.d/rc.portmap is executable. +# This might be needed to mount NFS partitions that are not listed in /etc/fstab. +if [ -x /etc/rc.d/rc.portmap ]; then + . /etc/rc.d/rc.portmap start +fi + +# Mount remote (SMB) filesystems: +if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then + echo "Mounting remote (SMB) file systems: /sbin/mount -a -t smbfs" + /sbin/mount -a -t smbfs + # Show the mounted volumes: + /sbin/mount -v -t smbfs +fi + +# Start the system logger if it is not already running (maybe because /usr +# is on a network partition). +if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then + . /etc/rc.d/rc.syslog start +fi + +# If there is a firewall script, run it before enabling packet forwarding. +# See the HOWTOs on http://www.netfilter.org/ for documentation on +# setting up a firewall or NAT on Linux. In some cases this might need to +# be moved past the section below dealing with IP packet forwarding. +if [ -x /etc/rc.d/rc.firewall ]; then + /etc/rc.d/rc.firewall start +fi + +# Turn on IPv4 packet forwarding support. +if [ -x /etc/rc.d/rc.ip_forward ]; then + . /etc/rc.d/rc.ip_forward start +fi + +# Start the inetd server: +if [ -x /etc/rc.d/rc.inetd ]; then + /etc/rc.d/rc.inetd start +fi + +# Start the OpenSSH SSH daemon: +if [ -x /etc/rc.d/rc.sshd ]; then + echo "Starting OpenSSH SSH daemon: /usr/sbin/sshd" + /etc/rc.d/rc.sshd start +fi + +# Start the BIND name server daemon: +if [ -x /etc/rc.d/rc.bind ]; then + /etc/rc.d/rc.bind start +fi + +# Start NIS (the Network Information Service): +if [ -x /etc/rc.d/rc.yp ]; then + . /etc/rc.d/rc.yp start +fi + +# Start the NFS server. Note that for this to work correctly, you'll +# need to load the knfsd module for kernel NFS server support. +# You'll also need to set up some shares in /etc/exports, and be sure +# that /etc/rc.d/rc.portmap is executable. +# Starting the NFS server: +if [ -x /etc/rc.d/rc.nfsd ]; then + /etc/rc.d/rc.nfsd start +fi + +# Stuff you won't need follows. ;-) + +# # Start the network routing daemon: +# if [ -x /usr/sbin/routed ]; then +# echo "Starting network routing daemon: /usr/sbin/routed" +# /usr/sbin/routed -g -s +# fi + +# # Start the system status server: +# if [ -x /usr/sbin/rwhod ]; then +# echo "Starting system status server: /usr/sbin/rwhod" +# /usr/sbin/rwhod +# fi + +# # Fire up the PC-NFS daemon(s). This is a primarily obsolete system, and may +# # not be very secure. It's not at all needed for normal NFS server support. +# # You probably should not run this. +# if [ -x /usr/sbin/rpc.pcnfsd ]; then +# echo "Starting PC-NFS daemons: /usr/sbin/rpc.pcnfsd /usr/sbin/rpc.bwnfsd" +# /usr/sbin/rpc.pcnfsd /var/spool/lpd +# fi +# if [ -x /usr/sbin/rpc.bwnfsd ]; then +# /usr/sbin/rpc.bwnfsd /var/spool/lpd +# fi + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inetd b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inetd new file mode 100644 index 0000000..9fe1419 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.inetd @@ -0,0 +1,36 @@ +#!/bin/sh +# Start/stop/restart inetd, the BSD Internet super-daemon. + +# Start inetd: +inetd_start() { + if [ -x /usr/sbin/inetd ]; then + echo "Starting Internet super-server daemon: /usr/sbin/inetd" + /usr/sbin/inetd + fi +} + +# Stop inetd: +inetd_stop() { + killall inetd +} + +# Restart inetd: +inetd_restart() { + inetd_stop + sleep 1 + inetd_start +} + +case "$1" in +'start') + inetd_start + ;; +'stop') + inetd_stop + ;; +'restart') + inetd_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward new file mode 100644 index 0000000..52bd2fe --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.ip_forward @@ -0,0 +1,64 @@ +#!/bin/sh +# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding +# +# If you intend to run your Linux box as a router, i.e. as a +# computer that forwards and redistributes network packets, you +# will need to enable IP packet forwarding in your kernel. +# +# To activate IP packet forwarding at boot time, make this +# script executable: chmod 755 /etc/rc.d/rc.ip_forward +# +# To disable IP packet forwarding at boot time, make this +# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward + +# Start IP packet forwarding: +ip_forward_start() { + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + echo "Activating IPv4 packet forwarding." + echo 1 > /proc/sys/net/ipv4/ip_forward + fi + # When using IPv4 packet forwarding, you will also get the + # rp_filter, which automatically rejects incoming packets if the + # routing table entry for their source address doesn't match the + # network interface they're arriving on. This has security + # advantages because it prevents the so-called IP spoofing, + # however it can pose problems if you use asymmetric routing + # (packets from you to a host take a different path than packets + # from that host to you) or if you operate a non-routing host + # which has several IP addresses on different interfaces. To + # turn rp_filter off, uncomment the lines below: + #if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then + # echo "Disabling rp_filter." + # echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter + #fi +} + +# Stop IP packet forwarding: +ip_forward_stop() { + if [ -f /proc/sys/net/ipv4/ip_forward ]; then + echo "Disabling IPv4 packet forwarding." + echo 0 > /proc/sys/net/ipv4/ip_forward + fi +} + +# Restart IP packet forwarding: +ip_forward_restart() { + ip_forward_stop + sleep 1 + ip_forward_start +} + +case "$1" in +'start') + ip_forward_start + ;; +'stop') + ip_forward_stop + ;; +'restart') + ip_forward_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.local b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.local new file mode 100755 index 0000000..3cf2076 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.local @@ -0,0 +1,5 @@ +#!/bin/sh +# +# /etc/rc.d/rc.local: Local system initialization script. +# +# Put any local setup commands in here: diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.mysqld b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.mysqld new file mode 100644 index 0000000..239e2e6 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.mysqld @@ -0,0 +1,80 @@ +#!/bin/sh +# Start/stop/restart mysqld. +# +# Copyright 2003 Patrick J. Volkerding, Concord, CA +# Copyright 2003 Slackware Linux, Inc., Concord, CA +# +# This program comes with NO WARRANTY, to the extent permitted by law. +# You may redistribute copies of this program under the terms of the +# GNU General Public License. + +# To start MySQL automatically at boot, be sure this script is executable: +# chmod 755 /etc/rc.d/rc.mysqld + +# Before you can run MySQL, you must have a database. To install an initial +# database, do this as root: +# +# su - mysql +# mysql_install_db +# +# Note that step one is becoming the mysql user. It's important to do this +# before making any changes to the database, or mysqld won't be able to write +# to it later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql'). + +# To disallow outside connections to the database (if you don't need them, this +# is recommended to increase security), uncomment the next line: +#SKIP="--skip-networking" + +# Start mysqld: +mysqld_start() { + if [ -x /usr/bin/mysqld_safe ]; then + # If there is an old PID file (no mysqld running), clean it up: + if [ -r /var/run/mysql/mysql.pid ]; then + if ! ps ax | grep mysqld 1> /dev/null 2> /dev/null ; then + echo "Cleaning up old /var/run/mysql/mysql.pid." + rm -f /var/run/mysql/mysql.pid + fi + fi + /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP & + fi +} + +# Stop mysqld: +mysqld_stop() { + # If there is no PID file, ignore this request... + if [ -r /var/run/mysql/mysql.pid ]; then + killall mysqld + # Wait at least one minute for it to exit, as we don't know how big the DB is... + for second in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 \ + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 60 ; do + if [ ! -r /var/run/mysql/mysql.pid ]; then + break; + fi + sleep 1 + done + if [ "$second" = "60" ]; then + echo "WARNING: Gave up waiting for mysqld to exit!" + sleep 15 + fi + fi +} + +# Restart mysqld: +mysqld_restart() { + mysqld_stop + mysqld_start +} + +case "$1" in +'start') + mysqld_start + ;; +'stop') + mysqld_stop + ;; +'restart') + mysqld_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.postfix b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.postfix new file mode 100644 index 0000000..bc32367 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.postfix @@ -0,0 +1,45 @@ +#!/bin/sh +# +## Slackware init script for postfix +## 20030828 Manolis Tzanidakis +# + +postfix_start() { + if [ -x /usr/sbin/postfix ]; then + echo -n "Starting postfix MTA: " + echo "/usr/sbin/postfix start" + /usr/sbin/postfix start 2>/dev/null + fi +} + +postfix_stop() { + /usr/sbin/postfix stop 2>/dev/null +} + +postfix_restart() { + sh $0 stop + sleep 1 + sh $0 start +} + +postfix_reload() { + /usr/sbin/postfix reload 2>/dev/null +} + +case "$1" in + 'start') + postfix_start + ;; + 'stop') + postfix_stop + ;; + 'restart') + postfix_restart + ;; + 'reload') + postfix_reload + ;; + *) + echo "usage $0 start|stop|restart|reload" +esac + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sendmail b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sendmail new file mode 100644 index 0000000..1a31c52 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sendmail @@ -0,0 +1,38 @@ +#!/bin/sh +# Start/stop/restart sendmail. + +# Start sendmail: +sendmail_start() { + if [ -x /usr/sbin/sendmail ]; then + echo "Starting sendmail MTA daemon: /usr/sbin/sendmail -L sm-mta -bd -q25m" + /usr/sbin/sendmail -L sm-mta -bd -q25m + echo "Starting sendmail MSP queue runner: /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m" + /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m + fi +} + +# Stop sendmail: +sendmail_stop() { + killall sendmail +} + +# Restart sendmail: +sendmail_restart() { + sendmail_stop + sleep 1 + sendmail_start +} + +case "$1" in +'start') + sendmail_start + ;; +'stop') + sendmail_stop + ;; +'restart') + sendmail_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.serial b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.serial new file mode 100755 index 0000000..5f31c01 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.serial @@ -0,0 +1,132 @@ +# +# /etc/rc.serial +# Initializes the serial ports on your system +# +# chkconfig: 2345 50 75 +# description: This initializes the settings of the serial port +# +# FILE_VERSION: 19981128 +# +# Distributed with setserial and the serial driver. We need to use the +# FILE_VERSION field to assure that we don't overwrite a newer rc.serial +# file with a newer one. +# +# XXXX For now, the autosave feature doesn't work if you are +# using the multiport feature; it doesn't save the multiport configuration +# (for now). Autosave also doesn't work for the hayes devices. +# + +RCLOCKFILE=/var/lock/subsys/serial +DIRS="/lib/modules/`uname -r`/misc /lib/modules /usr/lib/modules ." +PATH=/bin:/sbin:/usr/bin +DRIVER=serial +DRIVER_NAME=serial +MODULE_REGEXP="serial\b" + +ALLDEVS="/dev/ttyS?" +if /bin/ls /dev/ttyS?? >& /dev/null ; then + ALLDEVS="$ALLDEVS /dev/ttyS??" +fi + +SETSERIAL="" +if test -x /bin/setserial ; then + SETSERIAL=/bin/setserial +elif test -x /sbin/setserial ; then + SETSERIAL=/sbin/setserial +fi + +# +# See if the serial driver is loaded +# +LOADED="" +if test -f /proc/devices; then + if grep -q " ttyS$" /proc/devices ; then + LOADED="yes" + else + LOADED="no" + fi +fi + +# +# Find the serial driver +# +for i in $DIRS +do + if test -z "$MODULE" -a -f $i/$DRIVER.o ; then + MODULE=$i/$DRIVER.o + fi +done + +if ! test -f /proc/modules ; then + MODULE="" +fi + +# +# Handle System V init conventions... +# +case $1 in +start) + action="start"; + ;; +stop) + action="stop"; + ;; +*) + action="start"; +esac + +if test $action = stop ; then + if test -n ${SETSERIAL} -a "$LOADED" != "no" -a \ + `head -1 /etc/serial.conf`X = "###AUTOSAVE###X" ; then + echo -n "Saving state of serial devices... " + grep "^#" /etc/serial.conf > /etc/.serial.conf.new + ${SETSERIAL} -G -g ${ALLDEVS} >> /etc/.serial.conf.new + mv /etc/serial.conf /etc/.serial.conf.old + mv /etc/.serial.conf.new /etc/serial.conf + echo "done." + fi + if test -n "$MODULE" ; then + module=`grep $MODULE_REGEXP /proc/modules | awk '{print $1}'` + if test -z "$module" ; then + echo "The $DRIVER_NAME driver is not loaded." + rm -f ${RCLOCKFILE} + exit 0 + fi + if rmmod $module ; then :; else + echo "The $DRIVER_NAME driver could NOT be unloaded." + exit 1; + fi + echo "The $DRIVER_NAME driver has been unloaded." + fi + rm -f ${RCLOCKFILE} + exit 0 +fi + +# +# If not stop, it must be a start.... +# + +if test -n "$MODULE" -a "$LOADED" != "yes" ; then + if insmod -f $MODULE $DRIVER_ARG ; then + true + else + echo "Couldn't load $DRIVER_NAME driver." + exit 1 + fi +fi + +if test -f /etc/serial.conf ; then + if test -n ${SETSERIAL} ; then + grep -v ^# < /etc/serial.conf | while read device args + do + if [ ! "$device" = "" -a ! "$args" = "" ]; then + ${SETSERIAL} -z $device $args + fi + done + fi +else + echo "###AUTOSAVE###" > /etc/serial.conf +fi + +touch ${RCLOCKFILE} +${SETSERIAL} -bg ${ALLDEVS} diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sshd b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sshd new file mode 100755 index 0000000..a3707e3 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sshd @@ -0,0 +1,50 @@ +#!/bin/sh +# Start/stop/restart the secure shell server: + +sshd_start() { + # Create host keys if needed. + if [ ! -r /etc/ssh/ssh_host_key ]; then + /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N '' + fi + if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then + /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N '' + fi + if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then + /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' + fi + /usr/sbin/sshd +} + +sshd_stop() { + killall sshd +} + +sshd_restart() { + if [ -r /var/run/sshd.pid ]; then + echo "WARNING: killing listener process only. To kill every sshd process, you must" + echo " use 'rc.sshd stop'. 'rc.sshd restart' kills only the parent sshd to" + echo " allow an admin logged in through sshd to use 'rc.sshd restart' without" + echo " being cut off. If sshd has been upgraded, new connections will now" + echo " use the new version, which should be a safe enough approach." + kill `cat /var/run/sshd.pid` + else + killall sshd + fi + sleep 1 + sshd_start +} + +case "$1" in +'start') + sshd_start + ;; +'stop') + sshd_stop + ;; +'restart') + sshd_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac + diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.syslog b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.syslog new file mode 100755 index 0000000..a005fb7 --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.syslog @@ -0,0 +1,42 @@ +#!/bin/sh +# Start/stop/restart the system logging daemons. +# +# Written for Slackware Linux by Patrick J. Volkerding . + +syslogd_start() { + if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then + echo -n "Starting sysklogd daemons: " + echo -n "/usr/sbin/syslogd " + /usr/sbin/syslogd + sleep 1 # prevent syslogd/klogd race condition on SMP kernels + echo "/usr/sbin/klogd -c 3 -x" + # '-c 3' = display level 'error' or higher messages on console + # '-x' = turn off broken EIP translation + /usr/sbin/klogd -c 3 -x + fi +} + +syslogd_stop() { + killall syslogd 2> /dev/null + killall klogd 2> /dev/null +} + +syslogd_restart() { + syslogd_stop + sleep 1 + syslogd_start +} + +case "$1" in +'start') + syslogd_start + ;; +'stop') + syslogd_stop + ;; +'restart') + syslogd_restart + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit new file mode 100755 index 0000000..916e59e --- /dev/null +++ b/tags/0.5.1/templates/vserver/vserver.d/etc/rc.d/rc.sysvinit @@ -0,0 +1,58 @@ +#!/bin/sh +# +# rc.sysvinit This file provides basic compatibility with SystemV style +# startup scripts. The SystemV style init system places +# start/stop scripts for each runlevel into directories such as +# /etc/rc.d/rc3.d/ (for runlevel 3) instead of starting them +# from /etc/rc.d/rc.M. This makes for a lot more init scripts, +# and a more complicated execution path to follow through if +# something goes wrong. For this reason, Slackware has always +# used the traditional BSD style init script layout. +# +# However, many binary packages exist that install SystemV +# init scripts. With rc.sysvinit in place, most well-written +# startup scripts will work. This is primarily intended to +# support commercial software, though, and probably shouldn't +# be considered bug free. +# +# Written by Patrick Volkerding , 1999 +# from an example by Miquel van Smoorenburg . + +# Run an init script: +startup() { + case "$1" in + *.sh) + sh "$@" + ;; + *) + "$@" + ;; + esac +} + +# Set onlcr to avoid staircase effect. +stty onlcr 0>&1 + +if [ "$runlevel" = "" ]; then + runlevel=$RUNLEVEL + export runlevel + prevlevel=$PREVLEVEL + export prevlevel +fi + +# Run kill scripts in the previous runlevel if not "none" +if [ ! "$prevlevel" = "N" ]; then + for script in /etc/rc.d/rc$prevlevel.d/K* ; do + if [ -x $script ]; then + startup $script stop + fi + done +fi + +# Now do the startup scripts: +for script in /etc/rc.d/rc$runlevel.d/S* ; do + if [ -x $script ]; then + startup $script start + fi +done + -- cgit v1.2.3