diff options
author | Christian Heim <phreak@gentoo.org> | 2005-12-02 13:42:29 +0000 |
---|---|---|
committer | Christian Heim <phreak@gentoo.org> | 2005-12-02 13:42:29 +0000 |
commit | e576a92e444c7dad176ea69aacbf125c47ea57ff (patch) | |
tree | 9d4ccb3197cceb5fbf41d506e766d9cefc872330 | |
parent | Redoing a clean branch; starting it from scratch (diff) | |
download | baselayout-vserver-e576a92e444c7dad176ea69aacbf125c47ea57ff.tar.gz baselayout-vserver-e576a92e444c7dad176ea69aacbf125c47ea57ff.tar.bz2 baselayout-vserver-e576a92e444c7dad176ea69aacbf125c47ea57ff.zip |
Starting over again with baselayout revision 1649.
svn path=/baselayout-vserver/branches/baselayout-1_12/; revision=131
50 files changed, 241 insertions, 2510 deletions
diff --git a/ChangeLog.vserver b/ChangeLog.vserver new file mode 100644 index 0000000..33a564b --- /dev/null +++ b/ChangeLog.vserver @@ -0,0 +1,60 @@ +# ChangeLog for Gentoo System Intialization ("rc") scripts +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 + + 02 Dec 2005; Christian Heim <phreak@gentoo.org>: + Starting over again with baselayout revision 1649. + + Files changed: + ChangeLog.vserver | 60 ++++ + bin/rc-status | 6 + etc/conf.d/clock | 27 - + etc/conf.d/consolefont | 16 - + etc/conf.d/keymaps | 26 - + etc/conf.d/rc | 84 ------ + etc/filesystems | 14 - + etc/fstab | 30 -- + etc/inittab | 25 + + etc/issue | 3 + etc/issue.devfix | 21 - + etc/issue.logo | 13 + etc/modules.autoload.d/kernel-2.4 | 11 + etc/modules.autoload.d/kernel-2.6 | 10 + etc/modules.d/aliases | 46 --- + etc/modules.d/i386 | 4 + etc/sysctl.conf | 52 --- + init.d/bootmisc | 60 +--- + init.d/checkfs | 54 --- + init.d/checkroot | 124 --------- + init.d/clock | 144 ---------- + init.d/consolefont | 68 ----- + init.d/domainname | 2 + init.d/dummy | 13 + init.d/halt.sh | 181 ------------- + init.d/hostname | 4 + init.d/keymaps | 79 ----- + init.d/localmount | 47 --- + init.d/modules | 122 --------- + init.d/netmount | 106 ------- + init.d/numlock | 34 -- + init.d/reboot.sh | 2 + init.d/rmnologin | 4 + init.d/shutdown.sh | 2 + init.d/urandom | 37 -- + mkrelease.sh | 62 ++++ + man/modules-update.8 | 51 --- + man/modules.autoload.5 | 19 - + rc-lists/boot | 9 + rc-lists/default | 2 + rc-lists/nonetwork | 1 + sbin/MAKEDEV | 16 + + sbin/MAKEDEV-gentoo.patch | 109 -------- + sbin/functions.sh | 131 --------- + sbin/modules-update | 239 ----------------- + sbin/rc | 515 +------------------------------------- + sbin/rc-services.sh | 10 + sbin/runscript.sh | 3 + src/.cvsignore | 5 + tarball.sh | 48 --- + 50 files changed, 241 insertions(+), 2510 deletions(-) + +# vim:ts=4 diff --git a/bin/rc-status b/bin/rc-status index f5971bd..2056800 100755 --- a/bin/rc-status +++ b/bin/rc-status @@ -91,12 +91,10 @@ if [[ -z ${runlevel} ]] ; then runlevel=$(<${svcdir}/softlevel) else ewarn "Could not local current runlevel in ${svcdir}/softlevel" - if [[ -d ${runleveldir}/single ]] ; then - runlevel=single - elif [[ -d ${runleveldir}/default ]] ; then + if [[ -d ${runleveldir}/default ]] ; then runlevel=default else - eerror "Your installation is probably broken ... please \`emerge baselayout\`" + eerror "Your installation is probably broken ... please \`emerge baselayout-vserver\`" exit 1 fi ewarn "Assuming current runlevel is '${runlevel}'" diff --git a/etc/conf.d/clock b/etc/conf.d/clock deleted file mode 100644 index 2cb04c0..0000000 --- a/etc/conf.d/clock +++ /dev/null @@ -1,27 +0,0 @@ -# /etc/conf.d/clock - -# Set CLOCK to "UTC" if your system clock is set to UTC (also known as -# Greenwich Mean Time). If your clock is set to the local time, then -# set CLOCK to "local". Note that if you dual boot with Windows, then -# you should set it to "local". - -CLOCK="UTC" - -# If you wish to pass any other arguments to hwclock during bootup, -# you may do so here. - -CLOCK_OPTS="" - -# If you want to set the Hardware Clock to the current System Time -# during shutdown, then say "yes" here. - -CLOCK_SYSTOHC="no" - - -### ALPHA SPECIFIC OPTIONS ### - -# If your alpha uses the SRM console, set this to "yes". -SRM="no" - -# If your alpha uses the ARC console, set this to "yes". -ARC="no" diff --git a/etc/conf.d/consolefont b/etc/conf.d/consolefont deleted file mode 100644 index 7f430b1..0000000 --- a/etc/conf.d/consolefont +++ /dev/null @@ -1,16 +0,0 @@ -# /etc/conf.d/consolefont - -# CONSOLEFONT specifies the default font that you'd like Linux to use on the -# console. You can find a good selection of fonts in /usr/share/consolefonts; -# you shouldn't specify the trailing ".psf.gz", just the font name below. -# To use the default console font, comment out the CONSOLEFONT setting below. -# This setting is used by the /etc/init.d/consolefont script (NOTE: if you do -# not want to use it, run "rc-update del consolefont" as root). - -CONSOLEFONT="default8x16" - -# CONSOLETRANSLATION is the charset map file to use. Leave commented to use -# the default one. Have a look in /usr/share/consoletrans for a selection of -# map files you can use. - -#CONSOLETRANSLATION="8859-1_to_uni" diff --git a/etc/conf.d/keymaps b/etc/conf.d/keymaps deleted file mode 100644 index eb68fbe..0000000 --- a/etc/conf.d/keymaps +++ /dev/null @@ -1,26 +0,0 @@ -# /etc/conf.d/keymaps - -# Use KEYMAP to specify the default console keymap. There is a complete tree -# of keymaps in /usr/share/keymaps to choose from. - -KEYMAP="us" - - -# Should we first load the 'windowkeys' console keymap? Most x86 users will -# say "yes" here. Note that non-x86 users should leave it as "no". - -SET_WINDOWKEYS="no" - - -# The maps to load for extended keyboards. Most users will leave this as is. - -EXTENDED_KEYMAPS="" -#EXTENDED_KEYMAPS="backspace keypad euro" - - -# Tell dumpkeys(1) to interpret character action codes to be -# from the specified character set. -# This only matters if you set UNICODE="yes" in /etc/rc.conf. -# For a list of valid sets, run `dumpkeys --help` - -DUMPKEYS_CHARSET="" diff --git a/etc/conf.d/rc b/etc/conf.d/rc index 43c6a0d..3fd51ec 100644 --- a/etc/conf.d/rc +++ b/etc/conf.d/rc @@ -3,7 +3,7 @@ # This is the number of tty's used in most of the rc-scripts (like # consolefont, numlock, etc ...) -RC_TTY_NUMBER=11 +RC_TTY_NUMBER=0 # Set to "yes" if you want the rc system to try and start services # in parallel for a slight speed improvement. @@ -23,7 +23,7 @@ RC_PARALLEL_STARTUP="no" # yes - For this ALL network interfaces MUST be up for the 'net' service to # be considered up. -RC_NET_STRICT_CHECKING="no" +RC_NET_STRICT_CHECKING="none" # RC_AUTO_INTERFACE allows us to try and configure your interfaces # automatically. This includes: @@ -35,69 +35,16 @@ RC_NET_STRICT_CHECKING="no" RC_AUTO_INTERFACE="no" -# RC_VOLUME_ORDER allows you to specify, or even remove the volume setup -# for various volume managers (MD, EVMS2, LVM, DM, etc). Note that they are -# stopped in reverse order. - -RC_VERBOSE="no" - # RC_VERBOSE will make init scripts more verbose. Only networking scripts # really use this at this time, and this is useful for trouble shooting # any issues you may have. -RC_VOLUME_ORDER="raid evms lvm dm" - -# RC_BOOTLOG will generate a log of the boot messages shown on the console. -# Useful for headless machines or debugging. You need to emerge the -# app-admin/showconsole package for this to work. Note that this probably -# won't work correctly with boot splash. - -RC_BOOTLOG="no" - -# RC_USE_FSTAB allows you to override the default mount options for the -# standard /proc, /sys, /dev, and /dev/pts mount points. Note that this -# is the new way for selecting ramfs/tmpfs/etc... for udev mounting. - -RC_USE_FSTAB="no" - -# RC_USE_CONFIG_PROFILE allows you to have different /etc/conf.d files -# based on your runlevel - if a conf.d file for your profile does not exist -# then we try and use the default one. -# To enable runlevel selection at boot, append "softlevel=foobar" to your -# kernel line to change to the foobar runlevel. Here we would search for -# /etc/conf.d/<service>.foobar config files before trying to use the default -# /etc/conf.d/<service>. -# Note that it is only active if 'softlevel' was specified via the kernel line, -# and it is intended to use for different grub/lilo entries to specify config -# changes for say laptops between home and work, where you would have setup -# 'work' and 'home' runlevels, with /etc/conf.d/*.<runlevel> as needed. - -RC_USE_CONFIG_PROFILE="yes" - -# RC_FORCE_AUTO tries its best to prevent user interaction during the boot and -# shutdown process. For example, fsck will automatically be run or volumes -# remounted to create proper directory trees. This feature can be dangerous -# and is meant ONLY for headless machines where getting a physical console -# hooked up is a huge pita. - -RC_FORCE_AUTO="no" - -# Use this variable to control the /dev management behavior. -# auto - let the scripts figure out what's best at boot -# devfs - use devfs (requires sys-fs/devfsd) -# udev - use udev (requires sys-fs/udev) -# static - let the user manage /dev - -RC_DEVICES="auto" - -# UDEV OPTION: -# Set to "yes" if you want to save /dev to a tarball on shutdown -# and restore it on startup. This is useful if you have a lot of -# custom device nodes that udev does not handle/know about. - -RC_DEVICE_TARBALL="no" +RC_VERBOSE="no" +# RC_INITSTYLE_HACK allows it to use the old (obsoleted) init style of +# util-vserver +RC_INITSTYLE_HACK="no" # # Controlling start-stop-daemon behavior @@ -169,22 +116,3 @@ RC_WAIT_ON_START="0.1" # svcdir="/var/lib/init.d" svcdir="/var/lib/init.d" - - -# Should we mount $svcdir in a ram disk for some speed increase -# for slower machines, or for the more extreme setups ? - -svcmount="no" - - -# FS type that should be used for $svcdir. Note that you need -# $svcmount above set to "yes" for this to work ... Currently -# tmpfs, ramfs, and ramdisk are supported (tmpfs is the default). - -svcfstype="tmpfs" - - -# Size of $svcdir in KB. Note that ramfs doesn't support this -# due to kernel limitations. - -svcsize=2048 diff --git a/etc/filesystems b/etc/filesystems deleted file mode 100644 index de172c9..0000000 --- a/etc/filesystems +++ /dev/null @@ -1,14 +0,0 @@ -# /etc/filesystems -# -# This file defines the filesystems search order used by a -# 'mount -t auto' command. -# - -# Uncomment the following line if your modular kernel has vfat -# support and you want mount to try vfat. -#vfat - -# Keep the last '*' intact as it directs mount to use the -# filesystems list available at /proc/filesystems also. -# Don't remove it unless you REALLY knows what you are doing! -* diff --git a/etc/fstab b/etc/fstab deleted file mode 100644 index 64cb8de..0000000 --- a/etc/fstab +++ /dev/null @@ -1,30 +0,0 @@ -# /etc/fstab: static file system information. -# -# noatime turns off atimes for increased performance (atimes normally aren't -# needed; notail increases performance of ReiserFS (at the expense of storage -# efficiency). It's safe to drop the noatime options if you want and to -# switch between notail / tail freely. -# -# The root filesystem should have a pass number of either 0 or 1. -# All other filesystems should have a pass number of 0 or greater than 1. -# -# See the manpage fstab(5) for more information. -# - -# <fs> <mountpoint> <type> <opts> <dump/pass> - -# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. -/dev/BOOT /boot ext2 noauto,noatime 1 2 -/dev/ROOT / ext3 noatime 0 1 -/dev/SWAP none swap sw 0 0 -/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 -#/dev/fd0 /mnt/floppy auto noauto 0 0 - -# NOTE: The next line is critical for boot! -proc /proc proc defaults 0 0 - -# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for -# POSIX shared memory (shm_open, shm_unlink). -# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will -# use almost no memory if not populated with files) -shm /dev/shm tmpfs nodev,nosuid,noexec 0 0 diff --git a/etc/inittab b/etc/inittab new file mode 100644 index 0000000..6f7795a --- /dev/null +++ b/etc/inittab @@ -0,0 +1,25 @@ +# /etc/inittab: +# +# This file describes how the INIT process should set up +# the system in a certain run-level. + +# Default runlevel +id:3:initdefault: + +# System initialization, mount local filesystems, etc +si::sysinit:/sbin/rc sysinit + +# Further system initialization, brings up the boot runlevel. +rc::bootwait:/sbin/rc boot + +l0:0:wait:/sbin/rc shutdown +l1:S1:wait:/sbin/rc default +l2:2:wait:/sbin/rc default +l3:3:wait:/sbin/rc default +l4:4:wait:/sbin/rc default +l5:5:wait:/sbin/rc default +l6:6:wait:/sbin/rc reboot +#z6:6:respawn:/sbin/sulogin + +# What to do at the "Three Finger Salute". +ca:12345:ctrlaltdel:/sbin/shutdown -r now diff --git a/etc/issue b/etc/issue deleted file mode 100644 index 015e46d..0000000 --- a/etc/issue +++ /dev/null @@ -1,3 +0,0 @@ - -This is \n.\O (\s \m \r) \t - diff --git a/etc/issue.devfix b/etc/issue.devfix deleted file mode 100644 index 163e50f..0000000 --- a/etc/issue.devfix +++ /dev/null @@ -1,21 +0,0 @@ ------------------------------------------------------ -Your system seems to be missing critical device files -in /dev ! Although you may be running udev or devfs, -the root partition is missing these required files ! - -To rectify this situation, please do the following: -mkdir /mnt/fixit -mount --bind / /mnt/fixit -cp -a /dev/* /mnt/fixit/dev/ -umount /mnt/fixit -rmdir /mnt/fixit - -You may refer to these instructions at /etc/issue. -If you previously had an issue file, it has been -backed up at /etc/issue.devfix. Once you've fixed -your system, you will have to restore your old issue -file in order to get rid of this warning. - -Thanks for using Gentoo ! :) -http://bugs.gentoo.org/show_bug.cgi?id=40987 ------------------------------------------------------ diff --git a/etc/issue.logo b/etc/issue.logo deleted file mode 100644 index d8e20ef..0000000 --- a/etc/issue.logo +++ /dev/null @@ -1,13 +0,0 @@ -[0;35;40m . -[0;35;40m .vir. d$b -[0;35;40m .d$$$$$$b. .cd$$b. .d$$b. d$$$$$$$$$$$b .d$$b. .d$$b. -[0;35;40m $$$$( )$$$b d$$$()$$$. d$$$$$$$b Q$$$$$$$P$$$P.$$$$$$$b. .$$$$$$$b. -[0;35;40m Q$$$$$$$$$$B$$$$$$$$P" d$$$PQ$$$$b. $$$$. .$$$P' `$$$ .$$$P' `$$$ -[0;35;40m "$$$$$$$P Q$$$$$$$b d$$$P Q$$$$b $$$$b $$$$b..d$$$ $$$$b..d$$$ -[0;35;40m d$$$$$$P" "$$$$$$$$ Q$$$ Q$$$$ $$$$$ `Q$$$$$$$P `Q$$$$$$$P -[0;35;40m $$$$$$$P `""""" "" "" Q$$$P "Q$$$P" "Q$$$P" -[0;35;40m `Q$$P" """ -[0;37;40m - -This is \n.\O (\s \m \r) \t - diff --git a/etc/modules.autoload.d/kernel-2.4 b/etc/modules.autoload.d/kernel-2.4 deleted file mode 100644 index a92bec1..0000000 --- a/etc/modules.autoload.d/kernel-2.4 +++ /dev/null @@ -1,11 +0,0 @@ -# /etc/modules.autoload.d/kernel-2.4: kernel modules to load when system boots. -# -# Note that this file is for 2.4 kernels. If you need different modules -# for a 2.6 kernel, you can create /etc/modules.autoload.d/kernel-2.6 -# -# Add the names of modules that you'd like to load when the system -# starts into this file, one per line. Comments begin with # and -# are ignored. Read man modules.autoload for additional details. - -# For example: -# 3c59x diff --git a/etc/modules.autoload.d/kernel-2.6 b/etc/modules.autoload.d/kernel-2.6 deleted file mode 100644 index 6a9efab..0000000 --- a/etc/modules.autoload.d/kernel-2.6 +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots. -# -# Note that this file is for 2.6 kernels. -# -# Add the names of modules that you'd like to load when the system -# starts into this file, one per line. Comments begin with # and -# are ignored. Read man modules.autoload for additional details. - -# For example: -# 3c59x diff --git a/etc/modules.d/aliases b/etc/modules.d/aliases deleted file mode 100644 index 85ff710..0000000 --- a/etc/modules.d/aliases +++ /dev/null @@ -1,46 +0,0 @@ -# Aliases to tell insmod/modprobe which modules to use - -# Uncomment the network protocols you don't want loaded: -# alias net-pf-1 off # Unix -# alias net-pf-2 off # IPv4 -# alias net-pf-3 off # Amateur Radio AX.25 -# alias net-pf-4 off # IPX -# alias net-pf-5 off # DDP / appletalk -# alias net-pf-6 off # Amateur Radio NET/ROM -# alias net-pf-9 off # X.25 -# alias net-pf-10 off # IPv6 -# alias net-pf-11 off # ROSE / Amateur Radio X.25 PLP -# alias net-pf-19 off # Acorn Econet - -alias char-major-10-175 agpgart -alias char-major-10-200 tun -alias char-major-81 bttv -alias char-major-108 ppp_generic -alias /dev/ppp ppp_generic -alias tty-ldisc-3 ppp_async -alias tty-ldisc-14 ppp_synctty -alias ppp-compress-21 bsd_comp -alias ppp-compress-24 ppp_deflate -alias ppp-compress-26 ppp_deflate - -# Crypto modules (see http://www.kerneli.org/) -alias loop-xfer-gen-0 loop_gen -alias loop-xfer-3 loop_fish2 -alias loop-xfer-gen-10 loop_gen -alias cipher-2 des -alias cipher-3 fish2 -alias cipher-4 blowfish -alias cipher-6 idea -alias cipher-7 serp6f -alias cipher-8 mars6 -alias cipher-11 rc62 -alias cipher-15 dfc2 -alias cipher-16 rijndael -alias cipher-17 rc5 - -# Support for i2c and lm_sensors -alias char-major-89 i2c-dev - -# Old nvidia support ... -alias char-major-195 NVdriver -alias /dev/nvidiactl char-major-195 diff --git a/etc/modules.d/i386 b/etc/modules.d/i386 deleted file mode 100644 index b89459f..0000000 --- a/etc/modules.d/i386 +++ /dev/null @@ -1,4 +0,0 @@ -alias parport_lowlevel parport_pc -alias char-major-10-144 nvram -alias binfmt-0064 binfmt_aout -alias char-major-10-135 rtc diff --git a/etc/sysctl.conf b/etc/sysctl.conf deleted file mode 100644 index 06d16fe..0000000 --- a/etc/sysctl.conf +++ /dev/null @@ -1,52 +0,0 @@ -# /etc/sysctl.conf -# -# For more information on how this file works, please see -# the manpages sysctl(8) and sysctl.conf(5). -# -# In order for this file to work properly, you must first -# enable 'Sysctl support' in the kernel. -# -# Look in /proc/sys/ for all the things you can setup. -# - -# Disables packet forwarding -#net.ipv4.ip_forward = 0 -# Disables IP dynaddr -#net.ipv4.ip_dynaddr = 0 -# Disable ECN -#net.ipv4.tcp_ecn = 0 -# Enables source route verification -net.ipv4.conf.default.rp_filter = 1 -# Enable reverse path -net.ipv4.conf.all.rp_filter = 1 - -# Enable SYN cookies (yum!) -# http://cr.yp.to/syncookies.html -#net.ipv4.tcp_syncookies = 1 - -# Disable source route -#net.ipv4.conf.all.accept_source_route = 0 -#net.ipv4.conf.default.accept_source_route = 0 - -# Disable redirects -#net.ipv4.conf.all.accept_redirects = 0 -#net.ipv4.conf.default.accept_redirects = 0 - -# Disable secure redirects -#net.ipv4.conf.all.secure_redirects = 0 -#net.ipv4.conf.default.secure_redirects = 0 - -# Ignore ICMP broadcasts -#net.ipv4.icmp_echo_ignore_broadcasts = 1 - -# Disables the magic-sysrq key -#kernel.sysrq = 0 -# When the kernel panics, automatically reboot in 3 seconds -#kernel.panic = 3 -# Allow for more PIDs (cool factor!); may break some programs -#kernel.pid_max = 999999 - -# TCP Port for lock manager -#fs.nfs.nlm_tcpport = 0 -# UDP Port for lock manager -#fs.nfs.nlm_udpport = 0 diff --git a/init.d/bootmisc b/init.d/bootmisc index ad7637f..f9a76b3 100755 --- a/init.d/bootmisc +++ b/init.d/bootmisc @@ -3,8 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 depend() { - use clock hostname - need localmount + use hostname before logger } @@ -20,13 +19,7 @@ start() { cp /etc/nologin /etc/nologin.boot &> /dev/null fi - if [[ -e /etc/sysctl.conf ]] ; then - ebegin "Configuring kernel parameters" - /sbin/sysctl -q -p /etc/sysctl.conf - eend 0 - fi - - if [[ -z ${CDBOOT} ]] && ! touch /var/run/.keep 2> /dev/null ; then + if ! touch /var/run/.keep 2> /dev/null ; then ewarn "Skipping /var and /tmp initialization (ro root?)" return 0 fi @@ -50,31 +43,23 @@ start() { ebegin "Cleaning /var/lock, /var/run" rm -rf /var/run/console.lock /var/run/console/* - if [[ -z ${CDBOOT} ]] ; then - # - # Clean up any stale locks. - # - find /var/lock -type f -print0 | xargs -0 rm -f -- - # - # Clean up /var/run and create /var/run/utmp so that we can login. - # - for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) ; do - local daemon=${x##*/} - daemon=${daemon%*.pid} - # Do not remove pidfiles of already running daemons - if [[ -z $(ps --no-heading -C "${daemon}") ]] ; then - if [[ -f ${x} || -L ${x} ]] ; then - rm -f "${x}" - fi + # + # Clean up any stale locks. + # + find /var/lock -type f -print0 | xargs -0 rm -f -- + # + # Clean up /var/run and create /var/run/utmp so that we can login. + # + for x in $(find /var/run/ ! -type d ! -name utmp ! -name innd.pid ! -name random-seed) ; do + local daemon=${x##*/} + daemon=${daemon%*.pid} + # Do not remove pidfiles of already running daemons + if [[ -z $(ps --no-heading -C "${daemon}") ]] ; then + if [[ -f ${x} || -L ${x} ]] ; then + rm -f "${x}" fi - done - fi - - # Reset pam_console permissions if we are actually using it - if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \ - -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]] ; then - /sbin/pam_console_apply -r - fi + fi + done # Create the .keep to stop portage from removing /var/lock > /var/lock/.keep @@ -83,7 +68,7 @@ start() { # # Clean up /tmp directory # - if [[ -z ${CDBOOT} ]] && [[ -d /tmp ]] ; then + if [[ -d /tmp ]] ; then cd /tmp if [[ ${WIPE_TMP} == "yes" ]] ; then ebegin "Wiping /tmp directory" @@ -125,13 +110,6 @@ start() { fi # - # Create an 'after-boot' dmesg log - # - touch /var/log/dmesg - chmod 640 /var/log/dmesg - dmesg > /var/log/dmesg - - # # Check for /etc/resolv.conf, and create if missing # [[ -f /etc/resolv.conf ]] || touch /etc/resolv.conf &> /dev/null diff --git a/init.d/checkfs b/init.d/checkfs deleted file mode 100755 index 9baa621..0000000 --- a/init.d/checkfs +++ /dev/null @@ -1,54 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need checkroot modules -} - -start() { - local retval=0 - - # Start RAID/LVM/EVMS/DM volumes for /usr, /var, etc. - # NOTE: this should be done *before* mounting anything - [[ -z ${CDBOOT} ]] && start_volumes - - # Setup dm-crypt mappings if any - start_addon dm-crypt - - if [[ -f /fastboot ]] || [[ -n ${CDBOOT} ]] ; then - rm -f /fastboot - else - ebegin "Checking all filesystems" - if [[ -f /forcefsck ]] ; then - ewarn "A full fsck has been forced" - fsck -C -T -R -A -a -f - retval=$? - rm -f /forcefsck - else - fsck -C -T -R -A -a - retval=$? - fi - if [[ ${retval} -eq 0 ]] ; then - eend 0 - elif [[ ${retval} -ge 1 && ${retval} -le 3 ]] ; then - ewend 1 "Filesystem errors corrected." - # Everything should be ok, so return a pass - return 0 - else - if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then - eend 2 "Fsck could not correct all errors, rerunning" - fsck -C -T -R -A -y - retval=$? - fi - - if [[ ${retval} -gt 3 ]] ; then - eend 2 "Fsck could not correct all errors, manual repair needed" - /sbin/sulogin ${CONSOLE} - fi - fi - fi -} - - -# vim:ts=4 diff --git a/init.d/checkroot b/init.d/checkroot deleted file mode 100755 index c7499dd..0000000 --- a/init.d/checkroot +++ /dev/null @@ -1,124 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - before * -} - -start() { - local retval=0 - - if [[ ! -f /fastboot && -z ${CDBOOT} ]] && ! is_net_fs / ; then - if touch -c / >& /dev/null ; then - ebegin "Remounting root filesystem read-only" - mount -n -o remount,ro / - eend $? - fi - - if [[ -f /forcefsck ]] || get_bootparam "forcefsck" ; then - ebegin "Checking root filesystem (full fsck forced)" - fsck -C -a -f / - # /forcefsck isn't deleted because checkfs needs it. - # it'll be deleted in that script. - retval=$? - else - # Obey the fs_passno setting for / (see fstab(5)) - # - find the / entry - # - make sure we have 6 fields - # - see if fs_passno is something other than 0 - if [[ -n $(awk '($1 ~ /^(\/|UUID|LABEL)/ && $2 == "/" \ - && NF == 6 && $6 != 0) { print }' /etc/fstab) ]] - then - ebegin "Checking root filesystem" - fsck -C -T -a / - retval=$? - else - ebegin "Skipping root filesystem check (fstab's passno == 0)" - retval=0 - fi - fi - - if [[ ${retval} -eq 0 ]] ; then - eend 0 - elif [[ ${retval} -eq 1 ]] ; then - ewend 1 "Filesystem repaired" - elif [[ ${retval} -eq 2 || ${retval} -eq 3 ]] ; then - ewend 1 "Filesystem repaired, but reboot needed!" - echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1 - echo -ne "\a"; sleep 1; echo -ne "\a"; sleep 1 - ewarn "Rebooting in 10 seconds ..." - sleep 10 - einfo "Rebooting" - /sbin/reboot -f - else - if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then - eend 2 "Rerunning fsck in force mode" - fsck -y -C -T / - else - eend 2 "Filesystem couldn't be fixed :(" - /sbin/sulogin ${CONSOLE} - fi - einfo "Unmounting filesystems" - /bin/mount -a -o remount,ro &> /dev/null - einfo "Rebooting" - /sbin/reboot -f - fi - fi - - # Should we mount root rw ? - if mount -vf -o remount / 2> /dev/null | \ - awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' - then - ebegin "Remounting root filesystem read/write" - mount -n -o remount,rw / &> /dev/null - if [[ $? -ne 0 ]] ; then - eend 2 "Root filesystem could not be mounted read/write :(" - if [[ ${RC_FORCE_AUTO} != "yes" ]] ; then - /sbin/sulogin ${CONSOLE} - fi - else - eend 0 - fi - fi - - if [[ ${BOOT} == "yes" ]] ; then - local x= - local y= - - # - # Create /etc/mtab - # - - # Don't create mtab if /etc is readonly - if ! touch /etc/mtab 2> /dev/null ; then - ewarn "Skipping /etc/mtab initialization (ro root?)" - return 0 - fi - - # Clear the existing mtab - > /etc/mtab - - # Add the entry for / to mtab - mount -f / - - # Don't list root more than once - awk '$2 != "/" {print}' /proc/mounts >> /etc/mtab - - # Now make sure /etc/mtab have additional info (gid, etc) in there - for x in $(awk '{ print $2 }' /proc/mounts | sort -u) ; do - for y in $(awk '{ print $2 }' /etc/fstab) ; do - if [[ ${x} == ${y} ]] ; then - mount -f -o remount $x - continue - fi - done - done - - # Remove stale backups - rm -f /etc/mtab~ /etc/mtab~~ - fi -} - - -# vim:ts=4 diff --git a/init.d/clock b/init.d/clock deleted file mode 100755 index 82465eb..0000000 --- a/init.d/clock +++ /dev/null @@ -1,144 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -opts="save" - -depend() { - need localmount -} - -setupopts() { - if is_uml_sys ; then - TBLURB="UML" - fakeit=1 - elif is_vserver_sys ; then - TBLURB="VServer" - fakeit=1 - elif is_xenU_sys ; then - TBLURB="xen" - fakeit=1 - elif grep -q ' cobd$' /proc/devices ; then - TBLURB="coLinux" - fakeit=1 - elif [[ ${CLOCK} == "UTC" ]] ; then - myopts="--utc" - TBLURB="UTC" - else - myopts="--localtime" - TBLURB="Local Time" - fi - [[ ${fakeit} -eq 1 ]] && return 0 - - if [[ ${readonly} == "yes" ]] ; then - myadj="--noadjfile" - else - myadj="--adjust" - fi - - if [[ ${SRM} == "yes" ]] ; then - myopts="${myopts} --srm" - fi - if [[ ${ARC} == "arc" ]] ; then - myopts="${myopts} --arc" - fi - myopts="${myopts} ${CLOCK_OPTS}" - - # Make sure user isn't using rc.conf anymore. - if grep -qs ^CLOCK= /etc/rc.conf ; then - ewarn "CLOCK should not be set in /etc/rc.conf but in /etc/conf.d/clock" - fi -} - -start() { - local myopts="" - local myadj="" - local TBLURB="" fakeit=0 - local errstr="" - local readonly="no" - local ret=0 - - if ! touch /etc/adjtime 2>/dev/null ; then - readonly="yes" - elif [[ ! -s /etc/adjtime ]] ; then - echo "0.0 0 0.0" > /etc/adjtime - fi - - setupopts - - if [[ ${fakeit} -ne 1 && ! -e /dev/rtc ]] ; then - local x - einfon "Waiting for /dev/rtc to appear" - for x in $(seq 10) ; do - if [[ ! -e /dev/rtc ]] ; then - echo -n "." - sleep 1 - else - echo - fi - done - fi - - ebegin "Setting system clock using the hardware clock [${TBLURB}]" - if [[ ${fakeit} -eq 1 ]] ; then - ret=0 - - elif [[ -x /sbin/hwclock ]] ; then - # Since hwclock always exit's with a 0, need to check its output. - errstr=$(/sbin/hwclock ${myadj} ${myopts} 2>&1 >/dev/null) - errstr="${errstr}$(/sbin/hwclock --hctosys ${myopts} 2>&1 >/dev/null)" - - if [[ -n ${errstr} ]] ; then - ewarn "${errstr}" - ret=1 - else - ret=0 - fi - errstr="Failed to set system clock to hardware clock" - else - ret=1 - errstr="/sbin/hwclock not found" - fi - eend ${ret} "${errstr}" -} - -stop() { - # Don't tweak the hardware clock on LiveCD halt. - [[ -n ${CDBOOT} ]] && return 0 - - [[ ${CLOCK_SYSTOHC} != "yes" ]] && return 0 - - local myopts="" - local TBLURB="" - local errstr="" - local ret=0 - - setupopts - - ebegin "Setting hardware clock using the system clock [${TBLURB}]" - if [[ ${fakeit} -eq 1 ]] ; then - ret=0 - - elif [[ -x /sbin/hwclock ]] ; then - errstr=$(/sbin/hwclock --systohc ${myopts} 2>&1 >/dev/null) - - if [[ -n ${errstr} ]] ; then - ret=1 - else - ret=0 - fi - errstr="Failed to sync clocks" - else - ret=1 - errstr="/sbin/hwclock not found" - fi - eend ${ret} "${errstr}" -} - -save() { - CLOCK_SYSTOHC="yes" - stop -} - - -# vim:ts=4 diff --git a/init.d/consolefont b/init.d/consolefont deleted file mode 100755 index 35daa11..0000000 --- a/init.d/consolefont +++ /dev/null @@ -1,68 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need localmount - need keymaps # sets up terminal encoding scheme - after hotplug -} - -start() { - if is_uml_sys ; then - ebegin "Setting user font" - eend 0 - return 0 - elif [[ -z ${CONSOLEFONT} ]] ; then - ebegin "Using the default console font" - eend 0 - return 0 - fi - - local x= - local param= - local sf_param= - local retval=1 - - # Get additional parameters - if [[ -n ${CONSOLETRANSLATION} ]] ; then - param="-m ${CONSOLETRANSLATION}" - fi - - # Set the console font - local errmsg="" - ebegin "Setting user font" - if [[ -x /bin/setfont ]] ; then - # We patched setfont to have --tty support ... - if [[ -n $(setfont --help 2>&1 | grep -e '--tty') || \ - -n $(setfont --help 2>&1 | grep -e '-C') ]] - then - if [[ -n $(setfont --help 2>&1 | grep -e '--tty') ]] ; then - sf_param="--tty=" - else - sf_param="-C " - fi - local ttydev= - [[ -d /dev/vc ]] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - - for x in $(seq 1 "${RC_TTY_NUMBER}") ; do - /bin/setfont ${CONSOLEFONT} ${param} \ - ${sf_param}/${ttydev}${x} > /dev/null - retval=$? - done - else - /bin/setfont ${CONSOLEFONT} ${param} > /dev/null - retval=$? - fi - errmsg="Failed to set user font" - else - retval=1 - errmsg="/bin/setfont not found" - fi - eend ${retval} "${errmsg}" -} - - -# vim:ts=4 diff --git a/init.d/domainname b/init.d/domainname index eeeacb1..619ad38 100755 --- a/init.d/domainname +++ b/init.d/domainname @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 depend() { - need checkroot hostname + need hostname before bootmisc } diff --git a/init.d/dummy b/init.d/dummy new file mode 100755 index 0000000..de50a10 --- /dev/null +++ b/init.d/dummy @@ -0,0 +1,13 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +start() { + return 0 +} + +stop() { + return 0 +} + +# vim:ts=4 diff --git a/init.d/halt.sh b/init.d/halt.sh index 34d7fe5..d6a8174 100755 --- a/init.d/halt.sh +++ b/init.d/halt.sh @@ -1,189 +1,8 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# Check to see if this is a livecd, if it is read the commandline -# this mainly makes sure $CDBOOT is defined if it's a livecd -[[ -f /sbin/livecd-functions.sh ]] && \ - source /sbin/livecd-functions.sh && \ - livecd_read_commandline - -# Reset pam_console permissions if we are actually using it -if [[ -x /sbin/pam_console_apply && ! -c /dev/.devfsd && \ - -n $(grep -v -e '^[[:space:]]*#' /etc/pam.d/* | grep 'pam_console') ]]; then - /sbin/pam_console_apply -r -fi - -stop_addon devfs -stop_addon udev - -# Try to unmount all tmpfs filesystems not in use, else a deadlock may -# occure, bug #13599. -umount -at tmpfs &>/dev/null - -if [[ -n $(swapon -s 2>/dev/null) ]]; then - ebegin "Deactivating swap" - swapoff -a - eend $? -fi - # Write a reboot record to /var/log/wtmp before unmounting halt -w &>/dev/null -# Unmounting should use /proc/mounts and work with/without devfsd running - -# Credits for next function to unmount loop devices, goes to: -# -# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# Modified for RHS Linux by Damien Neil -# -# -# Unmount file systems, killing processes if we have to. -# Unmount loopback stuff first -# Use `umount -d` to detach the loopback device - -# Remove loopback devices started by dm-crypt - -remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \ - sort -r | grep -v '/newroot' | grep -v '/mnt/livecd') -[[ -n ${remaining} ]] && { - sig= - retry=3 - - while [[ -n ${remaining} && ${retry} -gt 0 ]]; do - if [[ ${retry} -lt 3 ]]; then - ebegin "Unmounting loopback filesystems (retry)" - umount -d ${remaining} &>/dev/null - eend $? "Failed to unmount filesystems this retry" - else - ebegin "Unmounting loopback filesystems" - umount -d ${remaining} &>/dev/null - eend $? "Failed to unmount filesystems" - fi - - remaining=$(awk '!/^#/ && $1 ~ /^\/dev\/loop/ && $2 != "/" {print $2}' /proc/mounts | \ - sort -r | grep -v '/newroot' | grep -v '/mnt/livecd') - [[ -z ${remaining} ]] && break - - /bin/fuser -k -m ${sig} ${remaining} &>/dev/null - sleep 5 - retry=$((${retry} - 1)) - sig=-9 - done -} - -# Try to unmount all filesystems (no /proc,tmpfs,devfs,etc). -# This is needed to make sure we dont have a mounted filesystem -# on a LVM volume when shutting LVM down ... -ebegin "Unmounting filesystems" -unmounts=$( \ - awk '{ \ - if (($3 !~ /^(proc|devpts|sysfs|devfs|tmpfs|usb(dev)?fs)$/) && \ - ($1 != "none") && \ - ($1 !~ /^(rootfs|\/dev\/root)$/) && \ - ($2 != "/")) \ - print $2 }' /proc/mounts | sort -ur) -for x in ${unmounts}; do - # Do not umount these if we are booting off a livecd - if [[ -n ${CDBOOT} ]] && \ - [[ ${x} == "/mnt/cdrom" || ${x} == "/mnt/livecd" ]] ; then - continue - fi - - x=${x//\\040/ } - if ! umount "${x}" &>/dev/null; then - # If its /usr, just ignore it .. we will mount it ro below ... - # This is to prevent killing bash on systems using locales. - [[ ${x} == "/usr" ]] && continue - # Kill processes still using this mount - /bin/fuser -k -m -9 "${x}" &>/dev/null - sleep 2 - # Now try to unmount it again ... - umount -f -r "${x}" &>/dev/null - fi -done -eend 0 - -# Try to remove any dm-crypt mappings -stop_addon dm-crypt - -# Stop LVM, etc -stop_volumes - -# This is a function because its used twice below -ups_kill_power() { - local UPS_CTL UPS_POWERDOWN - if [[ -f /etc/killpower ]] ; then - UPS_CTL=/sbin/upsdrvctl - UPS_POWERDOWN="${UPS_CTL} shutdown" - elif [[ -f /etc/apcupsd/powerfail ]] ; then - UPS_CTL=/etc/apcupsd/apccontrol - UPS_POWERDOWN="${UPS_CTL} killpower" - else - return 0 - fi - if [[ -x ${UPS_CTL} ]] ; then - ewarn "Signalling ups driver(s) to kill the load!" - ${UPS_POWERDOWN} - ewarn "Halt system and wait for the UPS to kill our power" - /sbin/halt -id - while [ 1 ]; do sleep 60; done - fi -} - -mount_readonly() { - local x= - local retval=0 - local cmd=$1 - - # Get better results with a sync and sleep - sync; sync - sleep 1 - - for x in $(awk '$1 != "none" { print $2 }' /proc/mounts | sort -ur) ; do - x=${x//\\040/ } - if [[ ${cmd} == "u" ]]; then - umount -n -r "${x}" - else - mount -n -o remount,ro "${x}" &>/dev/null - fi - retval=$((${retval} + $?)) - done - [[ ${retval} -ne 0 ]] && killall5 -9 &>/dev/null - - return ${retval} -} - -# Since we use `mount` in mount_readonly(), but we parse /proc/mounts, we -# have to make sure our /etc/mtab and /proc/mounts agree -cp /proc/mounts /etc/mtab &>/dev/null -ebegin "Remounting remaining filesystems readonly" -mount_worked=0 -if ! mount_readonly ; then - if ! mount_readonly ; then - # If these things really don't want to remount ro, then - # let's try to force them to unmount - if ! mount_readonly u ; then - mount_worked=1 - fi - fi -fi -eend ${mount_worked} -if [[ ${mount_worked} -eq 1 ]]; then - ups_kill_power - /sbin/sulogin -t 10 /dev/console -fi - -# Inform if there is a forced or skipped fsck -if [[ -f /fastboot ]]; then - echo - ewarn "Fsck will be skipped on next startup" -elif [[ -f /forcefsck ]]; then - echo - ewarn "A full fsck will be forced on next startup" -fi - -ups_kill_power - - # vim:ts=4 diff --git a/init.d/hostname b/init.d/hostname index e7b5472..47c200a 100755 --- a/init.d/hostname +++ b/init.d/hostname @@ -2,10 +2,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -depend() { - need checkroot -} - start() { # Ensure that we have a hostname binary or function source /lib/rcscripts/net.modules.d/helpers.d/functions diff --git a/init.d/keymaps b/init.d/keymaps deleted file mode 100755 index 255abd2..0000000 --- a/init.d/keymaps +++ /dev/null @@ -1,79 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need localmount -} - -checkconfig() { - if [[ -z ${KEYMAP} ]] ; then - eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first" - return 1 - fi - - # Make sure user isn't using rc.conf anymore - if grep -qs ^KEYMAP= /etc/rc.conf ; then - ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps" - fi -} - -start() { - if is_uml_sys ; then - ebegin "Loading key mappings" - eend 0 - return 0 - fi - - local WINDOWKEYS_KEYMAP= - - checkconfig || return 1 - - # Force linux keycodes for PPC. - if [[ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]] ; then - echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes - fi - - # Turn on unicode if user wants it - if [[ ${UNICODE} == "yes" ]] ; then - /usr/bin/kbd_mode -u - fi - - ebegin "Loading key mappings" - if [[ -x /bin/loadkeys ]] ; then - [[ ${SET_WINDOWKEYS} == "yes" ]] && WINDOWKEYS_KEYMAP="windowkeys" - /bin/loadkeys -q ${WINDOWKEYS_KEYMAP} ${KEYMAP} \ - ${EXTENDED_KEYMAPS} > /dev/null - eend $? "Error loading key mappings" - else - eend 1 "/bin/loadkeys not found" - return 1 - fi - - # Set terminal encoding to either ASCII or UNICODE. - # See utf-8(7) for more information. - local termencoding="" termmsg="" - if [[ ${UNICODE} == "yes" ]] ; then - local dumpkey_opts="" - [[ -n ${DUMPKEYS_CHARSET} ]] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}" - - dumpkeys ${dumpkey_opts} | loadkeys --unicode - termencoding=$'\033%G' - termmsg="UTF-8" - else - termencoding=$'\033(K' - termmsg="ASCII" - fi - local n ttydev="" - [[ -d /dev/vc ]] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - ebegin "Setting terminal encoding to ${termmsg}" - for n in $(seq 1 "${RC_TTY_NUMBER}") ; do - echo -n -e ${termencoding} > ${ttydev}${n} - done - eend 0 -} - - -# vim:ts=4 diff --git a/init.d/localmount b/init.d/localmount deleted file mode 100755 index fc49539..0000000 --- a/init.d/localmount +++ /dev/null @@ -1,47 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need checkfs -} - -start() { - # Mount local filesystems in /etc/fstab. - ebegin "Mounting local filesystems" - mount -at noproc,noshm,no${NET_FS_LIST// /,no} >/dev/null - eend $? "Some local filesystem failed to mount" - - # Make sure we insert usbcore if its a module - if [[ -f /proc/modules && ! -d /proc/bus/usb ]] ; then - # >/dev/null to hide errors from non-USB users - modprobe usbcore &> /dev/null - fi - - # Check what USB fs the kernel support. Currently - # 2.5+ kernels, and later 2.4 kernels have 'usbfs', - # while older kernels have 'usbdevfs'. - local usbfs=$(grep -Fow usbfs /proc/filesystems || - grep -Fow usbdevfs /proc/filesystems) - - if [[ -n ${usbfs} ]] && \ - [[ -e /proc/bus/usb && ! -e /proc/bus/usb/devices ]] - then - ebegin "Mounting USB device filesystem (${usbfs})" - usbgid=$(awk -F: '/^usb:/{print $3; exit}' /etc/group) - mount -t ${usbfs} usbfs /proc/bus/usb \ - ${usbgid:+-o devmode=0664,devgid=${usbgid}} - eend $? "Failed to mount USB device filesystem" - fi - - # Swap on loopback devices, and other weirdnesses - ebegin "Activating (possibly) more swap" - /sbin/swapon -a - eend $? - - # Start dm-crypt mappings, if any - start_addon dm-crypt -} - - -# vim:ts=4 diff --git a/init.d/modules b/init.d/modules deleted file mode 100755 index 38e0f44..0000000 --- a/init.d/modules +++ /dev/null @@ -1,122 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need checkroot hostname - use isapnp -} - -load_modules() { - local x= - local i=0 - local retval=0 - local modules= - local modargs= - local modcount=0 - local config="$1" - - [[ -z ${config} || ! -r ${config} ]] && return 0 - - # Loop over every line in $config - eval $(awk ' - BEGIN { - COUNT = 0 # Make sure COUNT is set - } - - $0 !~ /(^[[:space:]]*(#|$))/ { - if (MODULES == "") - MODULES = $1 - else - MODULES = MODULES " " $1 - - # Not the greatest method to remove $1 from $0, but it works - sub(/^[[:space:]]*[^[:space:]]*[[:space:]]*/, "") - # Trim trailing comments on the line - sub(/#.*$/, "") - ARGS[COUNT] = $0 - COUNT++ - } - - END { - # 'eval' will make sure these are set to proper bash variables - print "modcount=" COUNT - print "modules=\"" MODULES "\"" - for (x = 0;x < COUNT;x++) - print "modargs[" x "]=\"" ARGS[x] "\"" - } - ' "${config}") - - if [[ ${modcount} -gt 0 ]]; then - einfo "Using ${config} as config:" - - for x in ${modules}; do - ebegin " Loading module ${x}" - modprobe -q ${x} ${modargs[${i}]} &>/dev/null - retval=$? - eend ${retval} " Failed to load ${x}" - - i=$((i+1)) - [[ ${retval} -eq 0 ]] || modcount=$((modcount-1)) - done - - einfo "Autoloaded ${modcount} module(s)" - fi - - return 0 -} - -start() { - local KV=$(uname -r) - local KV_MAJOR=$(KV_major "${KV}") - local KV_MINOR=$(KV_minor "${KV}") - local KV_MICRO=$(KV_micro "${KV}") - - # Should not fail if kernel do not have module - # support compiled in ... - [[ -f /proc/modules ]] || return 0 - - # Make sure depmod from modutils do not whine, but do not bother if - # we are on a 2.6 kernel without modprobe.old - if [[ -z "${CDBOOT}" ]] && [[ ! -e /etc/modules.conf ]] && \ - [[ $(get_KV) -lt $(KV_to_int '2.5.48') || -x /sbin/modprobe.old ]] - then - echo '### This file is automatically generated by modules-update' \ - > /etc/modules.conf 2>/dev/null - [[ ! -f /etc/modules.conf ]] && \ - ewarn "Cannot update /etc/modules.conf!" - fi - - # Only do this if we have modules.conf or a 2.6 kernel - if [[ -z "${CDBOOT}" ]] && \ - [[ -f /etc/modules.conf || $(get_KV) -ge $(KV_to_int '2.5.48') ]] - then - /sbin/modules-update - fi - - local autoload="" - if [[ -f /etc/modules.autoload && ! -L /etc/modules.autoload ]]; then - autoload=/etc/modules.autoload - else - local x - for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR} ; do - if [[ -f /etc/modules.autoload.d/kernel-"${x}" ]] ; then - autoload="/etc/modules.autoload.d/kernel-${x}" - break - fi - done - fi - [[ -n ${autoload} ]] && load_modules "${autoload}" - - # - # Just in case a sysadmin prefers generic symbolic links in - # /lib/modules/boot for boot time modules we will load these modules - # - [[ -n $(modprobe -l -t boot) ]] && modprobe -a -t boot \* &>/dev/null - - # Above test clobbers the return - return 0 -} - - -# vim:ts=4 diff --git a/init.d/netmount b/init.d/netmount deleted file mode 100755 index 0195622..0000000 --- a/init.d/netmount +++ /dev/null @@ -1,106 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - local myneed="net" - local myuse="" - - # Only have Portmap as a dependency if there is a nfs mount in fstab - # that should be mounted at boot time. Also filter out comments. - local nfsmounts=$(awk '!/^#/ && ($3=="nfs" || $3=="nfs4") && $4 !~ /noauto/ { print $0 }' /etc/fstab) - - if [[ -n ${nfsmounts} ]] ; then - myneed="${myneed} portmap" - myuse="${myuse} nfs nfsmount" - else - myuse="${myuse} portmap" - fi - - need ${myneed} - use ${myuse} -} - -remove_net_fs() { - local fs - rcfilesystems=" ${rcfilesystems} " - for fs in "$@" ; do - rcfilesystems=${rcfilesystems// ${fs} / } - done - rcfilesystems=${rcfilesystems# } # remove front and - rcfilesystems=${rcfilesystems% } # back spaces -} - -start() { - local rcfilesystems=${NET_FS_LIST} - - # Only try to mount NFS filesystems if portmap was started. - # This is to fix "hang" problems for new users who do not - # add portmap to the default runlevel. - if ! service_started portmap ; then - remove_net_fs nfs nfs4 - fi - rcfilesystems=${rcfilesystems// /,} # convert to comma-separated - - ebegin "Mounting network filesystems" - mount -at ${rcfilesystems} >/dev/null - - if [[ $? != 0 ]] ; then - ewend 1 "Could not mount all network filesystems!" - else - eend 0 - fi - - return 0 -} - -stop() { - local rcfilesystems=${NET_FS_LIST} - - # We let the afs init script handle unmounting afs stuff - # because it requires special handling of the afs daemon - # and similar ugly cruft - if service_started afs-client ; then - remove_net_fs afs - fi - - rcfilesystems=${rcfilesystems// /,} # convert to comma-separated - - local ret - ebegin "Unmounting network filesystems" - [[ -z $(umount -art ${rcfilesystems} 2>&1) ]] - ret=$? - eend ${ret} "Failed to simply unmount filesystems" - [[ ${ret} == 0 ]] && return 0 - - # `umount -a` will fail if the filesystems are in use. - # Here we use fuser to kill off processes that are using - # the filesystems so that we can unmount properly. - # We will gradually use harsher kill signals so that the - # processes know we aren't screwing around here ;). - declare -a siglist=( "TERM" "KILL" "KILL" ) - local retry=0 - local remaining="go" - - while [[ -n ${remaining} && ${retry} -lt 3 ]] ; do - # Populate $remaining with a newline-delimited list of network - # filesystems. Mount points have spaces swapped for '\040' (see - # fstab(5)) so we have to translate them back to spaces. - remaining="$(awk '$3 ~ /'${NET_FS_LIST// /|}'/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" - # Since we have to worry about the spaces being quoted properly, - # we'll use `set --` and then "$@" to get the correct result. - IFS=$'\n' - set -- ${remaining//\\040/ } - unset IFS - [[ -z ${remaining} ]] && break - - # try to unmount again - ebegin $'\t'"Unmounting network filesystems (retry #$((retry+1)))" - /bin/fuser -k -${siglist[$((retry++))]} -m "$@" &>/dev/null - sleep 5 - umount "$@" &>/dev/null - eend $? $'\t'"Failed to unmount filesystems" - done -} - -# vim:ts=4 diff --git a/init.d/numlock b/init.d/numlock deleted file mode 100755 index 22654f0..0000000 --- a/init.d/numlock +++ /dev/null @@ -1,34 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need localmount -} - -start() { - ebegin "Enabling numlock on ttys" - local dev - [[ -d /dev/vc ]] \ - && dev=/dev/vc/ \ - || dev=/dev/tty - for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do - setleds -D +num < ${dev}${tty} &> /dev/null - done - eend $? "Failed to enable numlock" -} - -stop() { - ebegin "Disabling numlock on ttys" - local dev - [[ -d /dev/vc ]] \ - && dev=/dev/vc/ \ - || dev=/dev/tty - for tty in $(seq 1 "${RC_TTY_NUMBER}") ; do - setleds -D -num < ${dev}${tty} &> /dev/null - done - eend $? "Failed to disable numlock" -} - - -# vim:ts=4 diff --git a/init.d/reboot.sh b/init.d/reboot.sh index fe84df4..559e51b 100755 --- a/init.d/reboot.sh +++ b/init.d/reboot.sh @@ -1,7 +1,7 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -/sbin/reboot -idpk +/sbin/reboot -d # hmm, if the above failed, that's kind of odd ... # so let's force a reboot diff --git a/init.d/rmnologin b/init.d/rmnologin index 559b660..436fec3 100755 --- a/init.d/rmnologin +++ b/init.d/rmnologin @@ -2,10 +2,6 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -depend() { - need localmount -} - start() { if [[ -f /etc/nologin.boot ]] ; then rm -f /etc/nologin /etc/nologin.boot &> /dev/null diff --git a/init.d/shutdown.sh b/init.d/shutdown.sh index 4672211..9099dc0 100755 --- a/init.d/shutdown.sh +++ b/init.d/shutdown.sh @@ -1,7 +1,7 @@ # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -/sbin/halt -ihdp +/sbin/halt -d # hmm, if the above failed, that's kind of odd ... # so let's force a halt diff --git a/init.d/urandom b/init.d/urandom deleted file mode 100755 index 368130d..0000000 --- a/init.d/urandom +++ /dev/null @@ -1,37 +0,0 @@ -#!/sbin/runscript -# Copyright 1999-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need localmount -} - -start() { - [[ -c /dev/urandom ]] || return - if [[ -f /var/run/random-seed ]] ; then - cat /var/run/random-seed > /dev/urandom - fi - if ! rm -f /var/run/random-seed &> /dev/null ; then - ewarn "Skipping /var/run/random-seed initialization (ro root?)" - return 0 - fi - ebegin "Initializing random number generator" - umask 077 - dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null - eend $? "Error initializing random number generator" - umask 022 -} - -stop() { - [[ -n ${CDBOOT} ]] && return 0 - - ebegin "Saving random seed" - # Carry a random seed from shut-down to start-up; - # see documentation in linux/drivers/char/random.c - umask 077 - dd if=/dev/urandom of=/var/run/random-seed count=1 &> /dev/null - eend $? "Failed to save random seed" -} - - -# vim:ts=4 diff --git a/man/modules-update.8 b/man/modules-update.8 deleted file mode 100644 index 84ac7a8..0000000 --- a/man/modules-update.8 +++ /dev/null @@ -1,51 +0,0 @@ -.TH MODULES-UPDATE 8 "Gentoo Linux" "2001" -.SH NAME -modules\-update \- (re)generate /etc/modules.conf -.SH SYNOPSIS -.B modules\-update -[force] -.SH DESCRIPTION -.B modules\-update -is a simple tool to manage -.IR /etc/modules.conf . -The Linux module utilities use a single file for all their -configuration. This makes it difficult for packages to dynamically add -information about their own modules. -.PP -.B modules-update -makes the dynamic addition of information easier by generating the -single configuration file from the many files located in -.IR /etc/modules.d/ . -All files in that directory are assembled together to form -.IR /etc/modules.conf . -.PP -After generation, a backup of the old file can be found at -.IR /etc/modules.conf.old . -.SH "FILES" -There are two types of file you can put in -.IR /etc/modules.d/ : -normal files and exectuable files. Normal files contain standard modules -configuration information, as described in -.BR modules.conf (5). -Executable files are executed and their output is used as extra configuration -information. Error messages are sent to stderr and thus do not become -part of the configuration file. -.SH OPTIONS -.TP -.I force -.B modules\-update -will check if the current -.I /etc/modules.conf -is a generated file by checking for a special tag on the first line. If this -tag is not found generation is aborted. By supplying -.I force -as parameter only a warning is printed. -.SH "REPORTING BUGS" -Please report bugs via http://bugs.gentoo.org/ -.SH "SEE ALSO" -.BR depmod (1), -.BR modules.conf (5) -.SH AUTHOR -This manual page was written by Wichert Akkerman <wakkerma@debian.org> -for the Debian GNU/Linux system. Modified for -.I Gentoo Linux. diff --git a/man/modules.autoload.5 b/man/modules.autoload.5 deleted file mode 100644 index 1a0c3e3..0000000 --- a/man/modules.autoload.5 +++ /dev/null @@ -1,19 +0,0 @@ -.TH MODULES.AUTOLOAD 5 "Gentoo Linux" "Nov 2001" -.SH NAME -\fI/etc/modules.autoload\fR - kernel modules to load at boot time -.SH DESCRIPTION -.PP -The \fI/etc/modules.autoload\fR -file contains the names of kernel modules that are to be loaded at boot -time, one per line. Arguments can be given on the same line as the module -name. Comments begin with a `#', and everything on the line after it is -ignored. This file is read by the \fI/etc/init.d/modules\fR initscript, -which is usually linked in the \fI/etc/runlevels/boot\fR directory. -.SH "SEE ALSO" -.BR modules-update (8), -.BR modprobe (8), -.BR modules.conf (5) -.TP -The \fI/sbin/modules-update\fR script. -.TP -The files in \fI/etc/modules.d\fR. diff --git a/mkrelease.sh b/mkrelease.sh new file mode 100755 index 0000000..8bf86f5 --- /dev/null +++ b/mkrelease.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +proj="baselayout-vserver" +svnroot="http://dev.croup.de/repos/gentoo-vps/${proj}" +ver=${1:-1.13.0} + +usage() { + echo "Usage: mkrelease" +} + +die() { + echo $1 + exit ${2:-1} +} + +if [[ $1 != "-f" ]] ; then + echo "Performing sanity checks (run with -f to skip) ..." + + # Check that we're updated + svnfiles="$( svn status 2>&1 | egrep -v '^(U|P)' )" + if [[ -n ${svnfiles} ]] ; then + echo "Refusing to package tarball until svn is in sync:" + echo "$svnfiles" + exit 1 + fi +fi + +echo "Creating release tag... " + +svn copy ${svnroot}/trunk ${svnroot}/tags/release-${ver} \ + -m "Tagging the ${ver} release of the ${proj} project" &>/dev/null || die "svn copy failed" + + +echo "Make dist tarball..." + +dest=dist/${proj}-${ver} + +mkdir -p ${dest} &>/dev/null + +for x in bin etc init.d sbin src rc-lists man; do + svn export $x ${dest}/${x} +done + +mkdir -p ${dest}/lib/rcscripts +svn export --force net-scripts/init.d ${dest}/init.d +svn export net-scripts/net.modules.d ${dest}/lib/rcscripts/net.modules.d +svn export --force net-scripts/conf.d ${dest}/etc/conf.d + +svn export ChangeLog ${dest}/ChangeLog +svn export ChangeLog.vserver ${dest}/ChangeLog.vserver + +pushd dist/ &>/dev/null || die "pushd failed" + +tar cjf ${proj}-${ver}.tar.bz2 ${proj}-${ver} || die "tar failed" + +for i in *.tar*; do + md5sum $i > $i.md5 +done + +echo "Tarball ist at `pwd`" + +popd &>/dev/null || die "popd failed" diff --git a/rc-lists/boot b/rc-lists/boot index d705afe..4229ac4 100644 --- a/rc-lists/boot +++ b/rc-lists/boot @@ -1,13 +1,4 @@ bootmisc -checkroot -consolefont -keymaps -modules rmnologin -urandom -checkfs -clock domainname hostname -localmount -net.lo diff --git a/rc-lists/default b/rc-lists/default index d6763ae..4083037 100644 --- a/rc-lists/default +++ b/rc-lists/default @@ -1,3 +1 @@ -hdparm local -netmount diff --git a/rc-lists/nonetwork b/rc-lists/nonetwork deleted file mode 100644 index 4083037..0000000 --- a/rc-lists/nonetwork +++ /dev/null @@ -1 +0,0 @@ -local diff --git a/sbin/MAKEDEV b/sbin/MAKEDEV index c87b58d..a826c33 100755 --- a/sbin/MAKEDEV +++ b/sbin/MAKEDEV @@ -561,6 +561,22 @@ do symlink mouse sunmouse makedev openprom c 10 139 root root 0664 ;; + generic-vserver) + makedev null c 1 3 $public + makedev zero c 1 5 $public + makedev full c 1 7 $public + makedev random c 1 8 $public + makedev urandom c 1 9 $readable + makedev tty c 5 0 $tty + $0 $opts fd + $0 $opts ptmx + # Just generate a few pty's, since openvz depends on those + # for vzctl enter + for i in `seq 0 5`; do + makedev ptyp$i c 2 $i $tty + makedev ttyp$i c 3 $i $tty + done + ;; generic-*) echo "$0: no support for generic on this arch" >&2 exit 1 diff --git a/sbin/MAKEDEV-gentoo.patch b/sbin/MAKEDEV-gentoo.patch deleted file mode 100644 index bbca882..0000000 --- a/sbin/MAKEDEV-gentoo.patch +++ /dev/null @@ -1,109 +0,0 @@ ---- MAKEDEV -+++ MAKEDEV -@@ -102,8 +102,8 @@ - - if [ "$opt_V" ] - then -- echo "This is Debian MAKEDEV. For version info, try 'dpkg --list makedev'" -- echo "See /usr/share/doc/makedev/ for more information on Debian MAKEDEV." -+ echo "This is MAKEDEV based on Debian's makedev_2.3.1-78." -+ echo "See the MAKEDEV(8) manpage for more information." - exit 0 - fi - -@@ -308,60 +308,25 @@ - done - } - -+get_arch() { -+ case `uname -m` in -+ arm*) echo arm;; -+ i?86) echo i386;; -+ ppc*) echo powerpc;; -+ s390*) echo s390;; -+ sh*) echo sh;; -+ x86_64) echo i386;; -+ # alpha|hppa|ia64|m68k|mips|sparc -+ *) echo $a;; -+ esac -+} -+ - for arg in $* - do - # case `cvt $arg` in - case $arg in - generic) -- # pick the right generic-<arch> using dpkg's knowledge -- case `dpkg --print-installation-architecture` in -- alpha) -- $0 $opts generic-alpha -- ;; -- arm) -- $0 $opts generic-arm -- ;; -- hppa) -- $0 $opts generic-hppa -- ;; -- i386) -- $0 $opts generic-i386 -- ;; -- amd64) -- $0 $opts generic-i386 -- ;; -- ia64) -- $0 $opts generic-ia64 -- ;; -- m68k) -- $0 $opts generic-m68k -- ;; -- mips) -- $0 $opts generic-mips -- ;; -- mipsel) -- $0 $opts generic-mipsel -- ;; -- powerpc) -- $0 $opts generic-powerpc -- ;; -- ppc64) -- $0 $opts generic-powerpc -- ;; -- s390) -- $0 $opts generic-s390 -- ;; -- sh*) -- $0 $opts generic-sh -- ;; -- sparc) -- $0 $opts generic-sparc -- ;; -- *) -- echo "$0: no support for generic on this arch" >&2 -- exit 1 -- ;; -- esac -+ $0 $opts generic-`get_arch` - ;; - generic-alpha) - $0 $opts std -@@ -596,6 +562,10 @@ - symlink mouse sunmouse - makedev openprom c 10 139 root root 0664 - ;; -+ generic-*) -+ echo "$0: no support for generic on this arch" >&2 -+ exit 1 -+ ;; - local) - $0.local $opts - ;; -@@ -690,8 +660,7 @@ - done - ;; - adb) -- # pick the right arch device using dpkg's knowledge -- case `dpkg --print-installation-architecture` in -+ case `get_arch` in - powerpc) - # ADB bus devices (char) - makedev adb c 56 0 $mouse diff --git a/sbin/functions.sh b/sbin/functions.sh index d889666..0d899cf 100644 --- a/sbin/functions.sh +++ b/sbin/functions.sh @@ -12,9 +12,6 @@ SVCDIR="/var/lib/supervise" # Check /etc/conf.d/rc for a description of these ... svclib="/lib/rcscripts" svcdir=${svcdir:-/var/lib/init.d} -svcmount=${svcmount:-no} -svcfstype=${svcfstype:-tmpfs} -svcsize=${svcsize:-1024} # Different types of dependencies deptypes="need use" @@ -37,13 +34,9 @@ RC_ENDCOL="yes" # # Default values for rc system # -RC_TTY_NUMBER=${RC_TTY_NUMBER:-11} +RC_TTY_NUMBER=${RC_TTY_NUMBER:-0} RC_PARALLEL_STARTUP=${RC_PARALLEL_STARTUP:-no} -RC_NET_STRICT_CHECKING=${RC_NET_STRICT_CHECKING:-no} -RC_USE_FSTAB=${RC_USE_FSTAB:-no} -RC_USE_CONFIG_PROFILE=${RC_USE_CONFIG_PROFILE:-yes} -RC_FORCE_AUTO=${RC_FORCE_AUTO:-no} -RC_DEVICES=${RC_DEVICES:-auto} +RC_NET_STRICT_CHECKING=${RC_NET_STRICT_CHECKING:-none} # # Default values for e-message indentation and dots @@ -74,10 +67,6 @@ import_addon() { splash() { return 0 } -# This will override the splash() function... -if ! import_addon splash-functions.sh ; then - [[ -f /sbin/splash-functions.sh ]] && source /sbin/splash-functions.sh -fi # void profiling(...) # @@ -86,7 +75,6 @@ fi profiling() { return 0 } -import_addon profiling-functions.sh # void bootlog(...) # @@ -94,7 +82,6 @@ import_addon profiling-functions.sh bootlog() { return 0 } -[[ ${RC_BOOTLOG} == "yes" ]] && import_addon bootlogger.sh # void get_bootconfig() # @@ -103,34 +90,8 @@ bootlog() { # parameters. # get_bootconfig() { - local copt= - local newbootlevel= - local newsoftlevel= - - if [[ -r /proc/cmdline ]] ; then - for copt in $(</proc/cmdline) ; do - case "${copt%=*}" in - bootlevel) - newbootlevel="${copt##*=}" - ;; - softlevel) - newsoftlevel="${copt##*=}" - ;; - esac - done - fi - - if [[ -n ${newbootlevel} ]] ; then - export BOOTLEVEL="${newbootlevel}" - else - export BOOTLEVEL="boot" - fi - - if [[ -n ${newsoftlevel} ]] ; then - export DEFAULTLEVEL="${newsoftlevel}" - else - export DEFAULTLEVEL="default" - fi + export BOOTLEVEL="${newbootlevel}" + export DEFAULTLEVEL="default" return 0 } @@ -138,19 +99,6 @@ get_bootconfig() { setup_defaultlevels() { get_bootconfig - if get_bootparam "noconfigprofile" ; then - export RC_USE_CONFIG_PROFILE="no" - - elif get_bootparam "configprofile" ; then - export RC_USE_CONFIG_PROFILE="yes" - fi - - if [[ ${RC_USE_CONFIG_PROFILE} == "yes" && -n ${DEFAULTLEVEL} ]] && \ - [[ -d "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" || \ - -L "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" ]] ; then - export BOOTLEVEL="${BOOTLEVEL}.${DEFAULTLEVEL}" - fi - if [[ -z ${SOFTLEVEL} ]] ; then if [[ -f "${svcdir}/softlevel" ]] ; then export SOFTLEVEL=$(< "${svcdir}/softlevel") @@ -326,11 +274,6 @@ _eend() { [[ ${RC_QUIET_STDOUT} == "yes" ]] && return 0 msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}" else - if [[ -c /dev/null ]] ; then - rc_splash "stop" &>/dev/null & - else - rc_splash "stop" & - fi if [[ -n $* ]] ; then ${efunc} "$*" fi @@ -475,30 +418,7 @@ get_KV() { # EXAMPLE: if get_bootparam "nodevfs" ; then .... # get_bootparam() { - local x copt params retval=1 - - [[ ! -r /proc/cmdline ]] && return 1 - - for copt in $(< /proc/cmdline) ; do - if [[ ${copt%=*} == "gentoo" ]] ; then - params=$(gawk -v PARAMS="${copt##*=}" ' - BEGIN { - split(PARAMS, nodes, ",") - for (x in nodes) - print nodes[x] - }') - - # Parse gentoo option - for x in ${params} ; do - if [[ ${x} == "$1" ]] ; then -# echo "YES" - retval=0 - fi - done - fi - done - - return ${retval} + return 1 } # Safer way to list the contents of a directory, @@ -576,12 +496,7 @@ get_options() { # Returns a config file name with the softlevel suffix # appended to it. For use with multi-config services. add_suffix() { - if [[ ${RC_USE_CONFIG_PROFILE} == "yes" && -e "$1.${SOFTLEVEL}" ]]; then - echo "$1.${SOFTLEVEL}" - else - echo "$1" - fi - + echo "$1" return 0 } @@ -608,12 +523,8 @@ NET_FS_LIST="afs cifs coda davfs gfs ncpfs nfs nfs4 ocfs2 shfs smbfs" # is_net_fs() { local fstype - # /proc/mounts is always accurate but may not always be available - if [[ -e /proc/mounts ]]; then - fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts ) - else - fstype=$( mount | sed -n -e 's:.* on '"$1"' type \([^ ]*\).*:\1:p' ) - fi + # /proc/mounts is always accurate + fstype=$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts ) [[ " ${NET_FS_LIST} " == *" ${fstype} "* ]] return $? } @@ -625,8 +536,7 @@ is_net_fs() { # EXAMPLE: if is_uml_sys ; then ... # is_uml_sys() { - grep -qs 'UML' /proc/cpuinfo - return $? + return 1 } # bool is_vserver_sys() @@ -636,8 +546,7 @@ is_uml_sys() { # EXAMPLE: if is_vserver_sys ; then ... # is_vserver_sys() { - grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status - return $? + return 0 } # bool is_xenU_sys() @@ -647,7 +556,7 @@ is_vserver_sys() { # EXAMPLE: if is_xenU_sys ; then ... # is_xenU_sys() { - [[ -d /proc/xen && ! -f /proc/xen/privcmd ]] + return 1 } # bool get_mount_fstab(path) @@ -659,10 +568,7 @@ is_xenU_sys() { # mount -n ${cmd} # get_mount_fstab() { - gawk '$1 ~ "^#" { next } - $2 == "'$*'" { stab="-t "$3" -o "$4" "$1" "$2; } - END { print stab; } - ' /etc/fstab + echo } # char *reverse_list(list) @@ -690,12 +596,6 @@ start_addon() { # Starts all volumes in RC_VOLUME_ORDER. # start_volumes() { - local x= - - for x in ${RC_VOLUME_ORDER} ; do - start_addon "${x}" - done - return 0 } @@ -714,12 +614,6 @@ stop_addon() { # Stops all volumes in RC_VOLUME_ORDER (reverse order). # stop_volumes() { - local x= - - for x in $(reverse_list ${RC_VOLUME_ORDER}) ; do - stop_addon "${x}" - done - return 0 } @@ -805,6 +699,7 @@ if [[ -z ${EBUILD} ]] ; then setup_defaultlevels else + setup_defaultlevels # Should we use colors ? if [[ $* != *depend* ]] ; then # Check user pref in portage diff --git a/sbin/modules-update b/sbin/modules-update deleted file mode 100755 index 05ef3e0..0000000 --- a/sbin/modules-update +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/bash -# -# This is the modules-update script for Debian GNU/Linux. -# Written by Wichert Akkerman <wakkerma@debian.org> -# Copyright (C) 1998, 1999 Software in the Public Interest -# -# Modifications by Daniel Robbins <drobbins@gentoo.org>, Gentoo Foundation -# 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have -# support for varying CPU architectures on a single system. -# -# Updated by Aron Griffis <agriffis@gentoo.org> -# 05 May 2004 -- handle --assume-kernel argument for livecd building - -if [[ 0 -ne $(id -u) ]] ; then - echo "You have to be root to do this." - exit 2 -fi - -CFGFILE="/etc/modules.conf" -TMPFILE="${CFGFILE}.$$" -CFGFILE2="/etc/modprobe.conf" -TMPFILE2="${CFGFILE2}.$$" -TMPFILE2B="${CFGFILE2}B.$$" -CFGFILE3="/etc/modules.devfs" -TMPFILE3="${CFGFILE3}.$$" -CFGFILE4="/etc/modprobe.devfs" -TMPFILE4="${CFGFILE4}.$$" -MODDIR="/etc/modules.d" -ARCHDIR="${MODDIR}/arch" -HEADER="### This file is automatically generated by modules-update" -FULLHEADER="${HEADER} -# -# Please do not edit this file directly. If you want to change or add -# anything please take a look at the files in ${MODDIR} and read -# the manpage for modules-update(8). -# -" - -source /sbin/functions.sh - -# Parse command-line -FORCE=false -ASSUME_KV= -while [[ -n $1 ]] ; do - case "$1" in - force) - FORCE="true" - ;; - --assume-kernel=*) - ASSUME_KV=${1#*=} - ;; - *) - eerror "Error: I don't understand $1" - exit 1 - ;; - esac - shift -done - -# Set kernel version, either from --assume-kernel or uname -r -KV=${ASSUME_KV:-$(uname -r)} -if [[ $(KV_to_int ${KV}) -ge "$(KV_to_int 2.5.48)" ]] ; then - KERNEL_2_6="true" -else - KERNEL_2_6="false" -fi - -# Check if $CONF is valid -[[ ! -r ${CONF} ]] && CONF= - -set -e - -# Reset the sorting order since we depend on it -export LC_COLLATE="C" - -depdir() { - local dep=$(sed -n -e '/[ \t]*depfile=/h;${x;s/[ \t]*depfile=//g;s,/[^/]*$,,p}' \ - "${CFGFILE}") - [[ -z ${dep} ]] && dep="/lib/modules/${KV}" - echo "${dep}" -} - -CFGFILES=${CFGFILE} -if ${KERNEL_2_6} ; then - CFGFILES="${CFGFILES} ${CFGFILE2}" - [[ -d /etc/devfs.d ]] && CFGFILES="${CFGFILES} ${CFGFILE4}" -fi - -for x in ${CFGFILES} ; do - if [[ -f ${x} ]] ; then - if ! sed -ne 1p "${x}" | egrep -q "^${HEADER}" ; then - # Do not bother if its modutils config file, and we - # have a 2.6 kernel without modprobe.old - [[ ${x} == "${CFGFILE}" ]] && ${KERNEL_2_6} && \ - ! type -p modprobe.old > /dev/null && \ - continue - - ewarn "Error: the current ${x} is not automatically generated." - - if ${FORCE} ; then - ewarn "force specified, (re)generating file anyway." - else - eerror "Use \"modules-update force\" to force (re)generation." - exit 1 - fi - fi - fi -done - -generate_config() { - local cfg= - local conf="$1" - local moddir="$2" - local tmpfile="$3" - local do_mprobe="$4" - - for cfg in "${moddir}"/* "${conf}" ; do - [[ -d ${cfg} ]] && continue - - [[ ! -r ${cfg} ]] && continue - - # Skip backup and RCS files; fixes bug 20597 (07 May 2004 agriffis) - [[ ${cfg} == *~ || ${cfg} == *.bak || ${cfg} == *,v ]] && continue - - [[ ${do_mprobe} -eq 1 && -e /etc/modprobe.d/${cfg##*/} ]] && continue - - echo "### modules-update: start processing ${cfg}" >> "${tmpfile}" - - if [[ -x ${cfg} ]] ; then - # $cfg can be executable; nice touch, Wichert! :) - "${cfg}" >> "${tmpfile}" - else - cat "${cfg}" >> "${tmpfile}" - fi - - echo >> "${tmpfile}" - echo "### modules-update: end processing ${cfg}" >> "${tmpfile}" - echo >> "${tmpfile}" - done - - return 0 -} - -if type -p modprobe.old > /dev/null ; then - if ${FORCE} || is_older_than ${CFGFILE} ${MODDIR} || \ - [[ ! -e ${CFGFILE} ]] ; then - ebegin "Updating ${CFGFILE}" - echo "${FULLHEADER}" > "${TMPFILE}" - generate_config "${CONF}" "${MODDIR}" "${TMPFILE}" 0 - [[ -e ${CFGFILE} ]] && mv -f "${CFGFILE}" "${CFGFILE}.old" - mv -f "${TMPFILE}" "${CFGFILE}" - eend 0 - fi -fi - -if ${FORCE} || is_older_than ${CFGFILE2} ${MODDIR} || [[ ! -e ${CFGFILE2} ]] ; then - if [[ -x /sbin/generate-modprobe.conf ]] && ${KERNEL_2_6} ; then - # Make sure that generate-modprobe.conf can handle --assume-kernel - # if we were called with it. - if [[ -n ${ASSUME_KV} ]] && \ - ! grep -qe -- --assume-kernel /sbin/generate-modprobe.conf ; then - eerror "Error: modules-update called with --assume-kernel flag, but" - eerror "generate-modprobe.conf doesn't understand it. You need to" - eerror "install >=module-init-tools-3.0-r2" - exit 3 - fi - - ebegin "Updating ${CFGFILE2}" - echo "${FULLHEADER/modules.d/modprobe.d}" > "${TMPFILE2}" - if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ - >> "${TMPFILE2}" 2>/dev/null ; then - [[ -e ${CFGFILE2} ]] && mv -f "${CFGFILE2}" "${CFGFILE2}.old" - mv -f "${TMPFILE2}" "${CFGFILE2}" - eend 0 - else - # - # If we made it here, it means either generate-modprobe.conf - # bombed on us, or the user doesn't have modutils installed. - # If the latter is true, then we should generate modprobe.conf - # ourselves with any old files laying around in /etc/modules.d. - # - rm -f "${TMPFILE2}" - if type -p modprobe.old > /dev/null ; then - eend 1 "Warning: could not generate ${CFGFILE2}!" - else - echo "${FULLHEADER/modules.d/modprobe.d}" > "${TMPFILE2B}" - generate_config "${CONF}" "${MODDIR}" "${TMPFILE2}" 1 - export TESTING_MODPROBE_CONF="${TMPFILE2}" - if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ - >> "${TMPFILE2B}" 2> /dev/null ; then - [[ -e ${CFGFILE2} ]] && mv -f "${CFGFILE2}" "${CFGFILE2}.old" - mv -f "${TMPFILE2B}" "${CFGFILE2}" - eend 0 - else - eend 1 "Warning: could not generate ${CFGFILE2}!" - rm -f "${TMPFILE2B}" - fi - rm -f "${TMPFILE2}" - fi - fi - - if [[ -f ${CFGFILE3} ]] ; then - ebegin "Updating ${CFGFILE4}" - gawk '$0 !~ /^[[:space:]]*include/ { print $0 }' "${CFGFILE3}" \ - > "${TMPFILE3}" - - echo "${FULLHEADER/modules.d/modprobe.d}" > "${TMPFILE4}" - export TESTING_MODPROBE_CONF="${TMPFILE3}" - if /sbin/generate-modprobe.conf ${ASSUME_KV:+--assume-kernel=${KV}} \ - >> "${TMPFILE4}" 2> /dev/null ; then - [[ -e ${CFGFILE4} ]] && mv -f "${CFGFILE4}" "${CFGFILE4}.old" - mv -f "${TMPFILE4}" "${CFGFILE4}" - - echo >> "${CFGFILE4}" - echo "include /etc/modprobe.conf" >> "${CFGFILE4}" - eend 0 - else - eend 1 "Warning: could not generate ${CFGFILE4}!" - rm -f "${TMPFILE4}" - fi - rm -f "${TMPFILE3}" - fi - fi -fi - -# We also call depmod here to stop insmod from complaining that modules.conf -# is more recent then modules.dep -if [[ ${CFGFILE2} -nt /lib/modules/${KV}/modules.dep ]] ; then - if [[ -d $(depdir) && -f /proc/modules ]] ; then - if [[ -f /lib/modules/${KV}/build/System.map ]] ; then - depmod -a -F /lib/modules/${KV}/build/System.map ${KV} - else - depmod -a ${KV} - fi - fi -fi - - -# vim:ts=4 @@ -4,139 +4,8 @@ trap ":" INT QUIT TSTP source /sbin/functions.sh -# Only source this when this is a livecd booting ... -[ -f /sbin/livecd-functions.sh ] && source /sbin/livecd-functions.sh umask 022 -try() { - local errstr - local retval=0 - - if [ -c /dev/null ]; then - errstr="$((eval $*) 2>&1 >/dev/null)" - else - errstr="$((eval $*) 2>&1)" - fi - retval=$? - if [ "${retval}" -ne 0 ] - then - splash "critical" & - - echo -e "${ENDCOL}${NORMAL}[${BAD} oops ${NORMAL}]" - echo - eerror "The \"${1}\" command failed with error:" - echo - echo "${errstr#*: }" - echo - eerror "Since this is a critical task, startup cannot continue." - echo - /sbin/sulogin ${CONSOLE} - einfo "Unmounting filesystems" - if [ -c /dev/null ]; then - /bin/mount -a -o remount,ro &>/dev/null - else - /bin/mount -a -o remount,ro - fi - einfo "Rebooting" - /sbin/reboot -f - fi - - return ${retval} -} - -# Check that $1 exists ... -check_statedir() { - [ -z "$1" ] && return 0 - - if [ ! -d "$1" ] ; then - if ! mkdir -p "$1" &>/dev/null ; then - splash "critical" & - echo - eerror "For Gentoo to function properly, \"$1\" needs to exist." - if [[ ${RC_FORCE_AUTO} == "yes" ]] ; then - eerror "Attempting to create \"$1\" for you ..." - mount -o remount,rw / - mkdir -p "$1" - else - eerror "Please mount your root partition read/write, and execute:" - echo - eerror " # mkdir -p $1" - echo; echo - /sbin/sulogin ${CONSOLE} - fi - einfo "Unmounting filesystems" - /bin/mount -a -o remount,ro &>/dev/null - einfo "Rebooting" - /sbin/reboot -f - fi - fi - - return 0 -} - -# void noblock_read(var) -# -# reads a line of input into var like regular read -# but it does not block waiting for input -# -noblock_read() { - local old_tty_settings="$(stty -g)" - stty -icanon min 0 time 0 - read "$@" - stty "${old_tty_settings}" -} - -# bool user_want_interactive(void) -# -# return 0 if user wants interactive mode -# -user_want_interactive() { - local user_input - noblock_read user_input - [[ ${user_input} == *"I"* || ${user_input} == *"i"* ]] -} - -# void do_interactive -# -# starts, skips, continues or drops to the shell -# depending on user selection -# -do_interactive() { - local service="$1" - shift - - local start_text="Start service" - local skip_text="Skip service" - local continue_text="Continue boot process" - local shell_text="Exit to shell" - - echo - echo "About to start the service ${service}" - PS3="Enter your selection: " - select action in "${start_text}" "${skip_text}" "${continue_text}" \ - "${shell_text}" - do - case ${action} in - "${start_text}") - "$@" - break - ;; - "${skip_text}") - break - ;; - "${continue_text}") - interactive="no" - "$@" - break - ;; - "${shell_text}") - echo - sulogin "${CONSOLE}" - ;; - esac - done -} - get_critical_services() { local x= CRITICAL_SERVICES= @@ -148,7 +17,7 @@ get_critical_services() { CRITICAL_SERVICES="${CRITICAL_SERVICES} ${x##*/}" done else - CRITICAL_SERVICES="checkroot hostname modules checkfs localmount clock" + CRITICAL_SERVICES="hostname" fi export CRITICAL_SERVICES @@ -159,193 +28,21 @@ get_critical_services() { # Save $1 argv1="$1" +# we need this to prevent a warning below +[[ ! -e ${svcdir}/softlevel ]] && touch ${svcdir}/softlevel + # First time boot stuff goes here. Note that 'sysinit' is an internal runlevel # used to bring up local filesystems, and should not be started with /sbin/rc # directly ... -if [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} = "sysinit" ]] +if [[ ${argv1} = "sysinit" || ( ${argv1} = "boot" && "$(<${svcdir}/softlevel)" != "sysinit" ) ]] then # Setup initial $PATH just in case PATH="/bin:/sbin:/usr/bin:/usr/sbin:${PATH}" - # Help users recover their systems incase these go missing - [ -c /dev/null ] && dev_null=1 || dev_null=0 - [ -c /dev/console ] && dev_console=1 || dev_console=0 - echo echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" echo -e " Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2" echo - echo -e "Press ${GOOD}I${NORMAL} to enter interactive boot mode" - echo - check_statedir /proc - - ebegin "Mounting proc at /proc" - if [[ ${RC_USE_FSTAB} = "yes" ]] ; then - mntcmd=$(get_mount_fstab /proc) - else - unset mntcmd - fi - try mount -n ${mntcmd:--t proc proc /proc} - eend $? - - # Read off the kernel commandline to see if there's any special settings - # especially check to see if we need to set the CDBOOT environment variable - # Note: /proc MUST be mounted - [ -f /sbin/livecd-functions.sh ] && livecd_read_commandline - - if [ "$(get_KV)" -ge "$(KV_to_int '2.6.0')" ] ; then - if [[ -d /sys ]] ; then - ebegin "Mounting sysfs at /sys" - if [[ ${RC_USE_FSTAB} = "yes" ]] ; then - mntcmd=$(get_mount_fstab /sys) - else - unset mntcmd - fi - try mount -n ${mntcmd:--t sysfs sysfs /sys} - eend $? - else - ewarn "No /sys to mount sysfs needed in 2.6 and later kernels!" - fi - fi - - check_statedir /dev - - # Fix weird bug where there is a /dev/.devfsd in a unmounted /dev - devfs_automounted="no" - if [ -e "/dev/.devfsd" ] - then - mymounts="$(awk '($3 == "devfs") { print "yes"; exit 0 }' /proc/mounts)" - if [ "${mymounts}" != "yes" ] - then - rm -f /dev/.devfsd - else - devfs_automounted="yes" - fi - fi - - # Try to figure out how the user wants /dev handled - # - check $RC_DEVICES from /etc/conf.d/rc - # - check boot parameters - # - make sure the required binaries exist - # - make sure the kernel has support - if [ "${RC_DEVICES}" = "static" ] - then - ebegin "Using existing device nodes in /dev" - eend 0 - else - fellback_to_devfs="no" - case "${RC_DEVICES}" in - devfs) devfs="yes" - udev="no" - ;; - udev) devfs="yes" - udev="yes" - fellback_to_devfs="yes" - ;; - auto|*) devfs="yes" - udev="yes" - ;; - esac - - # Check udev prerequisites and kernel params - if [ "${udev}" = "yes" ] - then - if get_bootparam "noudev" || \ - [ ! -x /sbin/udev -o ${devfs_automounted} = "yes" ] || \ - [ "$(get_KV)" -lt "$(KV_to_int '2.6.0')" ] - then - udev="no" - fi - fi - - # Check devfs prerequisites and kernel params - if [ "${devfs}" = "yes" ] - then - if get_bootparam "nodevfs" || [ "${udev}" = "yes" ] - then - devfs="no" - fi - fi - - # Actually start setting up /dev now - if [[ ${udev} == "yes" ]] ; then - start_addon udev - - # With devfs, /dev can be mounted by the kernel ... - elif [[ ${devfs} == "yes" ]] ; then - start_addon devfs - - # Did the user want udev in the config file but for - # some reason, udev support didnt work out ? - if [[ ${fellback_to_devfs} == "yes" ]] ; then - ewarn "You wanted udev but support for it was not available!" - ewarn "Please review your system after it's booted!" - fi - fi - - # OK, if we got here, things are probably not right :) - if [[ ${devfs} == "no" && ${udev} == "no" ]] ; then - clear - echo - einfo "The Gentoo Linux system initialization scripts have detected that" - einfo "your system does not support UDEV. Since Gentoo Linux has been" - einfo "designed with dynamic /dev in mind, it is highly suggested that you" - einfo "emerge sys-fs/udev and configure your system to use it." - einfo "Please read the Gentoo Handbook for more information!" - echo - einfo " http://www.gentoo.org/doc/en/handbook/" - echo - einfo "Thanks for using Gentoo! :)" - echo - read -t 15 -p "(hit Enter to continue or wait 15 seconds ...)" - fi - fi - - # From linux-2.5.68 we need to mount /dev/pts again ... - if [ "$(get_KV)" -ge "$(KV_to_int '2.5.68')" ] - then - have_devpts="$(awk '($2 == "devpts") { print "yes"; exit 0 }' /proc/filesystems)" - - if [ "${have_devpts}" = "yes" ] - then - # Only try to create /dev/pts if we have /dev mounted dynamically, - # else it might fail as / might be still mounted readonly. - if [ ! -d /dev/pts ] && \ - [ "${devfs}" = "yes" -o "${udev}" = "yes" ] - then - # Make sure we have /dev/pts - mkdir -p /dev/pts &>/dev/null || \ - ewarn "Could not create /dev/pts!" - fi - - if [[ -d /dev/pts ]] ; then - ebegin "Mounting devpts at /dev/pts" - if [[ ${RC_USE_FSTAB} = "yes" ]] ; then - mntcmd=$(get_mount_fstab /dev/pts) - else - unset mntcmd - fi - try mount -n ${mntcmd:--t devpts -o gid=5,mode=0620 devpts /dev/pts} - eend $? - fi - fi - fi - - # Start logging console output since we have all /dev stuff setup - bootlog start - - # Swap needs to be activated *after* /dev has been fully setup so that - # the fstab can be properly parsed. This first pass we send to /dev/null - # in case the user has swap points setup on different partitions. We - # will run swapon again in localmount and that one will report errors. - ebegin "Activating (possible) swap" - /sbin/swapon -a >& /dev/null - eend 0 - - # Set the console loglevel to 1 for a cleaner boot - # the logger should anyhow dump the ring-0 buffer at start to the - # logs, and that with dmesg can be used to check for problems - /bin/dmesg -n 1 # We set the forced softlevel from the kernel command line # It needs to be run right after proc is mounted for the @@ -382,91 +79,6 @@ then # defaults. get_critical_services - splash "rc_init" "${argv1}" - - export START_CRITICAL="yes" - - # We do not want to break compatibility, so we do not fully integrate - # these into /sbin/rc, but rather start them by hand ... - for x in ${CRITICAL_SERVICES} - do - splash "svc_start" "${x}" - user_want_interactive && interactive="yes" - if ! start_critical_service "${x}" ; then - splash "critical" &>/dev/null & - - echo - eerror "One of more critical startup scripts failed to start!" - eerror "Please correct this, and reboot ..." - echo; echo - /sbin/sulogin ${CONSOLE} - einfo "Unmounting filesystems" - /bin/mount -a -o remount,ro &>/dev/null - einfo "Rebooting" - /sbin/reboot -f - fi - - splash "svc_started" "${x}" "0" - done - - unset START_CRITICAL - - # /var/log should be writable now, so starting saving the boot output - bootlog sync - - # have to run this after /var/run is mounted rw #85304 - if [ -x /sbin/irqbalance -a "$(get_KV)" -ge "$(KV_to_int '2.5.0')" ] - then - ebegin "Starting irqbalance" - /sbin/irqbalance - eend $? - fi - - # Check that $svcdir exists ... - check_statedir "${svcdir}" - - # Should we use tmpfs/ramfs/ramdisk for caching dependency and - # general initscript data? Note that the 'gentoo=<fs>' kernel - # option should override any other setting ... - for fs in tmpfs ramfs ramdisk - do - if get_bootparam "${fs}" - then - svcmount="yes" - svcfstype="${fs}" - break - fi - done - if [ "${svcmount}" = "yes" ] - then - ebegin "Mounting ${svcfstype} at ${svcdir}" - case "${svcfstype}" in - ramfs) - try mount -t ramfs svcdir "${svcdir}" \ - -o rw,mode=0755,size="${svcsize}"k - ;; - ramdisk) - try dd if=/dev/zero of=/dev/ram0 bs=1k count="${svcsize}" - try /sbin/mke2fs -i 1024 -vm0 /dev/ram0 "${svcsize}" - try mount -t ext2 /dev/ram0 "${svcdir}" -o rw - ;; - tmpfs|*) - try mount -t tmpfs svcdir "${svcdir}" \ - -o rw,mode=0755,size="${svcsize}"k - ;; - esac - eend 0 - fi - - # If booting off CD, we want to update inittab before setting the runlevel - if [ -f "/sbin/livecd-functions.sh" -a -n "${CDBOOT}" ] - then - ebegin "Updating inittab" - livecd_fix_inittab - eend $? - /sbin/telinit q &>/dev/null - fi - # Clear $svcdir from stale entries, but leave the caches around, as it # should help speed things up a bit rm -rf $(ls -d1 "${svcdir}/"* 2>/dev/null | \ @@ -490,20 +102,6 @@ then done ) - # If the user's /dev/null or /dev/console are missing, we - # should help them out and explain how to rectify the situation - if [ ${dev_null} -eq 0 -o ${dev_console} -eq 0 ] \ - && [ -e /usr/share/baselayout/issue.devfix ] - then - # Backup current /etc/issue - if [ -e /etc/issue -a ! -e /etc/issue.devfix ] - then - mv /etc/issue /etc/issue.devfix - fi - - cp /usr/share/baselayout/issue.devfix /etc/issue - fi - # Setup login records ... this has to be done here because when # we exit this runlevel, init will write a boot record to utmp # If /var/run is readonly, then print a warning, not errors @@ -519,23 +117,13 @@ then ewarn "Skipping /var/run/utmp initialization (ro root?)" fi - # All done logging - bootlog quit - - exit 0 + [[ ${argv1} = "boot" ]] || exit 0 fi # Sysinit ends here -if [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} == "boot" ]] +if [[ ${argv1} == "boot" ]] then setup_defaultlevels - if [ -n "${DEFAULTLEVEL}" -a "${DEFAULTLEVEL}" != "default" ] - then - # Setup our default runlevel runlevel that will be run - # the first time /sbin/rc is called with argv1 != sysinit|boot - echo "${DEFAULTLEVEL}" > "${svcdir}/ksoftlevel" - fi - # $BOOT can be used by rc-scripts to test if it is the first time # the 'boot' runlevel is executed export BOOT="yes" @@ -543,26 +131,6 @@ then # We reset argv1 to the bootlevel given on the kernel command line # if there is one argv1="${BOOTLEVEL}" - -elif [[ ${RUNLEVEL} != "S" && ${RUNLEVEL} != "1" && -e ${svcdir}/ksoftlevel ]] -then - argv1="$(< ${svcdir}/ksoftlevel)" - rm -f "${svcdir}/ksoftlevel" -elif [[ ${RUNLEVEL} != "S" && ${RUNLEVEL} != "1" && ${argv1} == "single" ]] -then - /sbin/telinit S - exit 0 -elif [[ ( ${RUNLEVEL} == "S" || ${RUNLEVEL} == "1" ) && ${argv1} != "single" ]] -then - level=$(awk -v level="${argv1}" ' - $2 == level { - split($0, fields, ":") - print fields[2] - exit - }' /etc/inittab 2>/dev/null) - [[ -z ${level} ]] && level=3 - /sbin/telinit "${level}" - exit 0 fi source "${svclib}/sh/rc-services.sh" @@ -600,18 +168,10 @@ else rm -rf "${svcdir}"/failed/* fi -splash "rc_init" "${argv1}" - if [ "${SOFTLEVEL}" = "reboot" -o "${SOFTLEVEL}" = "shutdown" ] then myscripts= -elif [ "${SOFTLEVEL}" = "single" ] -then - get_critical_services - - myscripts="${CRITICAL_SERVICES}" - elif [ ! -d "/etc/runlevels/${SOFTLEVEL}" ] then eerror "ERROR: runlevel ${SOFTLEVEL} does not exist; exiting ..." @@ -628,9 +188,6 @@ else mylevels="$(dolisting "/etc/runlevels/${SOFTLEVEL}/")" fi - [ "${OLDSOFTLEVEL}" = "${BOOTLEVEL}" -o "${OLDSOFTLEVEL}" = "single" ] \ - && /bin/dmesg -n 1 - for x in ${mylevels} do [ -L "${x}" ] && myscripts="${myscripts} ${x##*/}" @@ -678,12 +235,10 @@ dep_stop() { # If this is a 'net' service, we do not want to stop it if it was # not in the previous runlevel, and we are not shutting down, - # rebooting or going to single runlevel. This is because the user - # (or hotplut) might have started it (net.ppp?) ... + # rebooting. This is because the user might have started it ... if net_service "${myservice}" && \ [[ ${SOFTLEVEL} != "reboot" && \ - ${SOFTLEVEL} != "shutdown" && \ - ${SOFTLEVEL} != "single" ]] ; then + ${SOFTLEVEL} != "shutdown" ]] ; then if [[ -z ${OLDSOFTLEVEL} ]] || \ ! in_runlevel "${myservice}" "${OLDSOFTLEVEL}" then @@ -716,8 +271,7 @@ dep_stop() { } # Stop services -if [[ ${SOFTLEVEL} != "single" && \ - ${SOFTLEVEL} != "reboot" && \ +if [[ ${SOFTLEVEL} != "reboot" && \ ${SOFTLEVEL} != "shutdown" ]] then for i in $(get_stop_services) ; do @@ -770,6 +324,12 @@ if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then grep -ve '\(depcache\|deptree\|envcache\)') source /etc/init.d/halt.sh + + # we just die here since we have no init + # and we should be the last running process + if [[ ${RC_INITSTYLE_HACK} == "yes" ]] ; then + exit 0 + fi if [[ ${SOFTLEVEL} == "reboot" ]] ; then source /etc/init.d/reboot.sh @@ -781,11 +341,6 @@ if [[ ${SOFTLEVEL} == "reboot" || ${SOFTLEVEL} == "shutdown" ]] ; then exit 0 fi -if [[ ${SOFTLEVEL} == "single" ]] ; then - /sbin/sulogin ${CONSOLE} - exit 0 -fi - # Move the old softscritps directory to a different one # and make the new softscripts directory the current @@ -809,18 +364,10 @@ get_start_services() { trace_dependencies ${list} } -[[ -e "${svcdir}/interactive" ]] \ - && interactive="$(<"${svcdir}/interactive")" - # Start scripts for i in $(get_start_services) ; do if service_stopped "${i}" ; then - user_want_interactive && interactive="yes" - if [[ ${interactive} == "yes" ]]; then - do_interactive "${i}" start_service "${i}" - else - start_service "${i}" - fi + start_service "${i}" fi done @@ -830,39 +377,19 @@ done # Clean the old runlevel rm -rf "${svcdir}/softscripts.old" &>/dev/null -# Depends gets nuked, so update them -# (this problem should be solved now, but i think it will be a good idea -# to recreate the deps after a change in runlevel) - -#/sbin/depscan.sh &>/dev/null - -# We want devfsd running after a change of runlevel (this is mostly if we return -# from runlevel 'single') -if [ -z "`ps --no-heading -C 'devfsd'`" -a \ - -n "`gawk '/\/dev devfs/ { print }' /proc/mounts 2>/dev/null`" ] -then - if [ "${RC_DEVFSD_STARTUP}" != "no" ] - then - /sbin/devfsd /dev &>/dev/null - fi -fi - # Runlevel end, so clear stale fail list rm -rf "${svcdir}/failed" &>/dev/null # If we were in the boot runlevel, it is done now ... if [[ -n ${BOOT} ]]; then unset BOOT - # Save our interactive mode into the default runlevel - echo "${interactive}" > "${svcdir}/interactive" -else - # As we're not boot, we remove the interactive file - [[ -e "${svcdir}/interactive" ]] && rm -f "${svcdir}/interactive" + + if [[ "${RC_INITSTYLE_HACK}" = "yes" ]]; then + /sbin/rc default + fi fi # Remove the cached CONSOLETYPE unset CONSOLETYPE -splash "rc_exit" - # vim:ts=4 diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh index f759c49..795a78c 100755 --- a/sbin/rc-services.sh +++ b/sbin/rc-services.sh @@ -364,20 +364,16 @@ start_service() { if is_fake_service "${service}" "${SOFTLEVEL}" ; then mark_service_started "${service}" - splash "svc_start" "${service}" - splash "svc_started" "${service}" "0" return 0 fi begin_service "${service}" || return 0 - splash "svc_start" "${service}" if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ ${START_CRITICAL} == "yes" ]] ; then # if we can not start the services in parallel # then just start it and return the exit status ( "/etc/init.d/${service}" start ) retval=$? - splash "svc_started" "${service}" "${retval}" end_service "${service}" "${retval}" return "${retval}" else @@ -385,7 +381,6 @@ start_service() { ( "/etc/init.d/${service}" start retval=$? - splash "svc_started" "${service}" "${retval}" end_service "${service}" "${retval}" ) & return 0 @@ -412,22 +407,18 @@ stop_service() { is_runlevel_stop && level="${OLDSOFTLEVEL}" if is_fake_service "${service}" "${level}" ; then - splash "svc_stop" "${service}" mark_service_stopped "${service}" - splash "svc_stopped" "${service}" "0" return 0 fi begin_service "${service}" || return 0 - splash "svc_stop" "${service}" if [[ ${RC_PARALLEL_STARTUP} != "yes" || \ ${STOP_CRITICAL} == "yes" ]] ; then # if we can not start the services in parallel # then just start it and return the exit status ( "/etc/init.d/${service}" stop ) retval=$? - splash "svc_stopped" "${service}" "${retval}" end_service "${service}" "${retval}" return "${retval}" else @@ -435,7 +426,6 @@ stop_service() { ( ( "/etc/init.d/${service}" stop ) retval=$? - splash "svc_stopped" "${service}" "${retval}" end_service "${service}" "${retval}" ) & return 0 diff --git a/sbin/runscript.sh b/sbin/runscript.sh index 830794b..6e7404c 100755 --- a/sbin/runscript.sh +++ b/sbin/runscript.sh @@ -109,8 +109,7 @@ svc_stop() { service_message "Stopping service ${myservice}" if in_runlevel "${myservice}" "${BOOTLEVEL}" && \ - [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" && \ - ${SOFTLEVEL} != "single" ]] ; then + [[ ${SOFTLEVEL} != "reboot" && ${SOFTLEVEL} != "shutdown" ]] ; then ewarn "WARNING: you are stopping a boot service." fi diff --git a/src/.cvsignore b/src/.cvsignore deleted file mode 100644 index a26e40b..0000000 --- a/src/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.cvsignore -*.o -consoletype -runscript -start-stop-daemon diff --git a/tarball.sh b/tarball.sh deleted file mode 100755 index b771612..0000000 --- a/tarball.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -export TMP="${TMP:-/tmp}" -export V="1.12.0_pre11" -export NAME="baselayout" -export DEST="${TMP}/${NAME}-${V}" - -if [[ $1 != "-f" ]] ; then - echo "Performing sanity checks (run with -f to skip) ..." - - # Check that we're updated - svnfiles=$( svn status 2>&1 | egrep -v '^(U|P)' ) - if [[ -n ${svnfiles} ]] ; then - echo "Refusing to package tarball until svn is in sync:" - echo "$svnfiles" - exit 1 - fi -fi - -echo "Creating tarball ..." -rm -rf ${DEST} -install -d -m0755 ${DEST} - -for x in bin etc init.d sbin src rc-lists man ; do - cp -ax $x ${DEST} -done - -# do not yet package src/core stuff -#rm -rf ${DEST}/src/core - -# copy net-scripts and remove older stuff -install -d -m0755 ${DEST}/lib/rcscripts -cp -ax net-scripts/init.d ${DEST} -cp -ax net-scripts/net.modules.d ${DEST}/lib/rcscripts -cp -ax net-scripts/conf.d ${DEST}/etc -ln -sfn net.lo ${DEST}/init.d/net.eth0 - -cp ChangeLog ${DEST} - -chown -R root:root ${DEST} -chmod 0755 ${DEST}/sbin/* -chmod 0755 ${DEST}/init.d/* -( cd $TMP/${NAME}-${V} ; rm -rf `find -iname .svn` ) -cd $TMP -tar cjvf ${TMP}/${NAME}-${V}.tar.bz2 ${NAME}-${V} -rm -rf ${NAME}-${V} - -echo -du -b ${TMP}/${NAME}-${V}.tar.bz2 |