diff --git a/package/base/00-dirtree/00-dirtree.conf b/package/base/00-dirtree/00-dirtree.conf index 1af79a56c..18473bb81 100644 --- a/package/base/00-dirtree/00-dirtree.conf +++ b/package/base/00-dirtree/00-dirtree.conf @@ -41,9 +41,12 @@ main_dt() { 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 diff --git a/package/base/00-dirtree/data.txt b/package/base/00-dirtree/data.txt index 8a37c6957..8919b27dc 100644 --- a/package/base/00-dirtree/data.txt +++ b/package/base/00-dirtree/data.txt @@ -142,3 +142,4 @@ mknod dev/zero c 1 5 mknod dev/tty c 5 0 mknod dev/console c 5 1 +mkfifo /dev/initctl diff --git a/package/base/devfsd/devfsd.desc b/package/base/devfsd/devfsd.desc index 9041a5d1c..b33a2e4d7 100644 --- a/package/base/devfsd/devfsd.desc +++ b/package/base/devfsd/devfsd.desc @@ -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/ diff --git a/package/base/devfsd/devfsd.init b/package/base/devfsd/devfsd.init index 83bfe51c8..dd337f0e6 100644 --- a/package/base/devfsd/devfsd.init +++ b/package/base/devfsd/devfsd.init @@ -26,8 +26,7 @@ # 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 @@ -39,8 +38,4 @@ main_begin check(`killall -15 /sbin/devfsd') block_end - block_begin(restart, `Restarting devfsd.') - check(`killall -1 /sbin/devfsd') - block_end - main_end diff --git a/package/base/kbd/kbd.conf b/package/base/kbd/kbd.conf index 1108ec5af..d3bc390b5 100644 --- a/package/base/kbd/kbd.conf +++ b/package/base/kbd/kbd.conf @@ -24,3 +24,5 @@ premake="rm -f data/keymaps/i386/qwerty/{bg-cp1251.map,*.orig}" datadir="$datadir/$pkg" # keymaps that belong to the base package splitreg 90 . 'usr/share/.*/include/' + +postmake="install_init kbd $confdir/keyboard.init" diff --git a/package/base/kbd/keyboard.init b/package/base/kbd/keyboard.init new file mode 100644 index 000000000..f93540040 --- /dev/null +++ b/package/base/kbd/keyboard.init @@ -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 http://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 diff --git a/package/base/sysfiles/console.init b/package/base/sysfiles/console.init new file mode 100644 index 000000000..05f41bd4e --- /dev/null +++ b/package/base/sysfiles/console.init @@ -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 http://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 diff --git a/package/base/sysfiles/devfs.init b/package/base/sysfiles/devfs.init new file mode 100644 index 000000000..bea9f38f1 --- /dev/null +++ b/package/base/sysfiles/devfs.init @@ -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 http://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 diff --git a/package/base/sysfiles/etc_initscript.txt b/package/base/sysfiles/etc_initscript.txt index fbc0ff211..00aac233d 100644 --- a/package/base/sysfiles/etc_initscript.txt +++ b/package/base/sysfiles/etc_initscript.txt @@ -24,63 +24,10 @@ # 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 - ;; - - 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 +# Init sets the following environment variables for all its children: +# PATH=/bin:/usr/bin:/sbin:/usr/sbin +# INIT_VERSION, RUNLEVEL, PREVLEVEL, CONSOLE # Execute the program. # diff --git a/package/base/sysfiles/etc_inittab.txt b/package/base/sysfiles/etc_inittab.txt index e1fa1088d..28ee879aa 100644 --- a/package/base/sysfiles/etc_inittab.txt +++ b/package/base/sysfiles/etc_inittab.txt @@ -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: +# ::: +# # 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 @@ ca:12345:ctrlaltdel:/sbin/shutdown -r now # # The "id" field MUST be the same as the last # characters of the device (after "tty"). -# -# Format: -# ::: # -# 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 diff --git a/package/base/sysfiles/etc_rc.d_rc.txt b/package/base/sysfiles/etc_rc.d_rc.txt index db26d6c90..5ac04fdf9 100644 --- a/package/base/sysfiles/etc_rc.d_rc.txt +++ b/package/base/sysfiles/etc_rc.d_rc.txt @@ -6,10 +6,8 @@ # { -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 @@ then 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 @@ then 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' diff --git a/package/base/sysfiles/etc_rc.d_sysinit.txt b/package/base/sysfiles/etc_rc.d_sysinit.txt new file mode 100644 index 000000000..be84fb34a --- /dev/null +++ b/package/base/sysfiles/etc_rc.d_sysinit.txt @@ -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 http://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 diff --git a/package/base/sysfiles/localfs.init b/package/base/sysfiles/localfs.init new file mode 100644 index 000000000..e67d2ef7a --- /dev/null +++ b/package/base/sysfiles/localfs.init @@ -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 http://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 diff --git a/package/base/sysfiles/rc.c b/package/base/sysfiles/rc.c index 996b3321a..1efc7a02c 100644 --- a/package/base/sysfiles/rc.c +++ b/package/base/sysfiles/rc.c @@ -35,14 +35,19 @@ #include #include +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 main(int argc, char ** argv) { 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 @@ int main(int argc, char ** argv) { } } - /* 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); diff --git a/package/base/sysfiles/swap.init b/package/base/sysfiles/swap.init new file mode 100644 index 000000000..557998593 --- /dev/null +++ b/package/base/sysfiles/swap.init @@ -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 http://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 diff --git a/package/base/sysfiles/sysfiles.conf b/package/base/sysfiles/sysfiles.conf index cd814d8a2..375b826bc 100644 --- a/package/base/sysfiles/sysfiles.conf +++ b/package/base/sysfiles/sysfiles.conf @@ -26,18 +26,19 @@ main_sf() { 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 http://www.graffiti.com/services\n#' @@ -103,8 +104,11 @@ EOT 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 diff --git a/package/base/sysfiles/sysfiles.desc b/package/base/sysfiles/sysfiles.desc index 2188a31ce..eb0a567b6 100644 --- a/package/base/sysfiles/sysfiles.desc +++ b/package/base/sysfiles/sysfiles.desc @@ -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 !http://www.graffiti.com/services diff --git a/package/base/sysfiles/system-state.init b/package/base/sysfiles/system-state.init new file mode 100644 index 000000000..2c73b1833 --- /dev/null +++ b/package/base/sysfiles/system-state.init @@ -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 http://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 diff --git a/package/base/sysfiles/system.init b/package/base/sysfiles/system.init index 67245aad4..a714c1afb 100644 --- a/package/base/sysfiles/system.init +++ b/package/base/sysfiles/system.init @@ -27,118 +27,28 @@ # 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 - 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 kernel clock to local time.') + [ -f /etc/conf/clock ] && . /etc/conf/clock + + if [ "$clock_tz" = localtime ] ; then + check(`hwclock --hctosys --localtime') 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." + 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 - fi dnl block_split(`Setting hostname to $(cat /etc/HOSTNAME).') 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') @@ -151,58 +61,12 @@ dnl 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 -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 + 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() command="" @@ -213,6 +77,5 @@ dnl $command -d -f -i -p while true ; do sleep 1 ; done fi - block_end - + block_end main_end diff --git a/package/base/sysvinit/parse-config b/package/base/sysvinit/parse-config index 4c66d6051..9875df2b6 100644 --- a/package/base/sysvinit/parse-config +++ b/package/base/sysvinit/parse-config @@ -46,7 +46,7 @@ then 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 diff --git a/package/base/sysvinit/sysvinit.desc b/package/base/sysvinit/sysvinit.desc index 92e5c9840..f330504d2 100644 --- a/package/base/sysvinit/sysvinit.desc +++ b/package/base/sysvinit/sysvinit.desc @@ -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/ diff --git a/package/base/udev/udev.conf b/package/base/udev/udev.conf index 96ef07b55..b199a6101 100644 --- a/package/base/udev/udev.conf +++ b/package/base/udev/udev.conf @@ -51,6 +51,8 @@ udev_pm() { cp -v etc/udev/rules.d/* $confdir/rules/* $root/etc/udev/rules.d/ cp -v $confdir/scripts/*.sh $confdir/scripts/modalias_* $root/lib/udev/ chmod +x $root/lib/udev/*.sh $root/lib/udev/modalias_* + + install_init udev $confdir/udev.init } udev_prem() { diff --git a/package/base/udev/udev.init b/package/base/udev/udev.init new file mode 100644 index 000000000..0a7788aa2 --- /dev/null +++ b/package/base/udev/udev.init @@ -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 http://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 diff --git a/package/x86/microcode_ctl/microcode.init b/package/x86/microcode_ctl/microcode.init index 7cbed2d87..098c25dfa 100644 --- a/package/x86/microcode_ctl/microcode.init +++ b/package/x86/microcode_ctl/microcode.init @@ -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