CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Add rc port, with modified rc and inittab
authorJohn Vogel <jvogel4@stny.rr.com>
Sun, 15 May 2016 04:06:27 +0000 (00:06 -0400)
committerJohn Vogel <jvogel4@stny.rr.com>
Sun, 15 May 2016 04:06:27 +0000 (00:06 -0400)
rc: remove the hwclock calls; the p2 has no rtc.
inittab: add serial console for debug connections via the gpio
head tx/rx pins.

12 files changed:
rc/.footprint [new file with mode: 0644]
rc/.md5sum [new file with mode: 0644]
rc/Pkgfile [new file with mode: 0644]
rc/inittab [new file with mode: 0644]
rc/rc [new file with mode: 0755]
rc/rc.conf [new file with mode: 0644]
rc/rc.fix [new file with mode: 0755]
rc/rc.local [new file with mode: 0755]
rc/rc.modules [new file with mode: 0755]
rc/rc.multi [new file with mode: 0755]
rc/rc.shutdown [new file with mode: 0755]
rc/rc.single [new file with mode: 0755]

diff --git a/rc/.footprint b/rc/.footprint
new file mode 100644 (file)
index 0000000..0c617d1
--- /dev/null
@@ -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 (file)
index 0000000..3627cdd
--- /dev/null
@@ -0,0 +1,9 @@
+49523b36db24792e3e70be2190f2e64a  inittab
+73d785cc2b05907e5599c1ee3954570b  rc
+670f547fca904321c968c61a73714a63  rc.conf
+afe5cd67920474246ae74e54a9845339  rc.fix
+d1be35927946756c68242f29c16ee983  rc.local
+394d5cff98ab59fd1a0ec64fe79292cb  rc.modules
+a2d24525ca3ff1daf5753edcdf89466b  rc.multi
+a46c238c63564a289318b771f81e602d  rc.shutdown
+d8d9bd102b0177a7bb30db9fd088a6e8  rc.single
diff --git a/rc/Pkgfile b/rc/Pkgfile
new file mode 100644 (file)
index 0000000..1577c68
--- /dev/null
@@ -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.29
+release=2
+source=(inittab rc rc.modules rc.single rc.multi rc.local rc.fix rc.shutdown rc.conf)
+
+build() {
+    install -d  $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
+    install -d $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 (file)
index 0000000..27347f0
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# /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 --noclear 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 115200 ttyAMA0 vt100
+#s2:2:respawn:/sbin/agetty 38400 ttyS0 vt100
+
+ca::ctrlaltdel:/sbin/shutdown -t3 -r now
+
+# End of file
diff --git a/rc/rc b/rc/rc
new file mode 100755 (executable)
index 0000000..6390e4c
--- /dev/null
+++ b/rc/rc
@@ -0,0 +1,110 @@
+#!/bin/bash
+#
+# /etc/rc: system boot script
+#
+
+echo "The system is coming up.  Please wait."
+
+# Load configuration
+. /etc/rc.conf
+
+# Start udev
+/bin/mount -t proc none /proc
+/bin/mount -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 -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 -o remount,ro /
+       /sbin/reboot -f
+       exit 0
+fi
+
+# Mount local filesystems
+/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/set_clock
+
+# 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 (file)
index 0000000..c4265ce
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# /etc/rc.conf: system configuration
+#
+
+FONT=default
+KEYMAP=us
+TIMEZONE=UTC
+HOSTNAME=host
+SYSLOG=sysklogd
+SERVICES=(lo net crond)
+
+# End of file
diff --git a/rc/rc.fix b/rc/rc.fix
new file mode 100755 (executable)
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 (executable)
index 0000000..5e44d98
--- /dev/null
@@ -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 (executable)
index 0000000..fa08c59
--- /dev/null
@@ -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 (executable)
index 0000000..465332f
--- /dev/null
@@ -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 (executable)
index 0000000..3c32acc
--- /dev/null
@@ -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/set_clock
+
+# Write to wtmp file before unmounting
+/sbin/halt -w
+
+# Turn off swap
+/sbin/swapoff -a
+
+# Unmount file systems
+/bin/umount -a -d -r -t nosysfs,noproc,nodevtmpfs
+if [ -x /sbin/lvm ]; then
+       /sbin/vgchange --ignorelockingfailure -a n
+fi
+/bin/umount -a -r
+
+# Remount root filesystem read-only
+/bin/mount -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 (executable)
index 0000000..4291eb0
--- /dev/null
@@ -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