?mode=patch&uid=2007012021202312170
Open Patch: 2007012021202312170 (by stf)
+ stf
Votecheck 'core-relaxed': Missing 1 qualified vote(s) (clifford, daja77, fake, stefanp, teha)
package/x86/microcode_ctl/microcode.init
Votecheck 'core-strong': Missing 1 qualified vote(s) (clifford, fake, teha)
package/base/kbd/keyboard.init
package/base/kbd/kbd.conf
package/base/sysfiles/etc_initscript.txt
package/base/sysfiles/devfs.init
package/base/sysfiles/rc.c
package/base/sysfiles/console.init
package/base/sysfiles/etc_rc.d_sysinit.txt
package/base/sysfiles/etc_rc.d_rc.txt
package/base/sysfiles/localfs.init
package/base/sysfiles/system.init
package/base/sysfiles/etc_inittab.txt
package/base/sysfiles/etc_fstab.txt
package/base/sysfiles/sysfiles.desc
package/base/sysfiles/sysfiles.conf
package/base/sysfiles/system-state.init
package/base/sysfiles/swap.init
package/base/00-dirtree/00-dirtree.conf
package/base/00-dirtree/data.txt
package/base/udev/udev.init
package/base/udev/udev.conf
package/base/devfsd/devfsd.desc
package/base/devfsd/devfsd.init
package/base/sysvinit/sysvinit.desc
package/base/sysvinit/parse-config
Stefan Fiedler: split system.init and network.init scripts into several smaller ones (revised) keep /etc/initscript as it still contains some code; don't change the execle() call in rc.c; remove static-dev.init stub; remove devfsd/devfsd.conf extra lines; make apply to current trunk. rediffed: udev.desc part removed; missing console keyboard mapping added revert $CONSOLE to /dev/console ($CONSOLE is not exported to the command line, hence running init scripts there might fail)
Introduced bug in setting hostname
see [2007020613345087560] for a fix
Stefan Fiedler: split system.init and network.init scripts into several smaller ones (revised) keep /etc/initscript as it still contains some code; don't change the execle() call in rc.c; remove static-dev.init stub; remove devfsd/devfsd.conf extra lines; make apply to current trunk. rediffed: udev.desc part removed; missing console keyboard mapping added revert $CONSOLE to /dev/console ($CONSOLE is not exported to the command line, hence running init scripts there might fail) --- package/x86/microcode_ctl/microcode.init (Revision 16) +++ package/x86/microcode_ctl/microcode.init (Revision 17) @@ -22,8 +22,8 @@ # # --- ROCK-COPYRIGHT-NOTE-END --- # -# Desc: Upload microcode-updates on Intel (no AMD) CPUs -# Runlevel: 02 rcX rc1 rc2 rc3 rc4 rc5 +# Desc: Upload microcode updates on Intel (no AMD) CPUs +# Runlevel: 04 rcX rc1 rc2 rc3 rc4 rc5 # grep -q GenuineIntel /proc/cpuinfo || exit 0 --- package/base/kbd/keyboard.init (Revision 0) +++ package/base/kbd/keyboard.init (Revision 17) @@ -0,0 +1,48 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: Custom keyboard settings +# Runlevel: 07 rcX rc1 rc2 rc3 rc4 rc5 +# + +[ "$1" = stop ] && exit 0 + +main_begin + + block_begin(start, `Setting keyboard repeat rate and delay time.') + [ -f /etc/conf/kbd ] && . /etc/conf/kbd + check(`D_prefix/bin/kbdrate ${kbd_rate:+-r $kbd_rate} \ + {kbd_delay:+-d $kbd_delay} < /dev/console') + block_split(`Setting keyboard keymappings.') + if [ -L /etc/default.keymap ] ; then + mapfile=$(ls -l /etc/default.keymap | sed 's,.* -> ,,') + check(`loadkeys $mapfile') + elif [ -f /etc/default.keymap ] ; then + check(`loadkeys /etc/default.keymap') + else + echo "No /etc/default.keymap found." + fi + block_end + +main_end --- package/base/kbd/kbd.conf (Revision 16) +++ package/base/kbd/kbd.conf (Revision 17) @@ -24,3 +24,5 @@ datadir="$datadir/$pkg" # keymaps that belong to the base package splitreg 90 . 'usr/share/.*/include/' + +postmake="install_init kbd $confdir/keyboard.init" --- package/base/sysfiles/etc_initscript.txt (Revision 16) +++ package/base/sysfiles/etc_initscript.txt (Revision 17) @@ -24,64 +24,11 @@ # umask 022 ulimit -c 2097151 -PATH=/bin:/sbin:/usr/bin:/usr/sbin -export PATH -# Do the dev filesystem magic -# -if [ -z "$devtype" ]; then - devtype=udev - if [ -f /etc/conf/devtype ]; then - . /etc/conf/devtype - fi -fi -case "$devtype" in - devfs) - if ! [ -e /dev/.devfsd ] ; then - mount -v -n -t devfs devfs /dev - exec > /dev/console 2>&1 < /dev/console - echo "Mounted /dev (devfs) from /etc/initscript." - fi - ;; +# Init sets the following environment variables for all its children: +# PATH=/bin:/usr/bin:/sbin:/usr/sbin +# INIT_VERSION, RUNLEVEL, PREVLEVEL, CONSOLE - udev) - if ! [ -e /dev/.udev ] ; then - if [ -e /dev/.devfsd ]; then - mount --move /dev /etc/udev - mount -t ramfs ramfs /dev - mkdir /dev/devfs - mount --move /etc/udev /dev/devfs - else - mount -t ramfs ramfs /dev - fi - mount -n /sys; mount -n /proc - mkdir -p /dev/pts /dev/shm - echo "" > /proc/sys/kernel/hotplug - /sbin/udevd --daemon - # create nodes for devices already in kernel - /sbin/udevtrigger - /sbin/udevsettle - exec > /dev/console 2>&1 < /dev/console - echo "Mounted /dev (udev) from /etc/initscript." - fi - ;; - static) - if ! [ -e /dev/.devfsd ] ; then - umount -l -n /dev - echo "Umounted /dev (devfs) from /etc/initscript." - fi - ;; - *) - if ! [ -e /dev/console ]; then - mount -t ramfs ramfs /dev - mknod -m 600 /dev/console c 5 1 - fi - exec > /dev/console 2>&1 < /dev/console - echo "Unrecognized devtype=$devtype option caught in /etc/initscript." - ;; -esac -unset devtype - # Execute the program. # -eval exec "$4" > /dev/console 2>&1 < /dev/console +eval exec "$4" > /dev/console 2>&1 < /dev/console --- package/base/sysfiles/devfs.init (Revision 0) +++ package/base/sysfiles/devfs.init (Revision 17) @@ -0,0 +1,48 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/devfsd/devfsd.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: devfs /dev setup +# Runlevel: 02 rcX rc1 rc2 rc3 rc4 rc5 +# + +[[ "$(uname -r)" != 2.4.* ]] && exit 0 + +main_begin + + block_begin(start, `Setting up a devfs based /dev directory.') + if [ ! -e /dev/.devfsd ] ; then + mount -n -t devfs devfs /dev || exit $? + exec > /dev/console 2>&1 < /dev/console + echo "Mounted /dev (devfs) from devfs init script." + fi + block_end + + block_begin(stop, `Unmounting /dev (devfs).') + if [ -e /dev/.devfsd ] ; then + umount -l -n /dev + exec > /dev/console 2>&1 < /dev/console + fi + block_end + +main_end --- package/base/sysfiles/rc.c (Revision 16) +++ package/base/sysfiles/rc.c (Revision 17) @@ -35,14 +35,19 @@ #include <sys/types.h> #include <unistd.h> +char env_PATH[100]="PATH=/bin:/usr/bin:/sbin:/usr/sbin"; +char env_INIT_VERSION[100]="INIT_VERSION="; char env_PREVLEVEL[100]="PREVLEVEL=N"; char env_RUNLEVEL[100]="RUNLEVEL=N"; +char env_CONSOLE[100]="CONSOLE=/dev/console"; char env_TERM[100]="TERM=linux"; char * clean_env[] = { - "PATH=/bin:/usr/bin", + env_PATH, + env_INIT_VERSION, env_PREVLEVEL, env_RUNLEVEL, + env_CONSOLE, env_TERM, NULL }; @@ -79,10 +84,16 @@ int i, cmd_space; /* Copy some environment variables to the new environment if set */ + if ( getenv("PATH") ) + sprintf(env_PATH, "PATH=%.50s", getenv("PATH")); + if ( getenv("INIT_VERSION") ) + sprintf(env_INIT_VERSION, "INIT_VERSION=%.50s", getenv("INIT_VERSION")); if ( getenv("PREVLEVEL") ) sprintf(env_PREVLEVEL, "PREVLEVEL=%.50s", getenv("PREVLEVEL")); if ( getenv("RUNLEVEL") ) sprintf(env_RUNLEVEL, "RUNLEVEL=%.50s", getenv("RUNLEVEL")); + if ( getenv("CONSOLE") ) + sprintf(env_CONSOLE, "CONSOLE=%.50s", getenv("CONSOLE")); if ( getenv("TERM") ) sprintf(env_TERM, "TERM=%.50s", getenv("TERM")); @@ -163,7 +174,7 @@ } } - /* Close all file-descriptors > 2 (1024 seams to be a good value - + /* Close all file-descriptors > 2 (1024 seems to be a good value - * linux/fs.h defines NR_OPEN to 1024*1024, which is too big ;-) */ for (i=3; i<=1024; i++) close(i); --- package/base/sysfiles/console.init (Revision 0) +++ package/base/sysfiles/console.init (Revision 17) @@ -0,0 +1,46 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: Console settings +# Runlevel: 07 rcX rc1 rc2 rc3 rc4 rc5 +# + +[ "$1" = stop ] && exit 0 + +main_begin + + block_begin(start, `Setting console screen font.') + if [ -f /etc/default.vcfont ] ; then + check(`setfont "$(readlink /etc/default.vcfont)"') + else + echo "No /etc/default.vcfont found." + fi +dnl + block_split(`Setting console terminal type and blank interval.') + con_term=linux; con_blank=0 + [ -f /etc/conf/console ] && . /etc/conf/console + check(`D_prefix/bin/setterm -term $con_term -blank $con_blank > /dev/console') + block_end + +main_end --- package/base/sysfiles/etc_rc.d_sysinit.txt (Revision 0) +++ package/base/sysfiles/etc_rc.d_sysinit.txt (Revision 17) @@ -0,0 +1,35 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# One time system initialization, +# executed before boot and bootwait /etc/inittab entries. +# +# Only the root filesystem may be mounted, and it may be read-only. + +# Environment variables passed by init. +echo CONSOLE=$CONSOLE +echo INIT_VERSION=$INIT_VERSION +echo PATH=$PATH +echo RUNLEVEL=$RUNLEVEL +echo PREVLEVEL=$PREVLEVEL --- package/base/sysfiles/etc_rc.d_rc.txt (Revision 16) +++ package/base/sysfiles/etc_rc.d_rc.txt (Revision 17) @@ -6,11 +6,9 @@ # { -export PATH=/bin:/sbin:/usr/bin:/usr/sbin +echo "** Running rc script **" +echo "rc: Previous runlevel: $PREVLEVEL, new runlevel: $RUNLEVEL." -echo "** running rc script **" -echo "RC: Previous runlevel: $PREVLEVEL, new runlevel: $RUNLEVEL." - curdir=/etc/rc.d/rc$RUNLEVEL.d prevdir=/etc/rc.d/rc$PREVLEVEL.d @@ -28,13 +26,13 @@ done fi -echo "RC: Enter runlevel $RUNLEVEL ..." +echo "rc: Enter runlevel $RUNLEVEL ..." +# +# run the START scripts of the current (new) runlevel +# if [ $RUNLEVEL != 0 -a $RUNLEVEL != 6 -a $RUNLEVEL != S ] then - # - # run the START scripts of the current (new) runlevel - # for i in $curdir/S*; do test -x "$i" || continue x="`echo "$i" | sed "s,$curdir/S..,$prevdir/K??,"`" @@ -43,7 +41,7 @@ done fi -echo "RC: The system is now in runlevel $RUNLEVEL." +echo "rc: The system is now in runlevel $RUNLEVEL." # write EOT mark for btee echo -ne '\004' --- package/base/sysfiles/localfs.init (Revision 0) +++ package/base/sysfiles/localfs.init (Revision 17) @@ -0,0 +1,90 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: Mounting local filesystems +# Runlevel: 05 rcX rc1 rc2 rc3 rc4 rc5 +# + +main_begin + block_begin(start, `Checking file systems.') + fsck -A -C -a ; fsckrc=$? + if [ $(( $fsckrc & ~3 )) != 0 ] ; then + echo " **" + echo " ** Filesystem check failed (returncode=$fsckrc)." + echo " ** Please repair the broken disk(s) manually." + echo " **" + sulogin -t 600 /dev/console + umount -adrv ; /sbin/reboot -d -f + while true ; do sleep 1 ; done + elif [ $(( $fsckrc & 2 )) != 0 ] ; then + for x in 10 9 8 7 6 5 4 3 2 ; do + echo -en "\rSystem reboot in $x seconds ... " + sleep 1 + done ; echo -e "\rSystem reboot now! " + umount -adrv ; /sbin/reboot -d -f + while true ; do sleep 1 ; done + fi +dnl + if [ -s /etc/lvmtab ]; then + block_split(`Activating volume groups.') + check(`/sbin/vgchange -ay') + fi +dnl + block_split(`Mounting local file systems.') + check(`mount -n -o remount,rw /') + rootdev="/dev/$(ls -l /dev/root 2> /dev/null | sed 's,.* -> ,,')" + if [ "$rootdev" = "/dev/" ]; then + rootdev="$( sed 's, ,\n,g' < /proc/cmdline | \ + grep ^root= | cut -f2- -d= )" + [ -z "$rootdev" ] && rootdev="/dev/root" + fi + check(`grep -v "^rootfs " /proc/mounts | \ + sed "s,^/dev/root ,$rootdev ," > /etc/mtab') + check(`mount -a -t nocoda,nfs,devfs,proc,sysfs') + block_end + + block_begin(stop, `Remounting sync/ro and unmounting filesystems.') + cut -d' ' -f-3 /etc/mtab /proc/mounts | sort -k2 -u -r | \ + while read dev dir fs ; do + [ "$dir" = "/" ] && continue + [ "$dir" = "/dev" ] && continue + [ "$dir" = "/dev/shm" ] && continue + [ "$dir" = "/proc" ] && continue + [ "$dir" = "/sys" ] && continue + [ "$dir" = "/tmp" ] && continue + echo "Unmounting $dev on $dir ($fs)." + mount -o remount,sync $dir + mount -o remount,ro $dir + umount -d $dir + done +dnl + block_split(`Unmounting remaining file systems.') + grep -E -v '^none (/|[a-z]+:) ' /proc/mounts > /etc/mtab + sync ; sleep 1 ; sync + umount -vdnra -t nodevfs,proc,sysfs,shm + mount -vn -o remount,sync / + mount -vn -o remount,ro / + sleep 1 ; sync ; sleep 1 + block_end +main_end --- package/base/sysfiles/system.init (Revision 16) +++ package/base/sysfiles/system.init (Revision 17) @@ -27,119 +27,29 @@ # main_begin - block_begin(start, `Mounting /proc, /sys, /dev/shm and /dev/pts.') - mount -n /proc 2> /dev/null - mount -n /sys 2> /dev/null - check(`mount -n /dev/shm') - mount -n /dev/pts 2> /dev/null + block_begin(start, `Mounting /proc and /sys.') + check(`mount -n -t proc proc /proc') + check(`mount -n -t sysfs sysfs /sys') dnl - if [ -f /etc/conf/hardware ] ; then - . /etc/conf/hardware - fi - dmesg -n 3 -dnl - block_split(`Configuring the /dev filesystem ...') - check(`sh /etc/conf/devfs') -dnl - block_split(`Activating swap devices.') - check(`swapon -a') -dnl - if [ -s /etc/lvmtab ]; then - block_split(`Activating Volume Groups...') - check(`/sbin/vgchange -ay') - fi -dnl - block_split(`Checking file systems.') - fsck -A -C -a ; fsckrc=$? - if [ $(( $fsckrc & ~3 )) != 0 ] ; then - echo " **" - echo " ** Filesystem check failed (returncode=$fsckrc)." - echo " ** Please repair the broken disk(s) manually." - echo " **" - sulogin -t 600 /dev/console - umount -adrv ; /sbin/reboot -d -f - while true ; do sleep 1 ; done - elif [ $(( $fsckrc & 2 )) != 0 ] ; then - for x in 10 9 8 7 6 5 4 3 2 ; do - echo -en "\rSystem reboot in $x seconds ... " - sleep 1 - done ; echo -e "\rSystem reboot now! " - umount -adrv ; /sbin/reboot -d -f - while true ; do sleep 1 ; done + block_split(`Setting kernel clock to local time.') + [ -f /etc/conf/clock ] && . /etc/conf/clock + + if [ "$clock_tz" = localtime ] ; then + check(`hwclock --hctosys --localtime') fi dnl - block_split(`Mounting local file systems.') - check(`mount -n -o remount,rw /') - rootdev="/dev/$(ls -l /dev/root 2> /dev/null | sed 's,.* -> ,,')" - if [ "$rootdev" = "/dev/" ]; then - rootdev="$( sed 's, ,\n,g' < /proc/cmdline | \ - grep ^root= | cut -f2- -d= )" - [ -z "$rootdev" ] && rootdev="/dev/root" + block_split(`Setting enhanced real time clock precision to $clock_rtc.') + if [ "$clock_rtc" ] ; then + if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then + check(`echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq') + else + echo "No /proc/sys/dev/rtc/max-user-freq found." + fi fi - check(`grep -v "^rootfs " /proc/mounts | \ - sed "s,^/dev/root ,$rootdev ," > /etc/mtab') - check(`mount -a -t nocoda,nfs,devfs,proc,sysfs') dnl - block_split(`Refresh utmp, delete lock and tmp files and other stuff.') - find /var/lock /var/run /tmp -mindepth 1 -print0 2> /dev/null | xargs --null rm -rf - rm -f /etc/nologin /nologin /fastboot ; echo -n >> /var/run/utmp - chmod 664 /var/run/utmp ; chown root:tty /var/run/utmp - mkdir /tmp/.ICE-unix /var/lock/subsys - chmod 1777 /tmp/.ICE-unix -dnl - block_split(`Loading kernel modules and configuring the kernel.') - check(`sh /etc/conf/kernel') -dnl - [ -f /etc/conf/clock ] && . /etc/conf/clock - if [ "$clock_tz" = localtime ] ; then - block_split(`Setting kernel clock to local time.') - check(`hwclock --hctosys --localtime') - fi - if [ "$clock_rtc" ] ; then - block_split(`Setting enhanced real time clock precision to $clock_rtc.') - if [ -w /proc/sys/dev/rtc/max-user-freq ] ; then - check(`echo $clock_rtc > /proc/sys/dev/rtc/max-user-freq') - else - echo "No /proc/sys/dev/rtc/max-user-freq found." - fi - fi -dnl - block_split(`Setting hostname to $(cat /etc/HOSTNAME).') + block_split(`Setting hostname to $(cat /etc/HOSTNAME).')dnl check(`hostname "$(cat /etc/HOSTNAME)"') dnl - block_split(`Writing /var/log/boot.msg.') - check(`dmesg > /var/log/boot.msg') -dnl - block_split(`Setting keyboard keymappings.') - if [ -L /etc/default.keymap ] ; then - mapfile=$(ls -l /etc/default.keymap | sed 's,.* -> ,,') - check(`loadkeys $mapfile') - elif [ -f /etc/default.keymap ] ; then - check(`loadkeys /etc/default.keymap') - else - echo "No /etc/default.keymap found." - fi -dnl - block_split(`Setting keyboard repeat rate and delay time.') - kbd_rate=30; kbd_delay=250 - [ -f /etc/conf/kbd ] && . /etc/conf/kbd - check(`D_prefix/bin/kbdrate -r $kbd_rate -d $kbd_delay < /dev/console') -dnl - block_split(`Setting console screen font.') - if [ -L /etc/default.vcfont ] ; then - fontfile=$(ls -l /etc/default.vcfont | sed 's,.* -> ,,') - check(`setfont $fontfile') - elif [ -f /etc/default.vcfont ] ; then - check(`setfont /etc/default.vcfont') - else - echo "No /etc/default.vcfont found." - fi -dnl - block_split(`Setting console terminal type and blank interval.') - con_term=linux; con_blank=0 - [ -f /etc/conf/console ] && . /etc/conf/console - check(`D_prefix/bin/setterm -term $con_term -blank $con_blank > /dev/console') -dnl block_split(`Setting up loopback networking.') check(`ip link set lo up') check(`ip addr add 127.0.0.1/8 dev lo') @@ -151,59 +61,13 @@ dnl block_split(`Reading /etc/sysctl.conf file.') check(`sysctl -p') -dnl - block_split(`Initializing kernel random number generator.') - if [ -e /var/state/random-seed ] ; then - check(`cat /var/state/random-seed >/dev/urandom') - fi - block_end - block_begin(stop, `Saving /var/log/init.msg and /var/log/boot.msg.') - check(`echo -n >> /var/log/init.msg') - check(`echo -n >> /var/log/boot.msg') - check(`mv /var/log/init.msg /var/log/init.old') - check(`mv /var/log/boot.msg /var/log/boot.old') - block_split(`Writing a wtmp record.') - if [ "$RUNLEVEL" = 0 ] ; then check(`halt -w') - else check(`reboot -w') ; fi - block_split(`Saving kernel random seed.') - dd if=/dev/urandom of=/var/state/random-seed count=1 2> /dev/null + block_begin(stop, `Sending all processes a 2nd TERM signal.') + check(`killall5 -15') ; sleep 5 + block_split(`Sending all processes a KILL signal.') + check(`killall5 -9') ; sleep 5 dnl - block_split(`Sending all processes a SIGTERM (15).') - check(`killall5 -15') ; sleep 5 - block_split(`Sending all processes a 2nd SIGTERM (15).') - check(`killall5 -15') ; sleep 5 - block_split(`Sending all processes a SIGKILL (9).') - check(`killall5 -9') ; sleep 5 -dnl - block_split(`Turning off swap devices.') - check(`swapoff -a') - sync ; sleep 1 -dnl - block_split(`Remounting sync/ro and umount filesystems.') - cut -d' ' -f-3 /etc/mtab /proc/mounts | sort -k2 -u -r | \ - while read dev dir fs ; do - [ "$dir" = "/" ] && continue - [ "$dir" = "/dev" ] && continue - [ "$dir" = "/dev/shm" ] && continue - [ "$dir" = "/proc" ] && continue - [ "$dir" = "/sys" ] && continue - [ "$dir" = "/tmp" ] && continue - echo "Umounting $dev on $dir ($fs)." - mount -o remount,sync $dir - mount -o remount,ro $dir - umount -d $dir - done -dnl - block_split(`Unmounting remaining file systems.') - grep -E -v '^none (/|[a-z]+:) ' /proc/mounts > /etc/mtab - sync ; sleep 1 ; sync - umount -vdnra -t nodevfs,proc,sysfs,shm - mount -vn -o remount,sync / - mount -vn -o remount,ro / - sleep 1 ; sync ; sleep 1 -dnl block_split() command="" [ "$RUNLEVEL" = 0 ] && command=halt @@ -217,6 +77,5 @@ $command -d -f -i -p while true ; do sleep 1 ; done fi - block_end - + block_end main_end --- package/base/sysfiles/etc_inittab.txt (Revision 16) +++ package/base/sysfiles/etc_inittab.txt (Revision 17) @@ -22,16 +22,29 @@ # # See "man 5 inittab" for details. # - -# The default runlevel. -id:2:initdefault: - # /etc/rc.d executes the S and K scripts upon change # of runlevel. # +# Format: +# <id>:<runlevels>:<action>:<process> +# # Runlevels 0 and 6 are halt and reboot. # Runlevels 1-5 are multi-user. # Runlevel S is single user. +# Runlevels A, B, C are on demand runlevels. +# +# Valid actions are: +# sysinit boot bootwait initdefault +# respawn once wait ctrlaltdel +# off powerfail powerwait kbrequest +# ondemand powerfailnow powerokwait + +# System initialization. +si:12345:sysinit:/etc/rc.d/sysinit + +# The default runlevel. +id:2:initdefault: + l0:0:wait:/etc/rc.d/rc l1:1:wait:/etc/rc.d/rc l2:2:wait:/etc/rc.d/rc @@ -49,12 +62,9 @@ # # The "id" field MUST be the same as the last # characters of the device (after "tty"). -# -# Format: -# <id>:<runlevels>:<action>:<process> # -# Maintenace Console on /dev/console +# Maintenance Console on /dev/console # #1:12345:respawn:/sbin/agetty -L -i -I '\012\015\012Maintenance Console:\012' 9600 console linux --- package/base/sysfiles/etc_fstab.txt (Revision 16) +++ package/base/sysfiles/etc_fstab.txt (Revision 17) @@ -1,7 +1,7 @@ /dev/root / auto defaults 0 1 +proc /proc proc defaults 0 0 +sysfs /sys sysfs defaults 0 0 /dev/bus/usb /proc/bus/usb bind bind 0 0 -proc /proc proc defaults 0 0 devpts /dev/pts devpts defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 -sysfs /sys sysfs defaults 0 0 #tmpfs /tmp tmpfs defaults 0 0 --- package/base/sysfiles/sysfiles.desc (Revision 16) +++ package/base/sysfiles/sysfiles.desc (Revision 17) @@ -35,7 +35,7 @@ [L] GPL [S] Stable -[V] 0000 3 +[V] 0000 4 [P] X -1-3---7-9 204.200 [D] 2310052126 services-20041220.txt !https://www.graffiti.com/services --- package/base/sysfiles/sysfiles.conf (Revision 16) +++ package/base/sysfiles/sysfiles.conf (Revision 17) @@ -26,18 +26,19 @@ echo "Creating various etc/* files ..." for x in $( cd $confdir ; echo etc_*.txt ) ; do - y="${x%.txt}" ; z="/" - if [ -f "${y//_/$z}" ] + y="${x%.txt}" ; y="${y//_//}" + if [ -f "${y}" ] then - echo "Found old ${y//_/$z} (don't overwrite)." - touch "${y//_/$z}" + echo "Found old ${y} (don't overwrite)." + touch "${y}" else - cp -v "$confdir/$x" "${y//_/$z}" + cp -v "$confdir/$x" "${y}" fi done - chmod +x etc/initscript etc/rc.d/rc - echo "Add missing entries to etc/services .." + chmod +x etc/initscript etc/rc.d/rc etc/rc.d/sysinit + + echo "Add missing entries to etc/services ..." services=$( echo "$desc_D" | egrep 'services[^ ]*.txt' | \ tr ' ' '\t' | tr -s '\t' | cut -f2 ) { echo -e '\n# Entries from https://www.graffiti.com/services\n#' @@ -125,9 +126,12 @@ cp -v $confdir/sbin_postinstall.sh $root/usr/sbin/postinstall chmod +x $root/usr/sbin/postinstall - echo "Installing 'system' init script ..." - install_init system $confdir/system.init + for x in console devfs localfs system system-state + do + echo "Installing '$x' init script ..." + install_init $x $confdir/$x.init + done echo "Exporting LINGUAS environment variable ..." if [ "$ROCKCFG_LINGUAS" == "all" ] ; then echo "# export LINGUAS=" > $root/etc/profile.d/linguas --- package/base/sysfiles/system-state.init (Revision 0) +++ package/base/sysfiles/system-state.init (Revision 17) @@ -0,0 +1,60 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: System state save and restore +# Runlevel: 07 rcX rc1 rc2 rc3 rc4 rc5 +# + +main_begin + block_begin(start, `Refresh utmp, delete lock and tmp files and other stuff.') + find /var/lock /var/run /tmp -mindepth 1 -print0 2> /dev/null | xargs --null rm -rf + rm -f /etc/nologin /nologin /fastboot ; echo -n >> /var/run/utmp + chmod 664 /var/run/utmp ; chown root:tty /var/run/utmp + mkdir /tmp/.ICE-unix /var/lock/subsys + chmod 1777 /tmp/.ICE-unix +dnl + block_split(`Writing /var/log/boot.msg.') + check(`dmesg > /var/log/boot.msg') +dnl + block_split(`Initializing kernel random number generator.') + if [ -e /var/state/random-seed ] ; then + check(`cat /var/state/random-seed >/dev/urandom') + fi + block_end + + block_begin(stop, `Saving /var/log/init.msg and /var/log/boot.msg.') + check(`echo -n >> /var/log/init.msg') + check(`echo -n >> /var/log/boot.msg') + check(`mv /var/log/init.msg /var/log/init.old') + check(`mv /var/log/boot.msg /var/log/boot.old') + block_split(`Writing a wtmp record.') + if [ "$RUNLEVEL" = 0 ] ; then + check(`halt -w') + else + check(`reboot -w') + fi + block_split(`Saving kernel random seed.') + check(`dd if=/dev/urandom of=/var/state/random-seed count=1 2>/dev/null') + block_end +main_end --- package/base/sysfiles/swap.init (Revision 0) +++ package/base/sysfiles/swap.init (Revision 17) @@ -0,0 +1,38 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: Swap activation/deactivation +# Runlevel: 04 rcX rc1 rc2 rc3 rc4 rc5 +# + +main_begin + block_begin(start, `Activating swap devices.') + check(`swapon -a') + block_end + + block_begin(stop, `Turning off swap devices.') + check(`swapoff -a') + sync ; sleep 1 + block_end +main_end --- package/base/00-dirtree/00-dirtree.conf (Revision 16) +++ package/base/00-dirtree/00-dirtree.conf (Revision 17) @@ -41,9 +41,12 @@ elif [ "$a" = "l64" ] ; then true elif [ "$a" = "mknod" ] ; then - echo "Creating Device Node $b ..." + echo "Create device node $b ..." $a "$xroot/$b" $c $d $e add_flist "$xroot/$b" + elif [ "$a" = "mkfifo" ] ; then + echo "Create pipe $b ..." + $a "$xroot/$b" else echo "Syntax Error: $a $b $c" ; false fi --- package/base/00-dirtree/data.txt (Revision 16) +++ package/base/00-dirtree/data.txt (Revision 17) @@ -142,3 +142,4 @@ mknod dev/tty c 5 0 mknod dev/console c 5 1 +mkfifo /dev/initctl --- package/base/udev/udev.init (Revision 0) +++ package/base/udev/udev.init (Revision 17) @@ -0,0 +1,61 @@ +#!/bin/sh +# +# --- ROCK-COPYRIGHT-NOTE-BEGIN --- +# +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# Please add additional copyright information _after_ the line containing +# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by +# the ./scripts/Create-CopyPatch script. Do not edit this copyright text! +# +# ROCK Linux: rock-src/package/base/sysfiles/system.init +# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. A copy of the GNU General Public +# License can be found at Documentation/COPYING. +# +# Many people helped and are helping developing ROCK Linux. Please +# have a look at https://www.rocklinux.org/ and the Documentation/TEAM +# file for details. +# +# --- ROCK-COPYRIGHT-NOTE-END --- +# +# Desc: udev /dev setup +# Runlevel: 02 rcX rc1 rc2 rc3 rc4 rc5 +# + +[[ "$(uname -r)" != 2.6.* ]] && exit 0 + +main_begin + + block_begin(start, `Setting up a udev based /dev directory.') + if [ ! -e /dev/.udev ] ; then + mount -n -t ramfs ramfs /dev || exit $? + + cp -r /lib/udev/devices/* /dev + + echo "" > /proc/sys/kernel/hotplug + check(`/sbin/udevd --daemon') + + # create nodes for devices already in kernel + /sbin/udevtrigger + /sbin/udevsettle + + exec > /dev/console 2>&1 < /dev/console + echo "Mounted /dev (udev) from udev init script." + fi + block_end + + block_begin(stop, `Stopping udevd.') + check(`killall -15 /sbin/udevd') +dnl + block_split(`Unmounting /dev (udev).') + if [ -e /dev/.udev ] ; then + umount -l -n /dev + exec > /dev/console 2>&1 < /dev/console + fi + block_end + +main_end --- package/base/udev/udev.conf (Revision 16) +++ package/base/udev/udev.conf (Revision 17) @@ -44,6 +44,8 @@ chmod +x $root/lib/udev/*.sh $root/lib/udev/modalias_* mkdir -p $root/lib/firmware + + install_init udev $confdir/udev.init } udev_prem() { --- package/base/devfsd/devfsd.desc (Revision 16) +++ package/base/devfsd/devfsd.desc (Revision 17) @@ -36,7 +36,7 @@ [L] GPL [S] Stable -[V] 1.3.25 +[V] 1.3.25 1 [P] X -?-3-----9 188.100 [D] 1757741591 devfsd-v1.3.25.tar.gz ftp://ftp.atnf.csiro.au/pub/people/rgooch/linux/daemons/devfsd/ --- package/base/devfsd/devfsd.init (Revision 16) +++ package/base/devfsd/devfsd.init (Revision 17) @@ -26,21 +26,16 @@ # Runlevel: 13 rcX rc2 rc3 rc4 rc5 # -# if /dev isn't devfs, exit shyly -[ ! -e /dev/.devfsd ] && exit 0 +[[ "$(uname -r)" != 2.4.* ]] && exit 0 main_begin block_begin(start, `Starting devfsd.') - check(`/sbin/devfsd /dev') + check(`/sbin/devfsd /dev') block_end block_begin(stop, `Stopping devfsd.') check(`killall -15 /sbin/devfsd') block_end - block_begin(restart, `Restarting devfsd.') - check(`killall -1 /sbin/devfsd') - block_end - main_end --- package/base/sysvinit/sysvinit.desc (Revision 16) +++ package/base/sysvinit/sysvinit.desc (Revision 17) @@ -38,7 +38,7 @@ [L] GPL [S] Stable -[V] 2.86 +[V] 2.86 1 [P] X -X---5---9 179.000 [D] 1423179173 sysvinit-2.86.tar.gz ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/ --- package/base/sysvinit/parse-config (Revision 16) +++ package/base/sysvinit/parse-config (Revision 17) @@ -46,7 +46,7 @@ ln -sf ../init.d/$name $initdir/$runlevel.d/S$spri$name ln -sf ../init.d/$name $initdir/$runlevel.d/K$kpri$name else - echo "The script '$name' has the priority $pri." \ + echo "The script '$name' has the priority $spri." \ > $initdir/rcX.d/X$spri$name fi done [Download this patch]