diff options
author | Lukc <lukc@upyum.com> | 2010-12-11 19:15:23 +0100 |
---|---|---|
committer | Lukc <lukc@upyum.com> | 2010-12-11 19:15:35 +0100 |
commit | 6d908a38e05b9d4135c65d23114a5874215b5bb8 (patch) | |
tree | b5e6da6d95b9a1235d82032b509b80483a886ff5 /rc | |
download | base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.gz base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.bz2 base-6d908a38e05b9d4135c65d23114a5874215b5bb8.tar.xz base-6d908a38e05b9d4135c65d23114a5874215b5bb8.zip |
Engagement initial.
Diffstat (limited to 'rc')
-rw-r--r-- | rc/.footprint | 17 | ||||
-rw-r--r-- | rc/.md5sum | 9 | ||||
-rw-r--r-- | rc/Pkgfile | 26 | ||||
-rw-r--r-- | rc/Pkgfile.old | 24 | ||||
-rw-r--r-- | rc/inittab | 30 | ||||
-rwxr-xr-x | rc/rc | 114 | ||||
-rw-r--r-- | rc/rc.conf | 12 | ||||
-rwxr-xr-x | rc/rc.fix | 24 | ||||
-rwxr-xr-x | rc/rc.local | 6 | ||||
-rwxr-xr-x | rc/rc.modules | 8 | ||||
-rwxr-xr-x | rc/rc.multi | 35 | ||||
-rwxr-xr-x | rc/rc.shutdown | 62 | ||||
-rwxr-xr-x | rc/rc.single | 44 |
13 files changed, 411 insertions, 0 deletions
diff --git a/rc/.footprint b/rc/.footprint new file mode 100644 index 0000000..0c617d1 --- /dev/null +++ b/rc/.footprint @@ -0,0 +1,17 @@ +drwxr-xr-x root/root etc/ +-rw-r--r-- root/root etc/inittab +-rwxr-xr-x root/root etc/rc +-rw-r--r-- root/root etc/rc.conf +drwxr-xr-x root/root etc/rc.d/ +-rwxr-xr-x root/root etc/rc.fix +-rwxr-xr-x root/root etc/rc.local +-rwxr-xr-x root/root etc/rc.modules +-rwxr-xr-x root/root etc/rc.multi +-rwxr-xr-x root/root etc/rc.shutdown +-rwxr-xr-x root/root etc/rc.single +drwxr-xr-x root/root var/ +drwxr-xr-x root/root var/lib/ +drwxr-xr-x root/root var/lib/urandom/ +-rw-r----- root/root var/lib/urandom/seed (EMPTY) +drwxr-xr-x root/root var/log/ +-rw-r----- root/root var/log/boot (EMPTY) diff --git a/rc/.md5sum b/rc/.md5sum new file mode 100644 index 0000000..ddfaef5 --- /dev/null +++ b/rc/.md5sum @@ -0,0 +1,9 @@ +d2a8e98a8b10ba09b2a9da34326b526a inittab +ef539e1a7680641ef76b38001eb86682 rc +c8fe38143dffbbc628a7a33966fae408 rc.conf +afe5cd67920474246ae74e54a9845339 rc.fix +d1be35927946756c68242f29c16ee983 rc.local +394d5cff98ab59fd1a0ec64fe79292cb rc.modules +a2d24525ca3ff1daf5753edcdf89466b rc.multi +d3a1e6e3edad489020fd56305bed8d6f rc.shutdown +d8d9bd102b0177a7bb30db9fd088a6e8 rc.single diff --git a/rc/Pkgfile b/rc/Pkgfile new file mode 100644 index 0000000..fdbb2d6 --- /dev/null +++ b/rc/Pkgfile @@ -0,0 +1,26 @@ +description="BSD-like init-scripts" +packager="" +maintainer="CRUX System Team, core-ports at crux dot nu" +url="http://crux.nu" +depends=() + +name=rc +version=2.26 +release=1 +source=(inittab rc rc.modules rc.single rc.multi rc.local rc.fix rc.shutdown rc.conf) +build () +{ + mkdir -p $PKG/etc/rc.d; + install -m 644 inittab $PKG/etc; + install -m 755 rc $PKG/etc; + install -m 755 rc.modules $PKG/etc; + install -m 755 rc.single $PKG/etc; + install -m 755 rc.multi $PKG/etc; + install -m 755 rc.local $PKG/etc; + install -m 755 rc.fix $PKG/etc; + install -m 755 rc.shutdown $PKG/etc; + install -m 644 rc.conf $PKG/etc; + mkdir -p $PKG/var/log $PKG/var/lib/urandom; + touch $PKG/var/log/boot $PKG/var/lib/urandom/seed; + chmod 640 $PKG/var/log/boot $PKG/var/lib/urandom/seed +} diff --git a/rc/Pkgfile.old b/rc/Pkgfile.old new file mode 100644 index 0000000..a529de5 --- /dev/null +++ b/rc/Pkgfile.old @@ -0,0 +1,24 @@ +# Description: BSD-like init-scripts +# URL: http://crux.nu +# Maintainer: CRUX System Team, core-ports at crux dot nu + +name=rc +version=2.26 +release=1 +source=(inittab rc rc.modules rc.single rc.multi rc.local rc.fix rc.shutdown rc.conf) + +build() { + mkdir -p $PKG/etc/rc.d + install -m 644 inittab $PKG/etc + install -m 755 rc $PKG/etc + install -m 755 rc.modules $PKG/etc + install -m 755 rc.single $PKG/etc + install -m 755 rc.multi $PKG/etc + install -m 755 rc.local $PKG/etc + install -m 755 rc.fix $PKG/etc + install -m 755 rc.shutdown $PKG/etc + install -m 644 rc.conf $PKG/etc + mkdir -p $PKG/var/log $PKG/var/lib/urandom + touch $PKG/var/log/boot $PKG/var/lib/urandom/seed + chmod 640 $PKG/var/log/boot $PKG/var/lib/urandom/seed +} diff --git a/rc/inittab b/rc/inittab new file mode 100644 index 0000000..ba613fd --- /dev/null +++ b/rc/inittab @@ -0,0 +1,30 @@ +# +# /etc/inittab: system runlevel description +# + +# Runlevels: +# 0 Halt +# 1(S) Single-user +# 2 Multi-user +# 3-5 Not used +# 6 Reboot + +id:2:initdefault: + +rc::sysinit:/etc/rc +rs:S1:wait:/etc/rc.single +rm:2:wait:/etc/rc.multi +rd:06:wait:/etc/rc.shutdown +su:S:wait:/sbin/sulogin -p + +c1:2:respawn:/sbin/agetty 38400 tty1 linux +c2:2:respawn:/sbin/agetty 38400 tty2 linux +c3:2:respawn:/sbin/agetty 38400 tty3 linux +c4:2:respawn:/sbin/agetty 38400 tty4 linux +c5:2:respawn:/sbin/agetty 38400 tty5 linux +c6:2:respawn:/sbin/agetty 38400 tty6 linux +#s1:2:respawn:/sbin/agetty 38400 ttyS0 vt100 + +ca::ctrlaltdel:/sbin/shutdown -t3 -r now + +# End of file @@ -0,0 +1,114 @@ +#!/bin/bash +# +# /etc/rc: system boot script +# + +echo "The system is coming up. Please wait." + +# Load configuration +. /etc/rc.conf + +# Start udev +/bin/mount -n -t proc none /proc +/bin/mount -n -t sysfs none /sys +/sbin/start_udev + +# Create device-mapper device nodes and scan for LVM volume groups +if [ -x /sbin/lvm ]; then + /sbin/vgscan --mknodes --ignorelockingfailure + /sbin/vgchange --ignorelockingfailure -a y +fi + +# Mount root read-only +/bin/mount -n -o remount,ro / + +if [ -f /forcefsck ]; then +FORCEFSCK="-f" +fi + +# Check filesystems +/sbin/fsck $FORCEFSCK -A -T -C -a +if [ $? -gt 1 ]; then + echo + echo "*************** FILESYSTEM CHECK FAILED ******************" + echo "* *" + echo "* Please repair manually and reboot. Note that the root *" + echo "* file system is currently mounted read-only. To remount *" + echo "* it read-write type: mount -n -o remount,rw / *" + echo "* When you exit the maintainance shell the system will *" + echo "* reboot automatically. *" + echo "* *" + echo "************************************************************" + echo + /sbin/sulogin -p + echo "Automatic reboot in progress..." + /bin/umount -a -r + /bin/mount -n -o remount,ro / + /sbin/reboot -f + exit 0 +fi + +# Mount local filesystems +/bin/mount -n -o remount,rw / +/bin/umount /sys /proc +/bin/rm -f /etc/mtab* +/bin/touch /etc/mtab +/bin/mount -o remount,rw / +/bin/mount -a -O no_netdev + +# Activate swap +/sbin/swapon -a + +# Clean up misc files +: > /var/run/utmp +/bin/rm -rf /forcefsck /fastboot /etc/nologin /etc/shutdownpid +(cd /var/run && /usr/bin/find . -name "*.pid" -delete) +(cd /var/lock && /usr/bin/find . ! -type d -delete) +(cd /tmp && /usr/bin/find . ! -name . -delete) +/bin/mkdir -m 1777 /tmp/.ICE-unix + +# Set kernel variables +/sbin/sysctl -p > /dev/null + +# Update shared library links +/sbin/ldconfig + +# Configure host name +if [ "$HOSTNAME" ]; then + echo "hostname: $HOSTNAME" + /bin/hostname $HOSTNAME +fi + +# Load random seed +/bin/cat /var/lib/urandom/seed > /dev/urandom + +# Configure system clock +if [ "$TIMEZONE" ]; then + /bin/ln -snf /usr/share/zoneinfo/$TIMEZONE /etc/localtime +fi +/sbin/hwclock --hctosys + +# Load console font +if [ "$FONT" ]; then + echo "font: $FONT" + /usr/bin/setfont $FONT +fi + +# Load console keymap +if [ "$KEYMAP" ]; then + echo "keyboard: $KEYMAP" + /usr/bin/loadkeys -q $KEYMAP +fi + +# Screen blanks after 15 minutes idle time +/usr/bin/setterm -blank 15 + +# Run module initialization script +if [ -x /etc/rc.modules ]; then + /etc/rc.modules +fi + +# Save boot messages +/bin/dmesg > /var/log/boot + +# End of file diff --git a/rc/rc.conf b/rc/rc.conf new file mode 100644 index 0000000..6c28c05 --- /dev/null +++ b/rc/rc.conf @@ -0,0 +1,12 @@ +# +# /etc/rc.conf: system configuration +# + +FONT=default +KEYMAP=us +TIMEZONE=UTC +HOSTNAME=host +SYSLOG=sysklogd +SERVICES=(net crond) + +# End of file diff --git a/rc/rc.fix b/rc/rc.fix new file mode 100755 index 0000000..02ce94c --- /dev/null +++ b/rc/rc.fix @@ -0,0 +1,24 @@ +#!/bin/bash +# +# /etc/rc.fix: adjustements startup file (multi-user) +# + + +####################################################################### +# X11 font-related checks +####################################################################### +if [ -d /usr/share/fonts/X11 ]; then + for i in `/bin/ls -d /usr/share/fonts/X11/*`; do + if [ ! -f $i/fonts.dir ]; then + mkfontdir $i &> /dev/null + mkfontscale $i &> /dev/null + fi + done +fi + +if [ -d /var/cache/fontconfig ] && [ -z "`/bin/ls /var/cache/fontconfig/`" ]; then + fc-cache &> /dev/null +fi + + +# End of file diff --git a/rc/rc.local b/rc/rc.local new file mode 100755 index 0000000..5e44d98 --- /dev/null +++ b/rc/rc.local @@ -0,0 +1,6 @@ +#!/bin/bash +# +# /etc/rc.local: local multi-user startup script +# + +# End of file diff --git a/rc/rc.modules b/rc/rc.modules new file mode 100755 index 0000000..fa08c59 --- /dev/null +++ b/rc/rc.modules @@ -0,0 +1,8 @@ +#!/bin/bash +# +# /etc/rc.modules: module initialization script +# + +/sbin/depmod -a + +# End of file diff --git a/rc/rc.multi b/rc/rc.multi new file mode 100755 index 0000000..465332f --- /dev/null +++ b/rc/rc.multi @@ -0,0 +1,35 @@ +#!/bin/bash +# +# /etc/rc.multi: multi-user startup script +# + +# Load configuration +. /etc/rc.conf + +# Run fixes startup file +if [ -x /etc/rc.fix ]; then + /etc/rc.fix +fi + +# Start services +if [ "$SYSLOG" -o "${SERVICES[*]}" ]; then + echo -n "starting services:" + if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then + echo -n " $SYSLOG" + /etc/rc.d/$SYSLOG start &> /dev/null || echo -n "[ERROR]" + fi + for service in ${SERVICES[@]}; do + echo -n " $service" + /etc/rc.d/$service start &> /tmp/rc.$$ || echo -n "[ERROR]" + /usr/bin/logger -t $service -f /tmp/rc.$$ + /bin/rm -f /tmp/rc.$$ + done + echo +fi + +# Run local startup script +if [ -x /etc/rc.local ]; then + /etc/rc.local +fi + +# End of file diff --git a/rc/rc.shutdown b/rc/rc.shutdown new file mode 100755 index 0000000..790117e --- /dev/null +++ b/rc/rc.shutdown @@ -0,0 +1,62 @@ +#!/bin/bash +# +# /etc/rc.shutdown: system shutdown script +# + +# Load configuration +. /etc/rc.conf + +# Set linefeed mode to avoid staircase effect +/bin/stty onlcr + +echo "The system is coming down. Please wait." + +if [ "$PREVLEVEL" = "2" ]; then + # Shutdown services + if [ "${SERVICES[*]}" ]; then + for service in "${SERVICES[@]}"; do + R_SERVICES=($service ${R_SERVICES[@]}) + done + for service in "${R_SERVICES[@]}"; do + /etc/rc.d/$service stop &> /tmp/rc.$$ + /usr/bin/logger -t $service -f /tmp/rc.$$ + /bin/rm -f /tmp/rc.$$ + done + fi +fi + +# Terminate all processes +/sbin/killall5 -15 +/bin/sleep 5 +/sbin/killall5 -9 + +# Save random seed +/bin/dd if=/dev/urandom of=/var/lib/urandom/seed count=1 2> /dev/null + +# Save system clock +/sbin/hwclock --systohc + +# Write to wtmp file before unmounting +/sbin/halt -w + +# Turn off swap +/sbin/swapoff -a + +# Unmount file systems +/bin/umount -a -r -t nosysfs,noproc +if [ -x /sbin/lvm ]; then + /sbin/vgchange --ignorelockingfailure -a n +fi +/bin/umount -a -r + +# Remount root filesystem read-only +/bin/mount -n -o remount,ro / + +# Power off or reboot +if [ "$RUNLEVEL" = "0" ]; then + /sbin/poweroff -d -f -i +else + /sbin/reboot -d -f -i +fi + +# End of file diff --git a/rc/rc.single b/rc/rc.single new file mode 100755 index 0000000..4291eb0 --- /dev/null +++ b/rc/rc.single @@ -0,0 +1,44 @@ +#!/bin/bash +# +# /etc/rc.single: single-user startup script +# + +# Load configuration +. /etc/rc.conf + +if [ "$PREVLEVEL" = "2" ]; then + # Shutdown services + if [ "${SERVICES[*]}" ]; then + for service in "${SERVICES[@]}"; do + R_SERVICES=($service ${R_SERVICES[@]}) + done + for service in "${R_SERVICES[@]}"; do + /etc/rc.d/$service stop &> /tmp/rc.$$ + /usr/bin/logger -t $service -f /tmp/rc.$$ + /bin/rm -f /tmp/rc.$$ + done + fi +fi + +if [ "$PREVLEVEL" != "N" ]; then + # Terminate all processes + /sbin/killall5 -15 + /bin/sleep 5 + /sbin/killall5 -9 + + # Start udev + /bin/mount -n -t proc none /proc + /bin/mount -n -t sysfs none /sys + /sbin/start_udev + + if [ -f /etc/rc.d/$SYSLOG -a -x /etc/rc.d/$SYSLOG ]; then + /etc/rc.d/$SYSLOG start &> /dev/null + fi +fi + +if [ "$RUNLEVEL" = "1" ]; then + # Enter single-user mode + exec /sbin/init -t1 S +fi + +# End of file |