diff options
-rw-r--r-- | Makefile | 29 | ||||
-rwxr-xr-x | NetworkManager/dispatcher.d/05-netfs | 17 | ||||
-rw-r--r-- | README-init | 26 | ||||
-rw-r--r-- | init/control-alt-delete.conf | 8 | ||||
-rw-r--r-- | init/plymouth-shutdown.conf | 16 | ||||
-rw-r--r-- | init/prefdm.conf | 12 | ||||
-rw-r--r-- | init/quit-plymouth.conf | 14 | ||||
-rw-r--r-- | init/rc.conf | 14 | ||||
-rw-r--r-- | init/rcS-sulogin.conf | 23 | ||||
-rw-r--r-- | init/rcS.conf | 28 | ||||
-rw-r--r-- | init/serial.conf | 30 | ||||
-rw-r--r-- | init/splash-manager.conf | 22 | ||||
-rw-r--r-- | init/start-ttys.conf | 15 | ||||
-rw-r--r-- | init/tty.conf | 9 | ||||
-rw-r--r-- | initscripts.spec | 98 | ||||
-rw-r--r-- | inittab | 62 | ||||
-rw-r--r-- | inittab.s390 | 48 | ||||
-rw-r--r-- | inittab.systemd | 15 | ||||
-rw-r--r-- | inittab.upstart | 26 | ||||
-rwxr-xr-x | rc.d/init.d/halt | 213 | ||||
-rwxr-xr-x | rc.d/init.d/killall | 35 | ||||
-rwxr-xr-x | rc.d/init.d/netfs | 187 | ||||
-rwxr-xr-x | rc.d/init.d/single | 24 | ||||
-rwxr-xr-x | rc.d/rc | 104 | ||||
-rwxr-xr-x | rc.d/rc.local | 7 | ||||
-rwxr-xr-x | rc.d/rc.sysinit | 666 | ||||
-rw-r--r-- | src/Makefile | 15 | ||||
-rw-r--r-- | src/console_check.c | 207 | ||||
-rw-r--r-- | src/console_init.c | 168 | ||||
-rw-r--r-- | src/securetty.8 | 15 | ||||
-rw-r--r-- | src/securetty.c | 127 | ||||
-rw-r--r-- | udev/rules.d/10-console.rules | 15 |
32 files changed, 18 insertions, 2277 deletions
@@ -20,12 +20,7 @@ install: mkdir -p $(ROOT)/var/lib/stateless/state install -m644 adjtime $(ROOT)/etc - install -m644 inittab $(ROOT)/etc/inittab.sysv - if uname -m | grep -q s390 ; then \ - install -m644 inittab.s390 $(ROOT)/etc/inittab.sysv ; \ - fi - install -m644 inittab.upstart $(ROOT)/etc/inittab.upstart - install -m644 inittab.systemd $(ROOT)/etc/inittab.systemd + install -m644 inittab $(ROOT)/etc install -m644 rwtab statetab networks $(ROOT)/etc install -m755 service setsysfont $(ROOT)/sbin install -m644 lang.csh lang.sh $(ROOT)/etc/profile.d @@ -43,11 +38,10 @@ install: install -m755 prefdm $(ROOT)/etc/X11/prefdm install -m755 -d $(ROOT)/etc/rc.d $(ROOT)/etc/sysconfig - install -m755 rc.d/rc rc.d/rc.local rc.d/rc.sysinit $(ROOT)/etc/rc.d/ cp -af rc.d/init.d $(ROOT)/etc/rc.d/ install -m644 sysconfig/debug sysconfig/init sysconfig/netconsole sysconfig/readonly-root $(ROOT)/etc/sysconfig/ cp -af sysconfig/network-scripts $(ROOT)/etc/sysconfig/ - cp -af ppp NetworkManager init $(ROOT)/etc + cp -af ppp NetworkManager $(ROOT)/etc mkdir -p $(ROOT)/lib/systemd/ cp -af systemd/* $(ROOT)/lib/systemd/ mkdir -p $(ROOT)/etc/ppp/peers @@ -62,7 +56,6 @@ install: chmod 755 $(ROOT)/etc/sysconfig/network-scripts/init* chmod 755 $(ROOT)/etc/sysconfig/network-scripts/net.hotplug chmod 755 $(ROOT)/etc/NetworkManager/dispatcher.d/00-netreport - chmod 644 $(ROOT)/etc/init/* mkdir -p $(ROOT)/etc/sysconfig/modules mkdir -p $(ROOT)/etc/sysconfig/networking/devices mkdir -p $(ROOT)/etc/sysconfig/networking/profiles/default @@ -101,21 +94,6 @@ install: done # Can't store symlinks in a CVS archive - ln -s ../init.d/killall $(ROOT)/etc/rc.d/rc0.d/S00killall - ln -s ../init.d/killall $(ROOT)/etc/rc.d/rc6.d/S00killall - - ln -s ../init.d/halt $(ROOT)/etc/rc.d/rc0.d/S01halt - ln -s ../init.d/halt $(ROOT)/etc/rc.d/rc6.d/S01reboot - - ln -s ../init.d/single $(ROOT)/etc/rc.d/rc1.d/S99single - - ln -s ../rc.local $(ROOT)/etc/rc.d/rc2.d/S99rc-local - ln -s ../rc.local $(ROOT)/etc/rc.d/rc3.d/S99rc-local - ln -s ../rc.local $(ROOT)/etc/rc.d/rc4.d/S99rc-local - ln -s ../rc.local $(ROOT)/etc/rc.d/rc5.d/S99rc-local - - ln -s halt $(ROOT)/etc/rc.d/init.d/reboot - mkdir -p -m 755 $(ROOT)/lib/systemd/system/multi-user.target.wants mkdir -p -m 755 $(ROOT)/lib/systemd/system/graphical.target.wants ln -s reboot.target $(ROOT)/lib/systemd/system/ctrl-alt-del.target @@ -139,9 +117,6 @@ install: for i in 0 1 2 3 4 5 6 ; do \ ln -s rc.d/rc$$i.d $(ROOT)/etc/rc$$i.d; \ done - for i in rc rc.sysinit rc.local ; do \ - ln -s rc.d/$$i $(ROOT)/etc/$$i; \ - done mkdir -p -m 755 $(ROOT)/usr/libexec/initscripts/legacy-actions diff --git a/NetworkManager/dispatcher.d/05-netfs b/NetworkManager/dispatcher.d/05-netfs deleted file mode 100755 index bd558464..00000000 --- a/NetworkManager/dispatcher.d/05-netfs +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -export LC_ALL=C -export SYSTEMCTL_SKIP_REDIRECT=1 - -if [ "$2" = "down" ]; then - /sbin/ip route ls | grep -q ^default || { - [ -f /var/lock/subsys/netfs ] && /etc/rc.d/init.d/netfs stop || : - } && { :; } -fi - -if [ "$2" = "up" ]; then - /sbin/ip -o route show dev "$1" | grep -q '^default' && { - /sbin/chkconfig netfs && /etc/rc.d/init.d/netfs start || : - } || { :; } -fi - diff --git a/README-init b/README-init deleted file mode 100644 index 9a9b4cfa..00000000 --- a/README-init +++ /dev/null @@ -1,26 +0,0 @@ -The upstart scripts in /etc/init originate from event-compat-sysv-0.3.9, -and have since been heavily modified. - -The original copyright is: - -Copyright © 2008 Canonical Ltd. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/init/control-alt-delete.conf b/init/control-alt-delete.conf deleted file mode 100644 index 35cb1305..00000000 --- a/init/control-alt-delete.conf +++ /dev/null @@ -1,8 +0,0 @@ -# control-alt-delete - emergency keypress handling -# -# This task is run whenever the Control-Alt-Delete key combination is -# pressed. Usually used to shut down the machine. - -start on control-alt-delete - -exec /sbin/shutdown -r now "Control-Alt-Delete pressed" diff --git a/init/plymouth-shutdown.conf b/init/plymouth-shutdown.conf deleted file mode 100644 index 49010848..00000000 --- a/init/plymouth-shutdown.conf +++ /dev/null @@ -1,16 +0,0 @@ -# plymouth-shutdown - put up shutdown splash -# -# This service triggers plymouth to put up a splash -# when leaving runlevel 5. - -start on (splash-request IMMEDIATE=1) or (splash-request and stopped prefdm) - -task -console output -script - /sbin/plymouthd --mode="$MODE" || exit 1 - /bin/plymouth --sysinit - /bin/plymouth --show-splash - /bin/plymouth message --text="$MESSAGE" -end script - diff --git a/init/prefdm.conf b/init/prefdm.conf deleted file mode 100644 index 701b8065..00000000 --- a/init/prefdm.conf +++ /dev/null @@ -1,12 +0,0 @@ -# prefdm - preferred display manager -# -# Starts gdm/xdm/etc by preference - -start on stopped rc RUNLEVEL=5 - -stop on starting rc RUNLEVEL=[!5] - -console output -respawn -respawn limit 10 120 -exec /etc/X11/prefdm -nodaemon diff --git a/init/quit-plymouth.conf b/init/quit-plymouth.conf deleted file mode 100644 index 7a67b071..00000000 --- a/init/quit-plymouth.conf +++ /dev/null @@ -1,14 +0,0 @@ -# quit-plymouth - script to stop boot splash -# -# This service triggers plymouth to quit when we reach the -# end of the boot cycle. We start on 'stopping rcX' to make sure -# this completes before the getty starts. -# prefdm handles quit differently, though. - -start on runlevel S or stopping rc RUNLEVEL=[234] - -task - -script - /bin/plymouth quit || : -end script diff --git a/init/rc.conf b/init/rc.conf deleted file mode 100644 index e7285e47..00000000 --- a/init/rc.conf +++ /dev/null @@ -1,14 +0,0 @@ -# rc - System V runlevel compatibility -# -# This task runs the old sysv-rc runlevel scripts. It -# is usually started by the telinit compatibility wrapper. - -start on runlevel [0123456] - -stop on runlevel [!$RUNLEVEL] - -task - -export RUNLEVEL -console output -exec /etc/rc.d/rc $RUNLEVEL diff --git a/init/rcS-sulogin.conf b/init/rcS-sulogin.conf deleted file mode 100644 index 818518de..00000000 --- a/init/rcS-sulogin.conf +++ /dev/null @@ -1,23 +0,0 @@ -# rcS-sulogin - "single-user" runlevel compatibility -# -# This task runs /bin/bash during "single-user" mode, -# then continues to the default runlevel. - -start on runlevel S - -stop on runlevel [!S] - -console owner -script - . /etc/sysconfig/init - plymouth --hide-splash || true - [ -z "$SINGLE" ] && SINGLE=/sbin/sushell - exec $SINGLE -end script -post-stop script - if [ "$RUNLEVEL" = "S" ]; then - [ -f /etc/inittab ] && runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - [ -z "$runlevel" ] && runlevel="3" - exec telinit $runlevel - fi -end script diff --git a/init/rcS.conf b/init/rcS.conf deleted file mode 100644 index 6f2e7d17..00000000 --- a/init/rcS.conf +++ /dev/null @@ -1,28 +0,0 @@ -# rcS - runlevel compatibility -# -# This task runs the old sysv-rc startup scripts. - -start on startup - -stop on runlevel - -task - -# Note: there can be no previous runlevel here, if we have one it's bad -# information (we enter rc1 not rcS for maintenance). Run /etc/rc.d/rc -# without information so that it defaults to previous=N runlevel=S. -console output -exec /etc/rc.d/rc.sysinit -post-stop script - if [ "$UPSTART_EVENTS" = "startup" ]; then - [ -f /etc/inittab ] && runlevel=$(/bin/awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - [ -z "$runlevel" ] && runlevel="3" - for t in $(cat /proc/cmdline); do - case $t in - -s|single|S|s) runlevel="S" ;; - [1-9]) runlevel="$t" ;; - esac - done - exec telinit $runlevel - fi -end script diff --git a/init/serial.conf b/init/serial.conf deleted file mode 100644 index dcf7df43..00000000 --- a/init/serial.conf +++ /dev/null @@ -1,30 +0,0 @@ -# Automatically start a configured serial console -# -# How this works: -# -# On boot, a udev helper examines /dev/console. If a serial console is the -# primary console (last console on the commandline in grub), the event -# 'fedora.serial-console-available <port name> <speed>' is emitted, which -# triggers this script. It waits for the runlevel to finish, ensures -# the proper port is in /etc/securetty, and starts the getty. -# -# If your serial console is not the primary console, or you want a getty -# on serial even if it's not the console, create your own event e.g. -# /etc/init/ttyS0.conf with content: -# # ttyS0 - agetty -# # -# # This service maintains a agetty on ttyS0. -# -# stop on runlevel [S016] -# start on runlevel [23] -# -# respawn -# exec agetty -h -L -w /dev/ttyS0 115200 vt102 - -start on fedora.serial-console-available DEV=* and stopped rc RUNLEVEL=[2345] -stop on runlevel [S016] - -instance $DEV -respawn -pre-start exec /sbin/securetty $DEV -exec /sbin/agetty /dev/$DEV $SPEED vt100-nav diff --git a/init/splash-manager.conf b/init/splash-manager.conf deleted file mode 100644 index eea28ca4..00000000 --- a/init/splash-manager.conf +++ /dev/null @@ -1,22 +0,0 @@ -# splash-manager - requests splash screen -# -# This service emits a splash-request event when -# its time to put up the plymouth splash - -start on starting rc RUNLEVEL=[06] -task - -console output -script - if [ "$RUNLEVEL" = "0" ]; then - MESSAGE=$"Shutting down..." - elif [ "$RUNLEVEL" = "6" ]; then - MESSAGE=$"Restarting..." - fi - if initctl status prefdm 2>/dev/null | grep -q stop/waiting; then - initctl emit splash-request IMMEDIATE=1 MODE=shutdown MESSAGE="$MESSAGE" - else - initctl emit splash-request MODE=shutdown MESSAGE="$MESSAGE" - fi -end script - diff --git a/init/start-ttys.conf b/init/start-ttys.conf deleted file mode 100644 index 1528cf4b..00000000 --- a/init/start-ttys.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -# This service starts the configured number of gettys. - -start on stopped rc RUNLEVEL=[2345] - -env ACTIVE_CONSOLES=/dev/tty[1-6] -env X_TTY=/dev/tty1 -task -script - . /etc/sysconfig/init - for tty in $(echo $ACTIVE_CONSOLES) ; do - [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue - initctl start tty TTY=$tty - done -end script diff --git a/init/tty.conf b/init/tty.conf deleted file mode 100644 index fca6388e..00000000 --- a/init/tty.conf +++ /dev/null @@ -1,9 +0,0 @@ -# tty - getty -# -# This service maintains a getty on the specified device. - -stop on runlevel [S016] - -respawn -instance $TTY -exec /sbin/mingetty $TTY diff --git a/initscripts.spec b/initscripts.spec index 1495a7bc..d7bf08a3 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -1,7 +1,3 @@ -%define _with_upstart 0 -%define _with_systemd 1 -%define _with_sysvinit 0 - Summary: The inittab file and the /etc/init.d scripts Name: initscripts Version: 9.39 @@ -12,6 +8,7 @@ Release: 1%{?dist} URL: http://fedorahosted.org/releases/i/n/initscripts/ Source: http://fedorahosted.org/releases/i/n/initscripts/initscripts-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Obsoletes: initscripts-legacy <= 9.39 Requires: /bin/awk, sed, coreutils Requires: /sbin/sysctl Requires: /sbin/fuser, grep @@ -19,24 +16,9 @@ Requires: module-init-tools Requires: util-linux >= 2.16 Requires: bash >= 3.0 Requires: sysvinit-tools >= 2.87-5 -%if %{_with_upstart} -Conflicts: upstart < 0.6.0 -Requires: mingetty -%if ! %{_with_systemd} -Requires: upstart-sysvinit -%endif -%endif -%if %{_with_systemd} Conflicts: systemd < 23-1 Conflicts: systemd-units < 23-1 -%if ! %{_with_upstart} Requires: systemd-sysvinit -%endif -%endif -%if %{_with_sysvinit} -Requires: SysVinit >= 2.85-38 -Requires: mingetty -%endif Requires: iproute, /sbin/arping, findutils Requires: /etc/system-release Requires: udev >= 125-1 @@ -54,15 +36,6 @@ your Red Hat or Fedora system, change runlevels, and shut the system down cleanly. Initscripts also contains the scripts that activate and deactivate most network interfaces. -%package legacy -Summary: Support for legacy booting methods -Requires: initscripts = %{version}-%{release} -Group: System Environment/Base - -%description legacy -The initscripts-legacy package contains basic scripts that may be -required to boot the system using older init systems - %package -n debugmode Summary: Scripts for running in debugging mode Requires: initscripts @@ -86,23 +59,6 @@ make ROOT=$RPM_BUILD_ROOT SUPERUSER=`id -un` SUPERGROUP=`id -gn` mandir=%{_mandi %find_lang %{name} -%if %{_with_systemd} - mv -f $RPM_BUILD_ROOT/etc/inittab.systemd $RPM_BUILD_ROOT/etc/inittab -%endif -%if %{_with_upstart} - mv -f $RPM_BUILD_ROOT/etc/inittab.upstart $RPM_BUILD_ROOT/etc/inittab -%endif -%if %{_with_sysvinit} - mv -f $RPM_BUILD_ROOT/etc/inittab.sysv $RPM_BUILD_ROOT/etc/inittab -%endif -%if ! %{_with_upstart} - rm -rf $RPM_BUILD_ROOT/etc/init -%endif -%if ! %{_with_systemd} - rm -rf $RPM_BUILD_ROOT/lib/systemd -%endif -rm -f $RPM_BUILD_ROOT/etc/inittab.* - %ifnarch s390 s390x rm -f \ $RPM_BUILD_ROOT/etc/sysconfig/network-scripts/ifup-ctc \ @@ -130,39 +86,25 @@ chmod 600 /var/log/btmp /sbin/chkconfig --add network /sbin/chkconfig --add netconsole -%if %{_with_systemd} if [ $1 -eq 1 ]; then /bin/systemctl daemon-reload > /dev/null 2>&1 || : fi -%endif %preun if [ $1 = 0 ]; then - /sbin/chkconfig --del netfs /sbin/chkconfig --del network /sbin/chkconfig --del netconsole fi -%post legacy -/sbin/chkconfig --add netfs - -%preun legacy -if [ $1 = 0 ]; then - /sbin/chkconfig --del netfs -fi - %triggerun -- initscripts < 7.62 /sbin/chkconfig --del random /sbin/chkconfig --del rawdevices exit 0 -%if %{_with_systemd} %postun if [ $1 -ge 1 ]; then /bin/systemctl daemon-reload > /dev/null 2>&1 || : fi -%endif - %clean rm -rf $RPM_BUILD_ROOT @@ -222,27 +164,15 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/rwtab.d /etc/statetab %dir /etc/statetab.d -%if %{_with_upstart} -/etc/init/* -%endif -%if %{_with_systemd} -/lib/systemd/* +/lib/systemd/fedora-* /lib/systemd/system/* -%endif %config /etc/X11/prefdm %config(noreplace) /etc/inittab %dir /etc/rc.d %dir /etc/rc.d/rc[0-9].d -%config(missingok) /etc/rc.d/rc[0-9].d/* -%exclude /etc/rc.d/rc[0-9].d/* /etc/rc[0-9].d %dir /etc/rc.d/init.d /etc/rc.d/init.d/* -%exclude /etc/rc.d/init.d/netfs -%exclude /etc/rc.d/init.d/halt -%exclude /etc/rc.d/init.d/killall -%exclude /etc/rc.d/init.d/reboot -%exclude /etc/rc.d/init.d/single %ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/rc.d/rc.local /usr/lib/sysctl.d/00-system.conf %exclude /etc/profile.d/debug* @@ -259,12 +189,10 @@ rm -rf $RPM_BUILD_ROOT /sbin/sushell %attr(2755,root,root) /sbin/netreport /lib/udev/rules.d/* -%exclude /lib/udev/rules.d/10-console.rules /lib/udev/rename_device /sbin/service /sbin/ppp-watch %{_mandir}/man*/* -%exclude %{_mandir}/man*/securetty* %dir %attr(775,root,root) /var/run/netreport %dir /etc/ppp %dir /etc/ppp/peers @@ -277,7 +205,7 @@ rm -rf $RPM_BUILD_ROOT %dir /etc/NetworkManager %dir /etc/NetworkManager/dispatcher.d /etc/NetworkManager/dispatcher.d/00-netreport -%doc sysconfig.txt sysvinitfiles static-routes-ipv6 ipv6-tunnel.howto ipv6-6to4.howto changes.ipv6 COPYING README-init +%doc sysconfig.txt sysvinitfiles static-routes-ipv6 ipv6-tunnel.howto ipv6-6to4.howto changes.ipv6 COPYING /var/lib/stateless %ghost %attr(0600,root,utmp) /var/log/btmp %ghost %attr(0664,root,utmp) /var/log/wtmp @@ -287,26 +215,6 @@ rm -rf $RPM_BUILD_ROOT /lib/tmpfiles.d/initscripts.conf %dir /usr/libexec/initscripts/legacy-actions -%files legacy -%defattr(-,root,root) -%config(noreplace) /etc/inittab -/etc/NetworkManager/dispatcher.d/05-netfs -%dir /etc/rc.d -%dir /etc/rc.d/rc[0-9].d -%config(missingok) /etc/rc.d/rc[0-9].d/* -/etc/rc[0-9].d -/etc/rc -%dir /etc/rc.d/init.d -/etc/rc.sysinit -/etc/rc.d/init.d/* -/etc/rc.d/rc -/etc/rc.d/rc.sysinit -/lib/udev/rules.d/* -/lib/udev/console_init -/lib/udev/console_check -/sbin/securetty -%{_mandir}/man*/securetty* - %files -n debugmode %defattr(-,root,root) %config(noreplace) /etc/sysconfig/debug @@ -1,53 +1,15 @@ +# inittab is no longer used when using systemd. # -# inittab This file describes how the INIT process should set up -# the system in a certain run-level. +# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # -# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# Modified for RHS Linux by Marc Ewing and Donnie Barnes +# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target +# +# systemd uses 'targets' instead of runlevels. By default, there are two main targets: +# +# multi-user.target: analogous to runlevel 3 +# graphical.target: analogous to runlevel 5 +# +# To set a default target, run: +# +# ln -s /lib/systemd/system/<target name>.target /etc/systemd/system/default.target # - -# Default runlevel. The runlevels used by RHS are: -# 0 - halt (Do NOT set initdefault to this) -# 1 - Single user mode -# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) -# 3 - Full multiuser mode -# 4 - unused -# 5 - X11 -# 6 - reboot (Do NOT set initdefault to this) -# -id:3:initdefault: - -# System initialization. -si::sysinit:/etc/rc.d/rc.sysinit - -l0:0:wait:/etc/rc.d/rc 0 -l1:1:wait:/etc/rc.d/rc 1 -l2:2:wait:/etc/rc.d/rc 2 -l3:3:wait:/etc/rc.d/rc 3 -l4:4:wait:/etc/rc.d/rc 4 -l5:5:wait:/etc/rc.d/rc 5 -l6:6:wait:/etc/rc.d/rc 6 - -# Trap CTRL-ALT-DELETE -ca::ctrlaltdel:/sbin/shutdown -t3 -r now - -# When our UPS tells us power has failed, assume we have a few minutes -# of power left. Schedule a shutdown for 2 minutes from now. -# This does, of course, assume you have powerd installed and your -# UPS connected and working correctly. -pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" - -# If power was restored before the shutdown kicked in, cancel it. -pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" - - -# Run gettys in standard runlevels -1:2345:respawn:/sbin/mingetty tty1 -2:2345:respawn:/sbin/mingetty tty2 -3:2345:respawn:/sbin/mingetty tty3 -4:2345:respawn:/sbin/mingetty tty4 -5:2345:respawn:/sbin/mingetty tty5 -6:2345:respawn:/sbin/mingetty tty6 - -# Run xdm in runlevel 5 -x:5:respawn:/etc/X11/prefdm -nodaemon diff --git a/inittab.s390 b/inittab.s390 deleted file mode 100644 index 6c0a7ee1..00000000 --- a/inittab.s390 +++ /dev/null @@ -1,48 +0,0 @@ -# -# inittab This file describes how the INIT process should set up -# the system in a certain run-level. -# -# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# Modified for RHS Linux by Marc Ewing and Donnie Barnes -# - -# Default runlevel. The runlevels used by RHS are: -# 0 - halt (Do NOT set initdefault to this) -# 1 - Single user mode -# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) -# 3 - Full multiuser mode -# 4 - unused -# 5 - X11 -# 6 - reboot (Do NOT set initdefault to this) -# -id:3:initdefault: - -# System initialization. -si::sysinit:/etc/rc.d/rc.sysinit - -l0:0:wait:/etc/rc.d/rc 0 -l1:1:wait:/etc/rc.d/rc 1 -l2:2:wait:/etc/rc.d/rc 2 -l3:3:wait:/etc/rc.d/rc 3 -l4:4:wait:/etc/rc.d/rc 4 -l5:5:wait:/etc/rc.d/rc 5 -l6:6:wait:/etc/rc.d/rc 6 - -# Trap CTRL-ALT-DELETE -ca::ctrlaltdel:/sbin/shutdown -t3 -r now - -# When our UPS tells us power has failed, assume we have a few minutes -# of power left. Schedule a shutdown for 2 minutes from now. -# This does, of course, assume you have powerd installed and your -# UPS connected and working correctly. -pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" - -# If power was restored before the shutdown kicked in, cancel it. -pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" - - -# Run gettys in standard runlevels -1:2345:respawn:/sbin/mingetty console --noclear - -# Run xdm in runlevel 5 -x:5:respawn:/etc/X11/prefdm -nodaemon diff --git a/inittab.systemd b/inittab.systemd deleted file mode 100644 index c9694e65..00000000 --- a/inittab.systemd +++ /dev/null @@ -1,15 +0,0 @@ -# inittab is no longer used when using systemd. -# -# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. -# -# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target -# -# systemd uses 'targets' instead of runlevels. By default, there are two main targets: -# -# multi-user.target: analogous to runlevel 3 -# graphical.target: analogous to runlevel 5 -# -# To set a default target, run: -# -# ln -s /lib/systemd/system/<target name>.target /etc/systemd/system/default.target -# diff --git a/inittab.upstart b/inittab.upstart deleted file mode 100644 index b9f2a19b..00000000 --- a/inittab.upstart +++ /dev/null @@ -1,26 +0,0 @@ -# inittab is only used by upstart for the default runlevel. -# -# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. -# -# System initialization is started by /etc/init/rcS.conf -# -# Individual runlevels are started by /etc/init/rc.conf -# -# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf -# -# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf, -# with configuration in /etc/sysconfig/init. -# -# For information on how to write upstart event handlers, or how -# upstart works, see init(5), init(8), and initctl(8). -# -# Default runlevel. The runlevels used are: -# 0 - halt (Do NOT set initdefault to this) -# 1 - Single user mode -# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) -# 3 - Full multiuser mode -# 4 - unused -# 5 - X11 -# 6 - reboot (Do NOT set initdefault to this) -# -id:3:initdefault: diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt deleted file mode 100755 index 8b990791..00000000 --- a/rc.d/init.d/halt +++ /dev/null @@ -1,213 +0,0 @@ -#!/bin/bash -# -# halt 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. -# -# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# Modified for RHS Linux by Damien Neil -# - -NOLOCALE=1 -. /etc/init.d/functions - -UMOUNT="umount" -[ ! -w /etc ] && UMOUNT="umount -n" - -halt_crypto() { - fnval=0 - while read dst src key; do - [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue - if [ -b "/dev/mapper/$dst" ]; then - if /sbin/dmsetup info "$dst" | grep -q '^Open count: *0$'; then - action $"Stopping disk encryption for $dst" /sbin/cryptsetup remove "$dst" - else - fnval=1 - fi - fi - done < /etc/crypttab - return $fnval -} - -kill_all() { - local STRING rc - - STRING=$1 - echo -n "$STRING " - shift - /sbin/killall5 "$@" - rc=$? - # Retval: 0: success 1: error 2: no processes found to kill - if [ "$rc" == 1 ]; then - failure $"$STRING" - else - success $"$STRING" - fi - echo - return $rc -} - -# See how we were called. -case "$0" in - *halt) - message=$"Halting system..." - command="/sbin/halt" - ;; - *reboot) - message=$"Please stand by while rebooting the system..." - command="/sbin/reboot" - kexec_command="/sbin/kexec" - ;; - *) - echo $"$0: call me as 'halt' or 'reboot' please!" - exit 1 - ;; -esac -case "$1" in - *start) - ;; - *) - echo $"Usage: $0 {start}" - exit 1 - ;; -esac - -# Kill all processes. -[ "${BASH+bash}" = bash ] && enable kill - -# Find mdmon pid's and omit killing them -OMITARGS= -for i in /dev/md/*.pid; do - if [ ! -r "$i" ]; then - continue - fi - OMITARGS="$OMITARGS -o $(cat $i)" -done - -kill_all $"Sending all processes the TERM signal..." -15 $OMITARGS -# No need to sleep and kill -9 if no processes to kill were found -if [ "$?" == 0 ]; then - sleep 2 - kill_all $"Sending all processes the KILL signal..." -9 $OMITARGS -fi - -# Write to wtmp file before unmounting /var -/sbin/halt -w - -# Save mixer settings, here for lack of a better place. -if [ -s /etc/alsa/alsactl.conf ] && [ -x /sbin/alsactl ] && [ -w /etc/asound.state ]; then - action $"Saving mixer settings" /sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --ignore store -fi - -# Save random seed -touch /var/lib/random-seed -chmod 600 /var/lib/random-seed -action $"Saving random seed: " dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null - -[ -x /sbin/hwclock ] && action $"Syncing hardware clock to system time" /sbin/hwclock --systohc - -# Try to unmount tmpfs filesystems to avoid swapping them in. Ignore failures. -tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; } - $3 == "tmpfs" { print $2; }' /proc/mounts | sort -r) -[ -n "$tmpfs" ] && fstab-decode $UMOUNT $tmpfs 2>/dev/null - -# Turn off swap, then unmount file systems. -[ -f /proc/swaps ] && SWAPS=$(awk '! /^Filename/ { print $1 }' /proc/swaps) -if [ -n "$SWAPS" ]; then - action $"Turning off swap: " swapoff $SWAPS - for dst in $SWAPS; do - if [[ "$dst" == /dev/mapper* ]] \ - && [ "$(dmsetup status "$dst" | cut -d ' ' -f 3)" = crypt ]; then - backdev=$(/sbin/cryptsetup status "$dst" \ - | awk '$1 == "device:" { print $2 }') - /sbin/cryptsetup remove "$dst" - fi - done -fi - -[ -x /sbin/quotaoff ] && action $"Turning off quotas: " /sbin/quotaoff -aug - -# Unmount file systems, killing processes if we have to. -# Unmount loopback stuff first -__umount_loopback_loop - -# Unmount RPC pipe file systems -__umount_loop '$3 ~ /^rpc_pipefs$/ || $3 ~ /^rpc_svc_gss_pipefs$/ {print $2}' \ - /proc/mounts \ - $"Unmounting pipe file systems: " \ - $"Unmounting pipe file systems (retry): " \ - -f - -LANG=C __umount_loop '$2 ~ /^\/$|^\/proc|^\/cgroup|^\/sys\/fs\/cgroup|^\/dev/{next} - $3 == "tmpfs" || $3 == "proc" {print $2 ; next} - $3 ~ /(loopfs|autofs|nfs|cifs|smbfs|ncpfs|sysfs)/ {next} - /(^none|^\/dev\/ram|^\/dev\/root$)/ {next} - {print $2}' /proc/mounts \ - $"Unmounting file systems: " \ - $"Unmounting file systems (retry): " \ - -f - -[ -f /proc/bus/usb/devices ] && $UMOUNT /proc/bus/usb - -[ -f /etc/crypttab ] && halt_crypto - -# remove the crash indicator flag -rm -f /.autofsck - -# Try all file systems other than root, essential filesystems and RAM disks, -# one last time. -awk '$2 !~ /\/(|dev|proc|selinux|cgroup|sys)$/ && $1 !~ /(^\/dev\/ram|cgroup)/ { print $2 }' \ - /proc/mounts | sort -r | \ - while read line; do - fstab-decode $UMOUNT -f $line -done - -if [ -x /sbin/halt.local ]; then - /sbin/halt.local -fi - -# Tell init to re-exec itself. -kill -TERM 1 - -# Remount read only anything that's left mounted. -# echo $"Remounting remaining filesystems readonly" -mount | awk '{ print $1,$3 }' | while read dev dir; do - fstab-decode mount -n -o ro,remount $dev $dir -done - -# If we left mdmon's running wait for the raidsets to become clean -if [ -n "$OMITARGS" ]; then - mdadm --wait-clean --scan -fi - -# Now halt or reboot. -echo $"$message" -if [ -f /fastboot ]; then - echo $"On the next boot fsck will be skipped." -elif [ -f /forcefsck ]; then - echo $"On the next boot fsck will be forced." -fi - -# Shutdown UPS drivers -if [ "$command" = /sbin/halt ] && [ -f /etc/sysconfig/ups ]; then - . /etc/sysconfig/ups - if [ -z $POWERDOWNFLAG ]; then - POWERDOWNFLAG=/etc/killpower - fi - if [ "$SERVER" = "yes" ] && [ -f $POWERDOWNFLAG ]; then - /sbin/upsdrvctl shutdown - fi -fi - -# Turn off UPS in powerfail situation -if [ -x /etc/apcupsd/apccontrol -a -f /etc/apcupsd/powerfail ]; then - /etc/apcupsd/apccontrol killpower -fi - -# First, try kexec. If that fails, fall back to rebooting the old way. -[ -n "$kexec_command" ] && $kexec_command -e -x >& /dev/null - -HALTARGS="-d" -[ "$INIT_HALT" != "HALT" ] && HALTARGS="$HALTARGS -p" - -exec $command $HALTARGS diff --git a/rc.d/init.d/killall b/rc.d/init.d/killall deleted file mode 100755 index 4405879c..00000000 --- a/rc.d/init.d/killall +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/bash - -# Bring down all unneeded services that are still running (there shouldn't -# be any, so this is just a sanity check) - -case "$1" in - *start) - ;; - *) - echo $"Usage: $0 {start}" - exit 1 - ;; -esac - - -for i in /var/lock/subsys/* ; do - # Check if the script is there. - [ -f "$i" ] || continue - - # Get the subsystem name. - subsys=${i#/var/lock/subsys/} - - # Networking could be needed for NFS root. - [ $subsys = network ] && continue - - # Bring the subsystem down. - if [ -f /etc/init.d/$subsys ]; then - /etc/init.d/$subsys stop - elif [ -f /etc/init.d/$subsys.init ]; then - /etc/init.d/$subsys.init stop - else - rm -f "$i" - fi -done -exit 0 diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs deleted file mode 100755 index a1bc022a..00000000 --- a/rc.d/init.d/netfs +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash -# -# netfs Mount network filesystems. -# -# Authors: Bill Nottingham <notting@redhat.com> -# AJ Lewis <alewis@redhat.com> -# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# -# chkconfig: 345 25 75 -# description: Mounts and unmounts all Network File System (NFS), \ -# CIFS (Lan Manager/Windows), and NCP (NetWare) mount points. -### BEGIN INIT INFO -# Provides: $remote_fs -# Short-Description: Mount and unmount network filesystems. -# Description: Mount and unmount network filesystems. -# Should-Start: $network -### END INIT INFO - -[ -f /etc/sysconfig/network ] || exit 0 -. /etc/init.d/functions -. /etc/sysconfig/network - -NFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $3 != "nfsd" && $4 !~ /noauto/ { print $2 }' /etc/fstab) -CIFSFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "cifs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) -NCPFSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "ncpfs" && $4 !~ /noauto/ { print $2 }' /etc/fstab) -NETDEVFSTAB=$(LC_ALL=C awk '!/^#/ && $4 ~/_netdev/ && $4 !~ /noauto/ { print $1 }' /etc/fstab) - -NFSMTAB=$(LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $2 }' /proc/mounts) -CIFSMTAB=$(LC_ALL=C awk '$3 == "cifs" { print $2 }' /proc/mounts | tac) -NCPMTAB=$(LC_ALL=C awk '$3 == "ncpfs" { print $2 }' /proc/mounts | tac) -NETDEVMTAB=$(LC_ALL=C awk '$4 ~ /_netdev/ && $2 != "/" { print $2 }' /etc/mtab) - -# See how we were called. -case "$1" in - start) - [ ! -f /var/lock/subsys/network ] && ! nm-online -x >/dev/null 2>&1 && exit 0 - [ "$EUID" != "0" ] && exit 4 - [ -n "$NFSFSTAB" ] && - { - [ ! -f /var/lock/subsys/rpcbind ] && service rpcbind start - action $"Mounting NFS filesystems: " mount -a -t nfs,nfs4 - } - [ -n "$CIFSFSTAB" ] && action $"Mounting CIFS filesystems: " mount -a -t cifs - [ -n "$NCPFSTAB" ] && action $"Mounting NCP filesystems: " mount -a -t ncpfs - [ -n "$NETDEVFSTAB" ] && - { - if [ -f /etc/mdadm.conf ] && [ -x /sbin/mdadm ]; then - /sbin/mdadm -A -s - fi - if [ -f /etc/multipath.conf ] && [ -x /sbin/multipath ]; then - modprobe dm-multipath >/dev/null 2>&1 - /sbin/multipath -u -v 0 - if [ -x /sbin/kpartx ]; then - /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -u -a -p p" - fi - fi - if [ -x /sbin/lvm ]; then - if /sbin/lvm vgscan > /dev/null 2>&1 ; then - action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y - fi - fi - - if [ -f /etc/crypttab ]; then - init_crypto 1 - fi - - STRING=$"Checking network-attached filesystems" - - echo $STRING - fsck -A -T -M -a -t opts=_netdev - rc=$? - - if [ "$rc" -eq "0" ]; then - success "$STRING" - echo - elif [ "$rc" -eq "1" ]; then - passed "$STRING" - echo - fi - - if [ "$rc" -gt 1 ]; then - if [ -x /bin/plymouth ] && /bin/plymouth --ping ; then - /bin/plymouth --hide-splash - fi - failure "$STRING" - tty >/dev/null 2>&1 || exit 1 - echo - echo - echo $"*** An error occurred during the file system check." - echo $"*** Dropping you to a shell; the system will reboot" - echo $"*** when you leave the shell." - - str=$"(Repair filesystem)" - PS1="$str \# # "; export PS1 - [ "$SELINUX" = "1" ] && disable_selinux - sulogin - - shutdown -r now - fi - } - touch /var/lock/subsys/netfs - # The 'no' applies to all listed filesystem types. See mount(8). - action $"Mounting other filesystems: " mount -a -t nonfs,nfs4,cifs,ncpfs,gfs2 - ;; - stop) - # Unmount loopback stuff first - [ "$EUID" != "0" ] && exit 4 - __umount_loopback_loop - if [ -n "$NETDEVMTAB" ]; then - __umount_loop '$4 ~ /_netdev/ && $2 != "/" {print $2}' \ - /etc/mtab \ - $"Unmounting network block filesystems: " \ - $"Unmounting network block filesystems (retry): " - fi - if [ -n "$NFSMTAB" ]; then - __umount_loop '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" {print $2}' \ - /proc/mounts \ - $"Unmounting NFS filesystems: " \ - $"Unmounting NFS filesystems (retry): " \ - "-f -l" - fi - if [ -n "$CIFSMTAB" ]; then - for MNT in $CIFSMTAB; do - action $"Unmounting CIFS filesystem: $MNT" umount "$MNT" - done - fi - if [ -n "$NCPMTAB" ]; then - for MNT in $NCPMTAB; do - action $"Unmounting NCP filesystem: $MNT" umount "$MNT" - done - fi - rm -f /var/lock/subsys/netfs - ;; - status) - if [ -f /proc/mounts ] ; then - [ -n "$NFSFSTAB" ] && { - echo $"Configured NFS mountpoints: " - for fs in $NFSFSTAB; do echo $fs ; done - } - [ -n "$CIFSFSTAB" ] && { - echo $"Configured CIFS mountpoints: " - for fs in $CIFSFSTAB; do echo $fs ; done - } - [ -n "$NCPFSTAB" ] && { - echo $"Configured NCP mountpoints: " - for fs in $NCPFSTAB; do echo $fs ; done - } - [ -n "$NETDEVFSTAB" ] && { - echo $"Configured network block devices: " - for fs in $NETDEVFSTAB; do echo $fs ; done - } - [ -n "$NFSMTAB" ] && { - echo $"Active NFS mountpoints: " - for fs in $NFSMTAB; do echo $fs ; done - } - [ -n "$CIFSMTAB" ] && { - echo $"Active CIFS mountpoints: " - for fs in $CIFSMTAB; do echo $fs ; done - } - [ -n "$NCPMTAB" ] && { - echo $"Active NCP mountpoints: " - for fs in $NCPMTAB; do echo $fs ; done - } - [ -n "$NETDEVMTAB" ] && { - echo $"Active network block devices: " - for fs in $NETDEVMTAB; do echo $fs ; done - } - else - echo $"/proc filesystem unavailable" - fi - [ -r /var/lock/subsys/netfs ] || exit 3 - ;; - restart) - $0 stop - $0 start - exit $? - ;; - reload) - $0 start - exit $? - ;; - *) - echo $"Usage: $0 {start|stop|restart|reload|status}" - exit 2 -esac - -exit 0 diff --git a/rc.d/init.d/single b/rc.d/init.d/single deleted file mode 100755 index 0ae9268e..00000000 --- a/rc.d/init.d/single +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# -# rc.single This file is executed by init when it goes into runlevel -# 1, which is the administrative state. It kills all -# deamons and then puts the system into single user mode. -# Note that the file systems are kept mounted. -# -# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# Modified for RHS Linux by Damien Neil -# - -. /etc/init.d/functions - -if [ "$1" != "start" ]; then - exit 0 -fi - -# this looks nicer -[ -x /usr/bin/clear ] && /usr/bin/clear - -# Now go to the single user level. -echo $"Telling INIT to go to single user mode." -exec init -t1 S diff --git a/rc.d/rc b/rc.d/rc deleted file mode 100755 index d7b68b69..00000000 --- a/rc.d/rc +++ /dev/null @@ -1,104 +0,0 @@ -#! /bin/bash -# -# rc This file is responsible for starting/stopping -# services when the runlevel changes. -# -# Original Author: -# Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org> -# - -set -m - -# check a file to be a correct runlevel script -check_runlevel () -{ - # Check if the file exists at all. - [ -x "$1" ] || return 1 - is_ignored_file "$1" && return 1 - return 0 -} - -# Now find out what the current and what the previous runlevel are. -argv1="$1" -set $(/sbin/runlevel) -runlevel=$2 -previous=$1 -export runlevel previous - -. /etc/init.d/functions - -export CONSOLETYPE -do_confirm="no" -if [ -f /var/run/confirm ]; then - do_confirm="yes" -fi -UPSTART= -[ -x /sbin/initctl ] && UPSTART=yes -# See if we want to be in user confirmation mode -if [ "$previous" = "N" ]; then - if [ "$do_confirm" = "yes" ]; then - echo $"Entering interactive startup" - else - echo $"Entering non-interactive startup" - fi -fi - -# Get first argument. Set new runlevel to this argument. -[ -n "$argv1" ] && runlevel="$argv1" - -# Is there an rc directory for this new runlevel? -[ -d /etc/rc$runlevel.d ] || exit 0 - -# Set language, vc settings once to avoid doing it for every init script -# through functions -if [ -z "${NOLOCALE:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then - . /etc/profile.d/lang.sh 2>/dev/null - export LANGSH_SOURCED=1 -fi - -# First, run the KILL scripts. -for i in /etc/rc$runlevel.d/K* ; do - - # Check if the subsystem is already up. - subsys=${i#/etc/rc$runlevel.d/K??} - [ -f /var/lock/subsys/$subsys ] || [ -f /var/lock/subsys/$subsys.init ] || continue - check_runlevel "$i" || continue - - # Bring the subsystem down. - [ -n "$UPSTART" ] && initctl emit --quiet stopping JOB=$subsys - $i stop - [ -n "$UPSTART" ] && initctl emit --quiet stopped JOB=$subsys -done - -# Now run the START scripts. -for i in /etc/rc$runlevel.d/S* ; do - - # Check if the subsystem is already up. - subsys=${i#/etc/rc$runlevel.d/S??} - [ -f /var/lock/subsys/$subsys ] && continue - [ -f /var/lock/subsys/$subsys.init ] && continue - check_runlevel "$i" || continue - - # If we're in confirmation mode, get user confirmation - if [ "$do_confirm" = "yes" ]; then - confirm $subsys - rc=$? - if [ "$rc" = "1" ]; then - continue - elif [ "$rc" = "2" ]; then - do_confirm="no" - fi - fi - - update_boot_stage "$subsys" - # Bring the subsystem up. - [ -n "$UPSTART" ] && initctl emit --quiet starting JOB=$subsys - if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then - export LC_ALL=C - exec $i start - fi - $i start - [ -n "$UPSTART" ] && initctl emit --quiet started JOB=$subsys -done -[ "$do_confirm" = "yes" ] && rm -f /var/run/confirm -exit 0 diff --git a/rc.d/rc.local b/rc.d/rc.local deleted file mode 100755 index c6a8faf1..00000000 --- a/rc.d/rc.local +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -# This script will be executed at the end of the boot process. -# You can put your own initialization stuff in here if you don't -# want to do the full Sys V style init stuff. - -touch /var/lock/subsys/local diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit deleted file mode 100755 index 6363e4ca..00000000 --- a/rc.d/rc.sysinit +++ /dev/null @@ -1,666 +0,0 @@ -#!/bin/bash -# -# /etc/rc.d/rc.sysinit - run once at boot time -# -# Taken in part from Miquel van Smoorenburg's bcheckrc. -# - -HOSTNAME=$(/bin/hostname) - -set -m - -if [ -f /etc/sysconfig/network ]; then - . /etc/sysconfig/network -fi -if [ -r /etc/hostname ]; then - HOSTNAME=$(cat /etc/hostname) -fi -if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; then - HOSTNAME=localhost -fi - -if [ ! -e /proc/mounts ]; then - mount -n -t proc /proc /proc - mount -n -t sysfs /sys /sys >/dev/null 2>&1 -fi -if [ ! -d /proc/bus/usb ]; then - modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -else - mount -n -t usbfs /proc/bus/usb /proc/bus/usb -fi - -. /etc/init.d/functions - -PLYMOUTH= -[ -x /bin/plymouth ] && PLYMOUTH=yes - -# Check SELinux status -SELINUX_STATE= -if [ -e "/sys/fs/selinux/enforce" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then - if [ -r "/sys/fs/selinux/enforce" ] ; then - SELINUX_STATE=$(cat "/sys/fs/selinux/enforce") - else - # assume enforcing if you can't read it - SELINUX_STATE=1 - fi -fi - -if [ -n "$SELINUX_STATE" ] && [ -x /sbin/restorecon ] && __fgrep " /dev " /proc/mounts >/dev/null 2>&1 ; then - /sbin/restorecon -R /dev 2>/dev/null -fi - -disable_selinux() { - echo $"*** Warning -- SELinux is active" - echo $"*** Disabling security enforcement for system recovery." - echo $"*** Run 'setenforce 1' to reenable." - echo "0" > "/sys/fs/selinux/enforce" -} - -relabel_selinux() { - # if /sbin/init is not labeled correctly this process is running in the - # wrong context, so a reboot will be required after relabel - AUTORELABEL= - . /etc/selinux/config - echo "0" > /sys/fs/selinux/enforce - [ -n "$PLYMOUTH" ] && plymouth --hide-splash - - if [ "$AUTORELABEL" = "0" ]; then - echo - echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required. " - echo $"*** /etc/selinux/config indicates you want to manually fix labeling" - echo $"*** problems. Dropping you to a shell; the system will reboot" - echo $"*** when you leave the shell." - sulogin - - else - echo - echo $"*** Warning -- SELinux ${SELINUXTYPE} policy relabel is required." - echo $"*** Relabeling could take a very long time, depending on file" - echo $"*** system size and speed of hard drives." - - /sbin/fixfiles -F restore > /dev/null 2>&1 - fi - rm -f /.autorelabel - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f -} - -# Print a text banner. -echo -en $"\t\tWelcome to " -read -r system_release < /etc/system-release -if [[ "$system_release" == *"Red Hat"* ]]; then - [ "$BOOTUP" = "color" ] && echo -en "\\033[0;31m" - echo -en "Red Hat" - [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" - PRODUCT=$(sed "s/Red Hat \(.*\) release.*/\1/" /etc/system-release) - echo " $PRODUCT" -elif [[ "$system_release" == *Fedora* ]]; then - [ "$BOOTUP" = "color" ] && echo -en "\\033[0;34m" - echo -en "Fedora" - [ "$BOOTUP" = "color" ] && echo -en "\\033[0;39m" - PRODUCT=$(sed "s/Fedora \(.*\) \?release.*/\1/" /etc/system-release) - echo " $PRODUCT" -else - PRODUCT=$(sed "s/ release.*//g" /etc/system-release) - echo "$PRODUCT" -fi - -# Only read this once. -cmdline=$(cat /proc/cmdline) - -# Initialize hardware -if [ -f /proc/sys/kernel/modprobe ]; then - if ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; then - sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1 - else - # We used to set this to NULL, but that causes 'failed to exec' messages" - sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1 - fi -fi - -touch /dev/.in_sysinit >/dev/null 2>&1 - -# Set default affinity -if [ -x /bin/taskset ]; then - if strstr "$cmdline" default_affinity= ; then - for arg in $cmdline ; do - if [ "${arg##default_affinity=}" != "${arg}" ]; then - /bin/taskset -p ${arg##default_affinity=} 1 - fi - done - fi -fi - -nashpid=$(pidof nash 2>/dev/null) -[ -n "$nashpid" ] && kill $nashpid >/dev/null 2>&1 -unset nashpid -action $"Starting udev: " /sbin/udevd --daemon -/sbin/udevadm trigger --type=subsystems --action=add -/sbin/udevadm trigger --type=devices --action=add -/sbin/udevadm settle - -# Load other user-defined modules -for file in /etc/sysconfig/modules/*.modules ; do - [ -x $file ] && $file -done - -# Load modules (for backward compatibility with VARs) -if [ -f /etc/rc.modules ]; then - /etc/rc.modules -fi - -mount -n /dev/pts >/dev/null 2>&1 -[ -n "$SELINUX_STATE" ] && restorecon /dev/pts >/dev/null 2>&1 - -# Configure kernel parameters -update_boot_stage RCkernelparam -apply_sysctl - -# Set the hostname. -update_boot_stage RChostname -action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME} - -# Sync waiting for storage. -{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1 - -# Device mapper & related initialization -if ! __fgrep "device-mapper" /proc/devices >/dev/null 2>&1 ; then - modprobe dm-mod >/dev/null 2>&1 -fi - -if [ -f /etc/crypttab ]; then - init_crypto 0 -fi - -if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && \ - [ -x /sbin/multipath ]; then - modprobe dm-multipath > /dev/null 2>&1 - /sbin/multipath -v 0 - if [ -x /sbin/kpartx ]; then - /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -p p" >/dev/null - fi -fi - -if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then - modprobe dm-mirror >/dev/null 2>&1 - dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i) - if [ "$?" = "0" ]; then - for dmname in $dmraidsets; do - if [[ "$dmname" == isw_* ]] && \ - ! strstr "$cmdline" noiswmd; then - continue - fi - /sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1 - /sbin/kpartx -a -p p "/dev/mapper/$dmname" - done - fi -fi - -# Start any MD RAID arrays that haven't been started yet -[ -r /proc/mdstat ] && [ -r /dev/md/md-device-map ] && /sbin/mdadm -IRs - -if [ -x /sbin/lvm ]; then - action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit -fi - -if [ -f /etc/crypttab ]; then - init_crypto 0 -fi - -if strstr "$cmdline" fastboot || [ -f /fastboot ]; then - fastboot=yes -fi - -if [ -f /fsckoptions ]; then - fsckoptions=$(cat /fsckoptions) -fi - -if strstr "$cmdline" forcefsck || [ -f /forcefsck ]; then - fsckoptions="-f $fsckoptions" -elif [ -f /.autofsck ]; then - [ -f /etc/sysconfig/autofsck ] && . /etc/sysconfig/autofsck - if [ "$AUTOFSCK_DEF_CHECK" = "yes" ]; then - AUTOFSCK_OPT="$AUTOFSCK_OPT -f" - fi - if [ -n "$AUTOFSCK_SINGLEUSER" ]; then - [ -n "$PLYMOUTH" ] && plymouth --hide-splash - echo - echo $"*** Warning -- the system did not shut down cleanly. " - echo $"*** Dropping you to a shell; the system will continue" - echo $"*** when you leave the shell." - [ -n "$SELINUX_STATE" ] && echo "0" > /sys/fs/selinux/enforce - sulogin - [ -n "$SELINUX_STATE" ] && echo "1" > /sys/fs/selinux/enforce - [ -n "$PLYMOUTH" ] && plymouth --show-splash - fi - fsckoptions="$AUTOFSCK_OPT $fsckoptions" -fi - -if [ "$BOOTUP" = "color" ]; then - fsckoptions="-C $fsckoptions" -else - fsckoptions="-V $fsckoptions" -fi - -READONLY= -if [ -f /etc/sysconfig/readonly-root ]; then - . /etc/sysconfig/readonly-root -fi -if strstr "$cmdline" readonlyroot ; then - READONLY=yes - [ -z "$RW_MOUNT" ] && RW_MOUNT=/var/lib/stateless/writable - [ -z "$STATE_MOUNT" ] && STATE_MOUNT=/var/lib/stateless/state -fi -if strstr "$cmdline" noreadonlyroot ; then - READONLY=no -fi - -if [ "$READONLY" = "yes" -o "$TEMPORARY_STATE" = "yes" ]; then - - mount_empty() { - if [ -e "$1" ]; then - echo "$1" | cpio -p -vd "$RW_MOUNT" &>/dev/null - mount -n --bind "$RW_MOUNT$1" "$1" - fi - } - - mount_dirs() { - if [ -e "$1" ]; then - mkdir -p "$RW_MOUNT$1" - find "$1" -type d -print0 | cpio -p -0vd "$RW_MOUNT" &>/dev/null - mount -n --bind "$RW_MOUNT$1" "$1" - fi - } - - mount_files() { - if [ -e "$1" ]; then - cp -a --parents "$1" "$RW_MOUNT" - mount -n --bind "$RW_MOUNT$1" "$1" - fi - } - - # Common mount options for scratch space regardless of - # type of backing store - mountopts= - - # Scan partitions for local scratch storage - rw_mount_dev=$(blkid -t LABEL="$RW_LABEL" -l -o device) - - # First try to mount scratch storage from /etc/fstab, then any - # partition with the proper label. If either succeeds, be sure - # to wipe the scratch storage clean. If both fail, then mount - # scratch storage via tmpfs. - if mount $mountopts "$RW_MOUNT" > /dev/null 2>&1 ; then - rm -rf "$RW_MOUNT" > /dev/null 2>&1 - elif [ x$rw_mount_dev != x ] && mount $rw_mount_dev $mountopts "$RW_MOUNT" > /dev/null 2>&1; then - rm -rf "$RW_MOUNT" > /dev/null 2>&1 - else - mount -n -t tmpfs $RW_OPTIONS $mountopts none "$RW_MOUNT" - fi - - for file in /etc/rwtab /etc/rwtab.d/* /run/initramfs/rwtab; do - is_ignored_file "$file" && continue - [ -f $file ] && cat $file | while read type path ; do - case "$type" in - empty) - mount_empty $path - ;; - files) - mount_files $path - ;; - dirs) - mount_dirs $path - ;; - *) - ;; - esac - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" - done - done - - # Use any state passed by initramfs - [ -d /run/initramfs/state ] && cp -a /run/initramfs/state/* $RW_MOUNT - - # In theory there should be no more than one network interface active - # this early in the boot process -- the one we're booting from. - # Use the network address to set the hostname of the client. This - # must be done even if we have local storage. - ipaddr= - if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; then - ipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk '/[[:space:]]inet / { print gensub("/.*","","g",$2) }') - for ip in $ipaddr ; do - HOSTNAME= - eval $(ipcalc -h $ip 2>/dev/null) - [ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; } - done - fi - - # Clients with read-only root filesystems may be provided with a - # place where they can place minimal amounts of persistent - # state. SSH keys or puppet certificates for example. - # - # Ideally we'll use puppet to manage the state directory and to - # create the bind mounts. However, until that's all ready this - # is sufficient to build a working system. - - # First try to mount persistent data from /etc/fstab, then any - # partition with the proper label, then fallback to NFS - state_mount_dev=$(blkid -t LABEL="$STATE_LABEL" -l -o device) - if mount $mountopts $STATE_OPTIONS "$STATE_MOUNT" > /dev/null 2>&1 ; then - /bin/true - elif [ x$state_mount_dev != x ] && mount $state_mount_dev $mountopts "$STATE_MOUNT" > /dev/null 2>&1; then - /bin/true - elif [ ! -z "$CLIENTSTATE" ]; then - # No local storage was found. Make a final attempt to find - # state on an NFS server. - - mount -t nfs $CLIENTSTATE/$HOSTNAME $STATE_MOUNT -o rw,nolock - fi - - if [ -w "$STATE_MOUNT" ]; then - - mount_state() { - if [ -e "$1" ]; then - [ ! -e "$STATE_MOUNT$1" ] && cp -a --parents "$1" "$STATE_MOUNT" - mount -n --bind "$STATE_MOUNT$1" "$1" - fi - } - - for file in /etc/statetab /etc/statetab.d/* ; do - is_ignored_file "$file" && continue - [ ! -f "$file" ] && continue - - if [ -f "$STATE_MOUNT/$file" ] ; then - mount -n --bind "$STATE_MOUNT/$file" "$file" - fi - - for path in $(grep -v "^#" "$file" 2>/dev/null); do - mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" - done - done - - if [ -f "$STATE_MOUNT/files" ] ; then - for path in $(grep -v "^#" "$STATE_MOUNT/files" 2>/dev/null); do - mount_state "$path" - [ -n "$SELINUX_STATE" ] && [ -e "$path" ] && restorecon -R "$path" - done - fi - fi -fi - -if [[ " $fsckoptions" != *" -y"* ]]; then - fsckoptions="-a $fsckoptions" -fi - -_RUN_QUOTACHECK=0 -if strstr "$cmdline" forcequotacheck || [ -f /forcequotacheck ] ; then - _RUN_QUOTACHECK=1 -fi -if [ -z "$fastboot" -a "$READONLY" != "yes" ]; then - - STRING=$"Checking filesystems" - echo $STRING - fsck -T -t noopts=_netdev -A $fsckoptions - rc=$? - - if [ "$rc" -eq "0" ]; then - success "$STRING" - echo - elif [ "$rc" -eq "1" ]; then - passed "$STRING" - echo - elif [ "$rc" -eq "2" -o "$rc" -eq "3" ]; then - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f - fi - - # A return of 4 or higher means there were serious problems. - if [ $rc -gt 1 ]; then - [ -n "$PLYMOUTH" ] && plymouth --hide-splash - - failure "$STRING" - echo - echo - echo $"*** An error occurred during the file system check." - echo $"*** Dropping you to a shell; the system will reboot" - echo $"*** when you leave the shell." - - str=$"(Repair filesystem)" - PS1="$str \# # "; export PS1 - [ "$SELINUX_STATE" = "1" ] && disable_selinux - sulogin - - echo $"Unmounting file systems" - umount -a - mount -n -o remount,ro / - echo $"Automatic reboot in progress." - reboot -f - elif [ "$rc" -eq "1" ]; then - _RUN_QUOTACHECK=1 - fi -fi - -remount_needed() { - local state oldifs - [ "$READONLY" = "yes" ] && return 1 - state=$(LC_ALL=C awk '/ \/ / && ($3 !~ /rootfs/) { print $4 }' /proc/mounts) - oldifs=$IFS - IFS="," - for opt in $state ; do - if [ "$opt" = "rw" ]; then - IFS=$oldifs - return 1 - fi - done - IFS=$oldifs - return 0 -} - -# Remount the root filesystem read-write. -update_boot_stage RCmountfs -if remount_needed ; then - action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw / -fi - -# Clean up SELinux labels -if [ -n "$SELINUX_STATE" ]; then - restorecon /etc/mtab /etc/ld.so.cache /etc/blkid/blkid.tab /etc/resolv.conf >/dev/null 2>&1 -fi - -# If relabeling, relabel mount points. -if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then - if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then - restorecon $(awk '!/^#/ && $4 !~ /noauto/ && $2 ~ /^\// { print $2 }' /etc/fstab) >/dev/null 2>&1 - fi -fi - -if [ "$READONLY" != "yes" ] ; then - # Clear mtab - (> /etc/mtab) &> /dev/null - - # Remove stale backups - rm -f /etc/mtab~ /etc/mtab~~ - - # Enter mounted filesystems into /etc/mtab - mount -f / - mount -f /proc >/dev/null 2>&1 - mount -f /sys >/dev/null 2>&1 - mount -f /dev/pts >/dev/null 2>&1 - mount -f /dev/shm >/dev/null 2>&1 - mount -f /proc/bus/usb >/dev/null 2>&1 -fi - -# Mount all other filesystems (except for NFS and /proc, which is already -# mounted). Contrary to standard usage, -# filesystems are NOT unmounted in single user mode. -# The 'no' applies to all listed filesystem types. See mount(8). -if [ "$READONLY" != "yes" ] ; then - action $"Mounting local filesystems: " mount -a -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev -else - action $"Mounting local filesystems: " mount -a -n -t nonfs,nfs4,smbfs,ncpfs,cifs,gfs,gfs2 -O no_netdev -fi - -# Update quotas if necessary -if [ X"$_RUN_QUOTACHECK" = X1 ] && [ -x /sbin/quotacheck ]; then - action $"Checking local filesystem quotas: " /sbin/quotacheck -anug -fi - -if [ -x /sbin/quotaon ]; then - action $"Enabling local filesystem quotas: " /sbin/quotaon -aug -fi - -# Check to see if a full relabel is needed -if [ -n "$SELINUX_STATE" -a "$READONLY" != "yes" ]; then - if strstr "$cmdline" autorelabel || [ -f /.autorelabel ] ; then - relabel_selinux - fi -else - if [ "$READONLY" != "yes" ] && [ -d /etc/selinux ]; then - [ -f /.autorelabel ] || touch /.autorelabel - fi -fi - -# Initialize pseudo-random number generator -if [ -f "/var/lib/random-seed" ]; then - cat /var/lib/random-seed > /dev/urandom -else - [ "$READONLY" != "yes" ] && touch /var/lib/random-seed -fi -if [ "$READONLY" != "yes" ]; then - chmod 600 /var/lib/random-seed - dd if=/dev/urandom of=/var/lib/random-seed count=1 bs=512 2>/dev/null -fi - -if [ -f /etc/crypttab ]; then - init_crypto 1 -fi - -# Configure machine if necessary. -if [ -f /.unconfigured ]; then - - if [ -x /bin/plymouth ]; then - /bin/plymouth quit - fi - - if [ -x /usr/bin/system-config-keyboard ]; then - /usr/bin/system-config-keyboard - fi - if [ -x /usr/bin/passwd ]; then - /usr/bin/passwd root - fi - if [ -x /usr/sbin/system-config-network-tui ]; then - /usr/sbin/system-config-network-tui - fi - if [ -x /usr/sbin/timeconfig ]; then - /usr/sbin/timeconfig - fi - if [ -x /usr/sbin/authconfig-tui ]; then - /usr/sbin/authconfig-tui --nostart - fi - if [ -x /usr/sbin/ntsysv ]; then - /usr/sbin/ntsysv --level 35 - fi - - # Reread in network configuration data. - if [ -f /etc/sysconfig/network ]; then - . /etc/sysconfig/network - - # Reset the hostname. - action $"Resetting hostname ${HOSTNAME}: " hostname ${HOSTNAME} - fi - - rm -f /.unconfigured -fi - -# Clean out /. -rm -f /fastboot /fsckoptions /forcefsck /.autofsck /forcequotacheck /halt \ - /poweroff /.suspended &> /dev/null - -# Do we need (w|u)tmpx files? We don't set them up, but the sysadmin might... -_NEED_XFILES= -[ -f /var/run/utmpx ] || [ -f /var/log/wtmpx ] && _NEED_XFILES=1 - -# Clean up /var. -rm -rf /var/lock/cvs/* /var/run/screen/* -find /var/lock /var/run ! -type d -exec rm -f {} \; -rm -f /var/lib/rpm/__db* &> /dev/null -rm -f /var/gdm/.gdmfifo &> /dev/null - -# Clean up utmp/wtmp -> /var/run/utmp -touch /var/log/wtmp /var/log/btmp -chgrp utmp /var/run/utmp /var/log/wtmp /var/log/btmp -chmod 0664 /var/run/utmp /var/log/wtmp -chmod 0600 /var/log/btmp -if [ -n "$_NEED_XFILES" ]; then - > /var/run/utmpx - touch /var/log/wtmpx - chgrp utmp /var/run/utmpx /var/log/wtmpx - chmod 0664 /var/run/utmpx /var/log/wtmpx -fi -[ -n "$SELINUX_STATE" ] && restorecon /var/run/utmp* /var/log/wtmp* /var/log/btmp >/dev/null 2>&1 - -# Clean up various /tmp bits -[ -n "$SELINUX_STATE" ] && restorecon /tmp -rm -f /tmp/.X*-lock /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.* -rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \ - /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \ - /tmp/scrollkeeper-* /tmp/ssh-* \ - /dev/.in_sysinit - -# Make ICE directory -mkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1 -chown root:root /tmp/.ICE-unix -[ -n "$SELINUX_STATE" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1 - -# Start up swapping. -update_boot_stage RCswap -action $"Enabling /etc/fstab swaps: " swapon -a -e -if [ "$AUTOSWAP" = "yes" ]; then - curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done) - swappartitions=$(blkid -t TYPE=swap -o device) - if [ x"$swappartitions" != x ]; then - for partition in $swappartitions ; do - [ ! -e $partition ] && continue - majmin=$(get_numeric_dev dec $partition) - echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition - done - fi -fi - -# Set up binfmt_misc -/bin/mount -t binfmt_misc none /proc/sys/fs/binfmt_misc > /dev/null 2>&1 - -# Boot time profiles. Yes, this should be somewhere else. -if strstr "$cmdline" netprofile= && [ -x /usr/sbin/system-config-network-cmd ]; then - for arg in $cmdline ; do - if [ "${arg##netprofile=}" != "${arg}" ]; then - /usr/sbin/system-config-network-cmd --profile ${arg##netprofile=} - fi - done -fi - -# Now that we have all of our basic modules loaded and the kernel going, -# let's dump the syslog ring somewhere so we can find it later -[ -f /var/log/dmesg ] && mv -f /var/log/dmesg /var/log/dmesg.old -dmesg -s 131072 > /var/log/dmesg - -# create the crash indicator flag to warn on crashes, offer fsck with timeout -touch /.autofsck &> /dev/null - -if strstr "$cmdline" confirm ; then - touch /var/run/confirm -fi - -# Let rhgb know that we're leaving rc.sysinit -if [ -x /bin/plymouth ]; then - /bin/plymouth --sysinit -fi - diff --git a/src/Makefile b/src/Makefile index b478cb9f..68833182 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,8 +1,7 @@ CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE PROGS=usernetctl netreport testd usleep ipcalc \ - fstab-decode getkey ppp-watch consoletype genhostid rename_device \ - console_init console_check securetty + fstab-decode getkey ppp-watch consoletype genhostid rename_device PPPWATCH_OBJS=ppp-watch.o shvar.o CONSOLE_INIT_OBJS=console_init.o shvar.o USLEEP_OBJS=usleep.o @@ -28,11 +27,8 @@ install: install -m 755 getkey $(ROOT)/sbin/getkey install -m 755 ppp-watch $(ROOT)/sbin/ppp-watch install -m 755 consoletype $(ROOT)/sbin/consoletype - install -m 755 securetty $(ROOT)/sbin/securetty install -m 755 sushell $(ROOT)/sbin/sushell install -m 755 rename_device $(ROOT)/lib/udev/rename_device - install -m 755 console_init $(ROOT)/lib/udev/console_init - install -m 755 console_check $(ROOT)/lib/udev/console_check install -m 644 genhostid.1 $(ROOT)$(mandir)/man1 install -m 644 getkey.1 $(ROOT)$(mandir)/man1 install -m 644 netreport.1 $(ROOT)$(mandir)/man1 @@ -44,7 +40,6 @@ install: install -m 644 consoletype.1 $(ROOT)$(mandir)/man1 install -m 644 ifup.8 $(ROOT)$(mandir)/man8 install -m 644 setsysfont.8 $(ROOT)$(mandir)/man8 - install -m 644 securetty.8 $(ROOT)$(mandir)/man8 install -m 644 sushell.8 $(ROOT)$(mandir)/man8 ln -s ifup.8 $(ROOT)$(mandir)/man8/ifdown.8 @@ -72,9 +67,6 @@ usernetctl.o: usernetctl.c usernetctl: usernetctl.c usernetctl.o $(CC) $(LDFLAGS) -pie -o $@ $@.o -securetty: securetty.o - $(CC) $(LDFLAGS) -o $@ $< - shvar.o: shvar.c $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c shvar.c -o shvar.o @@ -84,8 +76,3 @@ ppp-watch.o: ppp-watch.c rename_device: rename_device.c $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< `pkg-config glib-2.0 --libs` -console_init.o: console_init.c - $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c console_init.c -o console_init.o - -console_init: $(CONSOLE_INIT_OBJS) - $(CC) $(LDFLAGS) -o $@ $(CONSOLE_INIT_OBJS) `pkg-config glib-2.0 --libs` diff --git a/src/console_check.c b/src/console_check.c deleted file mode 100644 index 8d01d829..00000000 --- a/src/console_check.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2008-2009 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <termios.h> -#include <unistd.h> - -#include <sys/ioctl.h> - -#include <linux/serial.h> -#include <linux/serial_core.h> - -#ifndef PORT_OMAP -/* from linux-2.6/include/linux/serial_core.h commit b612633b */ -#define PORT_OMAP 96 -#endif - -struct speeds -{ - speed_t speed; - unsigned long value; -}; - -struct speeds speed_map[] = -{ - {B50, 50}, - {B75, 75}, - {B110, 110}, - {B134, 134}, - {B150, 150}, - {B200, 200}, - {B300, 300}, - {B600, 600}, - {B1200, 1200}, - {B1800, 1800}, - {B2400, 2400}, - {B4800, 4800}, - {B9600, 9600}, - {B19200, 19200}, - {B38400, 38400}, -#ifdef B57600 - {B57600, 57600}, -#endif -#ifdef B115200 - {B115200, 115200}, -#endif -#ifdef B230400 - {B230400, 230400}, -#endif -#ifdef B460800 - {B460800, 460800}, -#endif - {0, 0} -}; - -int termcmp(struct termios *a, struct termios *b) { - if (a->c_iflag != b->c_iflag || a->c_oflag != b->c_oflag || - a->c_cflag != b->c_cflag || a->c_lflag != b->c_lflag || - cfgetispeed(a) != cfgetispeed(b) || cfgetospeed(a) != cfgetospeed(b)) - return 1; - return memcmp(a->c_cc, b->c_cc, sizeof(a->c_cc)); -} - -int get_serial_speed(int fd) { - struct termios mode; - - if (!tcgetattr(fd, &mode)) { - int i; - speed_t speed; - - speed = cfgetospeed(&mode); - for (i = 0; speed_map[i].value != 0; i++) - if (speed_map[i].speed == speed) - return speed_map[i].value; - } - return 0; -} - -int compare_termios_to_console(char *dev, int *speed) { - struct termios cmode, mode; - int fd, cfd; - - cfd = open ("/dev/console", O_RDONLY); - tcgetattr(cfd, &cmode); - close(cfd); - - fd = open(dev, O_RDONLY|O_NONBLOCK); - tcgetattr(fd, &mode); - - if (!termcmp(&cmode, &mode)) { - *speed = get_serial_speed(fd); - close(fd); - return 1; - } - close(fd); - return 0; -} - -char *serial_tty_name(int type) { - switch (type) { - case PORT_8250...PORT_MAX_8250: - return "ttyS"; - case PORT_PMAC_ZILOG: - return "ttyPZ"; - case PORT_MPSC: - return "ttyMM"; - case PORT_CPM: - return "ttyCPM"; - case PORT_MPC52xx: - return "ttyPSC"; - case PORT_IMX: - return "ttymxc"; - case PORT_OMAP: - return "ttyO"; - default: - return NULL; - } -} - -char *check_serial_console(int *speed) { - int fd; - char *ret = NULL, *device; - char twelve = 12; - struct serial_struct si, si2; - char *tty_name; - - memset(&si, 0, sizeof(si)); - memset(&si2, 0, sizeof(si)); - - fd = open("/dev/console", O_RDWR); - if (ioctl (fd, TIOCLINUX, &twelve) >= 0) - goto out; - - if (ioctl(fd, TIOCGSERIAL, &si) < 0) - goto out; - close(fd); - - tty_name = serial_tty_name(si.type); - if (!tty_name) - goto out; - - asprintf(&device, "%s%d", tty_name, si.line); - fd = open(device, O_RDWR|O_NONBLOCK); - if (fd == -1) - goto out; - - if (ioctl(fd, TIOCGSERIAL, &si2) < 0) - goto out; - - if (memcmp(&si,&si2, sizeof(si))) - goto out; - - *speed = get_serial_speed(fd); - ret = device; -out: - close(fd); - return ret; -} - -int emit_console_event(char *dev, int speed) { - char *args[] = { "initctl", "emit", "--no-wait", "fedora.serial-console-available", NULL, NULL, NULL }; - - if (dev) - asprintf(&args[4],"DEV=%s",dev); - if (speed) - asprintf(&args[5],"SPEED=%d",speed); - execv("/sbin/initctl", args); - return 1; -} - -int main(int argc, char **argv) { - char *device; - int speed; - - if (argc < 2) { - printf("usage: console_check <device>\n"); - exit(1); - } - chdir("/dev"); - device = argv[1]; - if (!strcmp(device, "console")) { - device = check_serial_console(&speed); - if (device) - return emit_console_event(device, speed); - } else if (compare_termios_to_console(device, &speed)) { - return emit_console_event(device, speed); - } - return 0; -} diff --git a/src/console_init.c b/src/console_init.c deleted file mode 100644 index 446433d0..00000000 --- a/src/console_init.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2008-2009 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/wait.h> - -#include <linux/kd.h> - -#include "shvar.h" - -static char *lang = NULL; -static char *font = NULL; -static char *acm = NULL; -static char *unimap = NULL; -static char *keymap = NULL; - -static int linux_console(int fd) { - unsigned char twelve = 12; - - if (ioctl(fd, TIOCLINUX, &twelve) >= 0) - return 1; - return 0; -} - -static int configured_as_utf8() { - shvarFile *i18nfile = NULL; - - if ((i18nfile = svNewFile("/etc/sysconfig/i18n")) == NULL) - return 1; /* assume UTF-8 */ - - lang = svGetValue(i18nfile, "LANG"); - font = svGetValue(i18nfile, "SYSFONT"); - acm = svGetValue(i18nfile, "SYSFONTACM"); - unimap = svGetValue(i18nfile, "UNIMAP"); - svCloseFile(i18nfile); - if (!lang) - return 1; - if (g_str_has_suffix(lang,".utf8") || g_str_has_suffix(lang,".UTF-8")) - return 1; - return 0; -} - -static int read_keymap() { - shvarFile *keyboard = NULL; - char *tmp; - struct stat sb; - - if (!stat("/etc/sysconfig/console/default.kmap",&sb)) { - keymap = "/etc/sysconfig/console/default.kmap"; - return 0; - } - - if ((keyboard = svNewFile("/etc/sysconfig/keyboard")) == NULL) - return 0; - - tmp = svGetValue(keyboard, "KEYMAP"); - if (tmp) - keymap = tmp; - tmp = svGetValue(keyboard, "KEYTABLE"); - if (tmp) { - if (keymap) free(keymap); - asprintf(&keymap, "%s.map", tmp); - } - return 0; -} - -static void set_font(char *device) { - int pid; - - if ( (pid = fork()) == 0) { - char *args[] = { "setfont", "latarcyrheb-sun16", "-C", NULL, - NULL, NULL, NULL, NULL, NULL }; - - if (font) - args[1] = font; - args[3] = device; - if (acm) { - args[4] = "-m"; - args[5] = acm; - if (unimap) { - args[6] = "-u"; - args[7] = unimap; - } - } else if (unimap) { - args[4] = "-u"; - args[5] = unimap; - } - execv("/bin/setfont", args); - exit(1); - } -} - -static void set_keyboard(int fd, int utf8) { - if (ioctl(fd, KDSKBMODE, utf8 ? K_UNICODE : K_XLATE)) - perror("could not set keyboard mode"); -} - -static void set_terminal(int fd, int utf8) { - if (utf8) - write(fd, "\033%G", 3); - else - write(fd, "\033%@", 3); -} - -static void set_keymap(int fd, int utf8) { - int pid; - - if ((pid = fork()) == 0) { - char *args[] = { "loadkeys", "-q", NULL, NULL, NULL }; - dup2(fd, 0); - dup2(fd, 1); - - if (utf8) { - args[2] = "-u"; - args[3] = keymap; - } else { - args[2] = keymap; - } - execv("/bin/loadkeys", args); - exit(1); - } -} - -int main(int argc, char **argv) { - char *device; - int dev; - - if (argc < 2) { - printf("usage: console_init <device>\n"); - exit(1); - } - chdir("/dev"); - device = argv[1]; - dev = open(device, O_RDWR); - if (linux_console(dev)) { - int utf8 = configured_as_utf8(); - - set_keyboard(dev, utf8); - set_terminal(dev, utf8); - set_font(device); - read_keymap(); - if (keymap) - set_keymap(dev,utf8); - } - return 0; -} diff --git a/src/securetty.8 b/src/securetty.8 deleted file mode 100644 index 2aad6bca..00000000 --- a/src/securetty.8 +++ /dev/null @@ -1,15 +0,0 @@ -.\" Copyright 2009 Petr Lautrbach (plautrba@redhat.com) -.TH securetty 8 2009-10-27 "" "System Administration tools and Daemons" -.SH NAME -securetty \- add a tty to /etc/securetty -.SH SYNOPSIS -.B securetty \fItty\fP -.SH DESCRIPTION -.B securetty -safely adds \fItty\fP to /etc/securetty. -.SH NOTES -.B securetty -is not normally meant to be run by hand; it is invoked by the upstart job that -sets up the system serial console. -.SH "SEE ALSO" -.BR securetty(5) diff --git a/src/securetty.c b/src/securetty.c deleted file mode 100644 index 59abb6e9..00000000 --- a/src/securetty.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2008 Red Hat, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include <errno.h> -#include <fcntl.h> -#include <limits.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <syslog.h> -#include <unistd.h> - -#include <sys/mman.h> -#include <sys/types.h> -#include <sys/stat.h> - -void alarm_handler(int num) { - return; -} - -int open_and_lock_securetty() { - int fd; - struct flock lock; - struct sigaction act, oldact; - - lock.l_type = F_WRLCK; - lock.l_whence = SEEK_SET; - lock.l_start = 0; - lock.l_len = 0; - - fd = open("/etc/securetty", O_RDWR); - if (fd == -1) { - syslog(LOG_ERR, "Couldn't open /etc/securetty: %s",strerror(errno)); - return -1; - } - act.sa_handler = alarm_handler; - act.sa_flags = 0; - sigaction(SIGALRM, &act, &oldact); - alarm(2); - while (fcntl(fd, F_SETLKW, &lock) == -1) { - if (errno == EINTR) { - syslog(LOG_ERR, "Couldn't lock /etc/securetty: Timeout exceeded"); - } else { - syslog(LOG_ERR, "Couldn't lock /etc/securetty: %s",strerror(errno)); - } - return -1; - } - alarm(0); - sigaction(SIGALRM, &oldact, NULL); - return fd; -} - -int rewrite_securetty(char *terminal) { - int fd; - - fd = open_and_lock_securetty(); - if (fd == -1) - return 1; - if (lseek(fd, 0, SEEK_END) == -1) { - close(fd); - syslog(LOG_ERR, "Couldn't seek to end of /etc/securetty: %s",strerror(errno)); - return 1; - } - write(fd, terminal, strlen(terminal)); - write(fd, "\n", 1); - close(fd); - return 0; -} - -int check_securetty(char *terminal) { - int fd, rc = 1; - char *buf, term[PATH_MAX]; - struct stat sb; - - fd = open("/etc/securetty", O_RDONLY); - if (fd == -1) - goto out; - fstat(fd, &sb); - buf = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (buf == ((caddr_t) -1)) { - close(fd); - return 1; - } - snprintf(term,PATH_MAX,"%s\n",terminal); - if (!strncmp(buf,term,strlen(term))) { - rc = 0; - goto out_unmap; - } - snprintf(term,PATH_MAX,"\n%s\n",terminal); - if (strstr(buf,term)) { - rc = 0; - goto out_unmap; - } -out_unmap: - munmap(buf, sb.st_size); -out: - close(fd); - return rc; -} - -int main(int argc, char **argv) { - if (argc < 2 ) { - fprintf(stderr, "Usage: securetty <device>\n"); - exit(1); - } - openlog("securetty", LOG_CONS, LOG_DAEMON); - if (check_securetty(argv[1])) - return rewrite_securetty(argv[1]); - else - return 0; -} diff --git a/udev/rules.d/10-console.rules b/udev/rules.d/10-console.rules deleted file mode 100644 index e7609c57..00000000 --- a/udev/rules.d/10-console.rules +++ /dev/null @@ -1,15 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="console_end" - -# Console initialization - keyboard, font, etc. -KERNEL=="tty0", RUN+="/lib/udev/console_init %k" - -# Check and set up serial and serial-like consoles if necessary -KERNEL=="console", RUN+="/lib/udev/console_check %k" -KERNEL=="ttySG*", RUN+="/lib/udev/console_check %k" -KERNEL=="xvc*", RUN+="/lib/udev/console_check %k" -KERNEL=="hvsi*", RUN+="/lib/udev/console_check %k" -KERNEL=="hvc*", RUN+="/lib/udev/console_check %k" - -LABEL="console_end" |