From c319003eafa6d04be5ba82d04127c3129dd49fe3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 21 Nov 2019 21:26:38 +0100 Subject: [PATCH] - rootfs: switch to sysvinit --- Makefile | 1 + make/ni.mk | 2 + make/target-files.mk | 14 ++ make/target-scripts.mk | 27 ++-- make/target-tools.mk | 34 ++--- skel-root/general/files-etc/default/rcS | 29 ++++ skel-root/general/files-etc/init.d/rc | 180 ++++++++++++++++++++++++ skel-root/general/files-etc/inittab | 37 +++++ skel-root/hd1/etc/init.d/rcS | 16 ++- skel-root/hd1/etc/inittab | 10 -- skel-root/hd2/etc/init.d/rcS | 18 ++- skel-root/hd2/etc/inittab | 10 -- skel-root/hd51/etc/init.d/rcS | 16 ++- skel-root/hd51/etc/inittab | 10 -- skel-root/vuduo/etc/init.d/rcK | 3 - skel-root/vuduo/etc/init.d/rcS | 16 ++- skel-root/vuduo/etc/inittab | 10 -- skel-root/vuplus/etc/init.d/rcK | 3 - skel-root/vuplus/etc/init.d/rcS | 16 ++- skel-root/vuplus/etc/inittab | 10 -- 20 files changed, 363 insertions(+), 99 deletions(-) create mode 100644 make/target-files.mk create mode 100644 skel-root/general/files-etc/default/rcS create mode 100644 skel-root/general/files-etc/init.d/rc create mode 100644 skel-root/general/files-etc/inittab delete mode 100644 skel-root/hd1/etc/inittab delete mode 100644 skel-root/hd2/etc/inittab delete mode 100644 skel-root/hd51/etc/inittab delete mode 100644 skel-root/vuduo/etc/inittab delete mode 100644 skel-root/vuplus/etc/inittab diff --git a/Makefile b/Makefile index a3aec4de..22e3ab0f 100755 --- a/Makefile +++ b/Makefile @@ -157,6 +157,7 @@ include make/prerequisites.mk include make/target-blobs.mk include make/target-development.mk include make/target-ffmpeg$(if $(filter $(BOXTYPE),coolstream),-coolstream).mk +include make/target-files.mk include make/target-libs.mk include make/target-libs-static.mk include make/target-libs-unused.mk diff --git a/make/ni.mk b/make/ni.mk index 717264e1..9f8e700e 100644 --- a/make/ni.mk +++ b/make/ni.mk @@ -51,6 +51,7 @@ ni-image: make dropbear $(MAKE) hdparm $(MAKE) busybox + $(MAKE) sysvinit $(MAKE) coreutils $(MAKE) dosfstools $(MAKE) wpa_supplicant @@ -82,6 +83,7 @@ ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2 hd51 vusolo4k vuduo4k vuultimo4k endif endif make autofs + make files-etc make scripts make init-scripts ifeq ($(PERSONALIZE), yes) diff --git a/make/target-files.mk b/make/target-files.mk new file mode 100644 index 00000000..0a34fb09 --- /dev/null +++ b/make/target-files.mk @@ -0,0 +1,14 @@ +# +# makefile to install system files +# +# ----------------------------------------------------------------------------- + +files-etc: \ + $(TARGET_DIR)/etc/default/rcS \ + $(TARGET_DIR)/etc/inittab + +$(TARGET_DIR)/etc/default/rcS: + $(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/default/rcS $(@) + +$(TARGET_DIR)/etc/inittab: + $(INSTALL_DATA) -D $(TARGET_FILES)/files-etc/inittab $(@) diff --git a/make/target-scripts.mk b/make/target-scripts.mk index 31330a43..7c5d9131 100644 --- a/make/target-scripts.mk +++ b/make/target-scripts.mk @@ -6,6 +6,7 @@ init-scripts: \ $(TARGET_DIR)/etc/init.d/globals \ $(TARGET_DIR)/etc/init.d/functions \ + $(TARGET_DIR)/etc/init.d/rc \ $(TARGET_DIR)/etc/init.d/camd \ $(TARGET_DIR)/etc/init.d/camd_datefix \ $(TARGET_DIR)/etc/init.d/coredump \ @@ -27,10 +28,12 @@ $(TARGET_DIR)/etc/init.d/globals: $(TARGET_DIR)/etc/init.d/functions: $(INSTALL_DATA) -D $(TARGET_FILES)/scripts/init.functions $(@) +$(TARGET_DIR)/etc/init.d/rc: + $(INSTALL_EXEC) -D $(TARGET_FILES)/files-etc/init.d/rc $(@) + $(TARGET_DIR)/etc/init.d/camd: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/camd.init $(@) - ln -sf camd $(TARGET_DIR)/etc/init.d/S99camd - ln -sf camd $(TARGET_DIR)/etc/init.d/K01camd + $(UPDATE-RC.D) $(@F) defaults 98 01 $(TARGET_DIR)/etc/init.d/camd_datefix: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/camd_datefix.init $(@) @@ -38,12 +41,12 @@ $(TARGET_DIR)/etc/init.d/camd_datefix: $(TARGET_DIR)/etc/init.d/coredump: ifneq ($(BOXMODEL), nevis) $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/coredump.init $(@) + $(UPDATE-RC.D) $(@F) start 40 S . endif $(TARGET_DIR)/etc/init.d/crond: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/crond.init $(@) - ln -sf crond $(TARGET_DIR)/etc/init.d/S55crond - ln -sf crond $(TARGET_DIR)/etc/init.d/K55crond + $(UPDATE-RC.D) $(@F) defaults 50 $(TARGET_DIR)/etc/init.d/custom-poweroff: ifeq ($(BOXTYPE), coolstream) @@ -52,20 +55,18 @@ endif $(TARGET_DIR)/etc/init.d/fstab: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/fstab.init $(@) - ln -sf fstab $(TARGET_DIR)/etc/init.d/S01fstab - ln -sf fstab $(TARGET_DIR)/etc/init.d/K99fstab + $(UPDATE-RC.D) $(@F) defaults 01 98 $(TARGET_DIR)/etc/init.d/hostname: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/hostname.init $(@) $(TARGET_DIR)/etc/init.d/inetd: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/inetd.init $(@) - ln -sf inetd $(TARGET_DIR)/etc/init.d/S53inetd - ln -sf inetd $(TARGET_DIR)/etc/init.d/K80inetd + $(UPDATE-RC.D) $(@F) defaults 50 $(TARGET_DIR)/etc/init.d/networking: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/networking.init $(@) - ln -sf networking $(TARGET_DIR)/etc/init.d/K99networking + $(UPDATE-RC.D) $(@F) stop 98 0 6 . $(TARGET_DIR)/etc/init.d/partitions-by-name: ifeq ($(BOXMODEL), $(filter $(BOXMODEL), hd51 bre2ze4k h7)) @@ -80,7 +81,7 @@ endif $(TARGET_DIR)/etc/init.d/swap: ifeq ($(BOXMODEL), $(filter $(BOXMODEL), hd51 bre2ze4k h7 vusolo4k vuduo4k vuultimo4k vuzero4k vuuno4k vuuno4kse vuduo)) $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/swap.init $(@) - ln -sf swap $(TARGET_DIR)/etc/init.d/K99swap + $(UPDATE-RC.D) $(@F) stop 98 0 6 . endif $(TARGET_DIR)/etc/init.d/sys_update.sh: @@ -88,13 +89,14 @@ $(TARGET_DIR)/etc/init.d/sys_update.sh: $(TARGET_DIR)/etc/init.d/syslogd: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/syslogd.init $(@) - ln -sf syslogd $(TARGET_DIR)/etc/init.d/K98syslogd + $(UPDATE-RC.D) $(@F) stop 98 0 6 . # ----------------------------------------------------------------------------- scripts: \ $(TARGET_DIR)/sbin/service \ $(TARGET_DIR)/sbin/flash_eraseall \ + $(TARGET_DIR)/sbin/update-rc.d \ $(TARGET_SHARE_DIR)/udhcpc/default.script $(TARGET_DIR)/sbin/service: @@ -105,5 +107,8 @@ ifeq ($(BOXTYPE), coolstream) $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/flash_eraseall $(@) endif +$(TARGET_DIR)/sbin/update-rc.d: + $(INSTALL_EXEC) -D $(HELPERS_DIR)/update-rc.d $(@) + $(TARGET_SHARE_DIR)/udhcpc/default.script: $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/udhcpc-default.script $(@) diff --git a/make/target-tools.mk b/make/target-tools.mk index 560cd8c6..514603e3 100644 --- a/make/target-tools.mk +++ b/make/target-tools.mk @@ -531,8 +531,7 @@ djmount: $(DJMOUNT_DEPS) $(ARCHIVE)/$(DJMOUNT_SOURCE) | $(TARGET_DIR) make; \ make install DESTDIR=$(TARGET_DIR) $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/djmount.init $(TARGET_DIR)/etc/init.d/djmount - ln -sf djmount $(TARGET_DIR)/etc/init.d/S99djmount - ln -sf djmount $(TARGET_DIR)/etc/init.d/K01djmount + $(UPDATE-RC.D) djmount defaults 75 25 $(REMOVE)/$(DJMOUNT_TMP) $(TOUCH) @@ -573,8 +572,7 @@ ushare: $(USHARE_DEPS) $(ARCHIVE)/$(USHARE_SOURCE)| $(TARGET_DIR) $(INSTALL_DATA) -D $(TARGET_FILES)/configs/ushare.conf $(TARGET_DIR)/etc/ushare.conf sed -i 's|%(BOXTYPE)|$(BOXTYPE)|; s|%(BOXMODEL)|$(BOXMODEL)|' $(TARGET_DIR)/etc/ushare.conf $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/ushare.init $(TARGET_DIR)/etc/init.d/ushare - ln -sf ushare $(TARGET_DIR)/etc/init.d/S99ushare - ln -sf ushare $(TARGET_DIR)/etc/init.d/K01ushare + $(UPDATE-RC.D) ushare defaults 75 25 $(REMOVE)/$(USHARE_TMP) $(TOUCH) @@ -631,8 +629,7 @@ inadyn: $(INADYN_DEPS) $(ARCHIVE)/$(INADYN_SOURCE) | $(TARGET_DIR) $(INSTALL_DATA) -D $(TARGET_FILES)/configs/inadyn.conf $(TARGET_DIR)/var/etc/inadyn.conf ln -sf /var/etc/inadyn.conf $(TARGET_DIR)/etc/inadyn.conf $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/inadyn.init $(TARGET_DIR)/etc/init.d/inadyn - ln -sf inadyn $(TARGET_DIR)/etc/init.d/S80inadyn - ln -sf inadyn $(TARGET_DIR)/etc/init.d/K60inadyn + $(UPDATE-RC.D) inadyn defaults 75 25 $(REMOVE)/$(INADYN_TMP) $(TOUCH) @@ -667,8 +664,7 @@ vsftpd: $(VSFTPD_DEPS) $(ARCHIVE)/$(VSFTPD_SOURCE) | $(TARGET_DIR) $(INSTALL_DATA) -D $(TARGET_FILES)/configs/vsftpd.conf $(TARGET_DIR)/etc/vsftpd.conf $(INSTALL_DATA) -D $(TARGET_FILES)/configs/vsftpd.chroot_list $(TARGET_DIR)/etc/vsftpd.chroot_list $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/vsftpd.init $(TARGET_DIR)/etc/init.d/vsftpd - ln -sf vsftpd $(TARGET_DIR)/etc/init.d/S53vsftpd - ln -sf vsftpd $(TARGET_DIR)/etc/init.d/K80vsftpd + $(UPDATE-RC.D) vsftpd defaults 75 25 $(REMOVE)/$(VSFTPD_TMP) $(TOUCH) @@ -943,8 +939,7 @@ autofs: $(AUTOFS_DEPS) $(ARCHIVE)/$(AUTOFS_SOURCE) | $(TARGET_DIR) $(MAKE) SUBDIRS="lib daemon modules" DONTSTRIP=1; \ $(MAKE) SUBDIRS="lib daemon modules" install DESTDIR=$(TARGET_DIR) $(INSTALL_COPY) $(TARGET_FILES)/autofs/* $(TARGET_DIR)/ - ln -sf autofs $(TARGET_DIR)/etc/init.d/S60autofs - ln -sf autofs $(TARGET_DIR)/etc/init.d/K40autofs + $(UPDATE-RC.D) autofs defaults 75 25 $(REMOVE)/$(AUTOFS_TMP) $(TOUCH) @@ -1019,8 +1014,7 @@ samba33: $(SAMBA33_DEPS) $(ARCHIVE)/$(SAMBA33_SOURCE) | $(TARGET_DIR) mkdir -p $(TARGET_DIR)/var/samba/locks $(INSTALL_DATA) $(TARGET_FILES)/configs/smb3.conf $(TARGET_DIR)/etc/samba/smb.conf $(INSTALL_EXEC) $(TARGET_FILES)/scripts/samba3.init $(TARGET_DIR)/etc/init.d/samba - ln -sf samba $(TARGET_DIR)/etc/init.d/S99samba - ln -sf samba $(TARGET_DIR)/etc/init.d/K01samba + $(UPDATE-RC.D) samba defaults 75 25 rm -rf $(TARGET_DIR)/bin/testparm rm -rf $(TARGET_DIR)/bin/findsmb rm -rf $(TARGET_DIR)/bin/smbtar @@ -1101,8 +1095,7 @@ samba36: $(SAMBA36_DEPS) $(ARCHIVE)/$(SAMBA36_SOURCE) | $(TARGET_DIR) mkdir -p $(TARGET_DIR)/var/samba/locks $(INSTALL_DATA) $(TARGET_FILES)/configs/smb3.conf $(TARGET_DIR)/etc/samba/smb.conf $(INSTALL_EXEC) $(TARGET_FILES)/scripts/samba3.init $(TARGET_DIR)/etc/init.d/samba - ln -sf samba $(TARGET_DIR)/etc/init.d/S99samba - ln -sf samba $(TARGET_DIR)/etc/init.d/K01samba + $(UPDATE-RC.D) samba defaults 75 25 rm -rf $(TARGET_DIR)/bin/testparm rm -rf $(TARGET_DIR)/bin/findsmb rm -rf $(TARGET_DIR)/bin/smbtar @@ -1153,8 +1146,7 @@ dropbear: $(DROPBEAR_DEPS) $(ARCHIVE)/$(DROPBEAR_SOURCE) | $(TARGET_DIR) $(MAKE) PROGRAMS="dropbear dbclient dropbearkey scp" install DESTDIR=$(TARGET_DIR) mkdir -p $(TARGET_DIR)/etc/dropbear $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/dropbear.init $(TARGET_DIR)/etc/init.d/dropbear - ln -sf dropbear $(TARGET_DIR)/etc/init.d/S60dropbear - ln -sf dropbear $(TARGET_DIR)/etc/init.d/K60dropbear + $(UPDATE-RC.D) dropbear defaults 75 25 $(REMOVE)/$(DROPBEAR_TMP) $(TOUCH) @@ -1187,7 +1179,7 @@ sg3_utils: $(ARCHIVE)/$(SG3_UTILS_SOURCE) | $(TARGET_DIR) done $(REWRITE_LIBTOOL)/libsgutils2.la $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/sdX.init $(TARGET_DIR)/etc/init.d/sdX - ln -sf sdX $(TARGET_DIR)/etc/init.d/K97sdX + $(UPDATE-RC.D) sdX stop 97 0 6 . $(REMOVE)/$(SG3_UTILS_TMP) \ $(TARGET_DIR)/bin.$(@F) $(TOUCH) @@ -1329,8 +1321,7 @@ xupnpd: $(XUPNPD_DEPS) | $(TARGET_DIR) $(INSTALL_DATA) -D $(SOURCE_DIR)/$(NI-NEUTRINO-PLUGINS)/scripts-lua/xupnpd/xupnpd_coolstream.lua $(TARGET_SHARE_DIR)/xupnpd/plugins/ $(INSTALL_DATA) -D $(SOURCE_DIR)/$(NI-NEUTRINO-PLUGINS)/scripts-lua/xupnpd/xupnpd_cczwei.lua $(TARGET_SHARE_DIR)/xupnpd/plugins/ $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/xupnpd.init $(TARGET_DIR)/etc/init.d/xupnpd - ln -sf xupnpd $(TARGET_DIR)/etc/init.d/S99xupnpd - ln -sf xupnpd $(TARGET_DIR)/etc/init.d/K01xupnpd + $(UPDATE-RC.D) xupnpd defaults 75 25 $(INSTALL_COPY) $(TARGET_FILES)/xupnpd/* $(TARGET_DIR)/ $(REMOVE)/$(XUPNPD_TMP) $(TOUCH) @@ -1423,8 +1414,7 @@ nfs-utils: $(NFS-UTILS_DEPS) $(ARCHIVE)/$(NFS-UTILS_SOURCE) | $(TARGET_DIR) rm -rf $(TARGET_DIR)/sbin/showmount rm -rf $(TARGET_DIR)/sbin/rpcdebug $(INSTALL_EXEC) -D $(TARGET_FILES)/scripts/nfsd.init $(TARGET_DIR)/etc/init.d/nfsd - ln -s nfsd $(TARGET_DIR)/etc/init.d/S60nfsd - ln -s nfsd $(TARGET_DIR)/etc/init.d/K01nfsd + $(UPDATE-RC.D) nfsd defaults 75 25 $(REMOVE)/$(NFS-UTILS_TMP) $(TOUCH) @@ -1822,7 +1812,7 @@ define SYSVINIT_INSTALL done ln -sf /sbin/halt $(TARGET_DIR)/sbin/reboot ln -sf /sbin/halt $(TARGET_DIR)/sbin/poweroff - ln -sf killall5 $(TARGET_DIR)/sbin/pidof + ln -sf /sbin/killall5 $(TARGET_DIR)/sbin/pidof endef sysvinit: $(ARCHIVE)/$(SYSVINIT_SOURCE) | $(TARGET_DIR) diff --git a/skel-root/general/files-etc/default/rcS b/skel-root/general/files-etc/default/rcS new file mode 100644 index 00000000..709cdf6e --- /dev/null +++ b/skel-root/general/files-etc/default/rcS @@ -0,0 +1,29 @@ +# +# Defaults for the boot scripts in /etc/rcS.d +# + +# Time files in /tmp are kept in days. +TMPTIME=0 +# Set to yes if you want sulogin to be spawned on bootup +SULOGIN=no +# Set to no if you want to be able to login over telnet/rlogin +# before system startup is complete (as soon as inetd is started) +DELAYLOGIN=no +# Assume that the BIOS clock is set to UTC time (recommended) +UTC=yes +# Set VERBOSE to "no" if you would like a more quiet bootup. +VERBOSE=no +# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically +EDITMOTD=no +# Whether to fsck root on boot +ENABLE_ROOTFS_FSCK=no +# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup. +FSCKFIX=yes +# Set TICKADJ to the correct tick value for this specific machine +#TICKADJ=10000 +# Enable caching in populate-volatile.sh +VOLATILE_ENABLE_CACHE=yes +# Indicate whether the rootfs is intended to be read-only or not. +# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs. +# Normally you should not change this value. +ROOTFS_READ_ONLY=no diff --git a/skel-root/general/files-etc/init.d/rc b/skel-root/general/files-etc/init.d/rc new file mode 100644 index 00000000..2854689b --- /dev/null +++ b/skel-root/general/files-etc/init.d/rc @@ -0,0 +1,180 @@ +#!/bin/sh +# +# rc This file is responsible for starting/stopping +# services when the runlevel changes. +# +# Optimization feature: +# A startup script is _not_ run when the service was +# running in the previous runlevel and it wasn't stopped +# in the runlevel transition (most Debian services don't +# have K?? links in rc{1,2,3,4,5} ) +# +# Author: Miquel van Smoorenburg +# Bruce Perens +# +# Version: @(#)rc 2.78 07-Nov-1999 miquels@cistron.nl +# + +. /etc/default/rcS +export VERBOSE + +startup_progress() { + step=$(($step + $step_change)) + if [ "$num_steps" != "0" ]; then + progress=$((($step * $progress_size / $num_steps) + $first_step)) + else + progress=$progress_size + fi + #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size" + #if type psplash-write >/dev/null 2>&1; then + # TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true + #fi + if [ $progress -gt 0 -a -e /proc/progress ]; then + echo $(($progress / 2)) > /proc/progress + elif [ $progress -gt 0 -a -e /proc/vfd ]; then + echo Loading $(($progress / 2)) % > /proc/vfd + elif [ $progress -gt 0 -a -e /usr/bin/displayvfd ]; then + displayvfd -s 18 -t "Booting $progress" + elif [ $progress -gt 0 -a -e /dev/mcu ]; then + echo $(($progress / 2)) > /dev/mcu + fi +} + + +# +# Start script or program. +# +startup() { + # Handle verbosity + [ "$VERBOSE" = very ] && echo "INIT: Running $@..." + + case "$1" in + *.sh) + # Source shell script for speed. + ( + trap - INT QUIT TSTP + scriptname=$1 + shift + . $scriptname + ) + ;; + *) + "$@" + ;; + esac + startup_progress +} + + # Ignore CTRL-C only in this shell, so we can interrupt subprocesses. + trap ":" INT QUIT TSTP + + # Set onlcr to avoid staircase effect. + stty onlcr 0>&1 + + # Limit stack size for startup scripts + [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE + + # Now find out what the current and what the previous runlevel are. + + runlevel=$RUNLEVEL + # Get first argument. Set new runlevel to this argument. + [ "$1" != "" ] && runlevel=$1 + if [ "$runlevel" = "" ] + then + echo "Usage: $0 " >&2 + exit 1 + fi + previous=$PREVLEVEL + [ "$previous" = "" ] && previous=N + + export runlevel previous + + # Is there an rc directory for this new runlevel? + if [ -d /etc/rc$runlevel.d ] + then + # Find out where in the progress bar the initramfs got to. + PROGRESS_STATE=0 + #if [ -f /dev/.initramfs/progress_state ]; then + # . /dev/.initramfs/progress_state + #fi + + # Split the remaining portion of the progress bar into thirds + progress_size=$(((100 - $PROGRESS_STATE) / 3)) + + case "$runlevel" in + 0|6) + # Count down from -100 to 0 and use the entire bar + first_step=-100 + progress_size=100 + step_change=1 + ;; + S) + # Begin where the initramfs left off and use 2/3 + # of the remaining space + first_step=$PROGRESS_STATE + progress_size=$(($progress_size * 2)) + step_change=1 + ;; + *) + # Begin where rcS left off and use the final 1/3 of + # the space (by leaving progress_size unchanged) + first_step=$(($progress_size * 2 + $PROGRESS_STATE)) + step_change=1 + ;; + esac + + num_steps=0 + for s in /etc/rc$runlevel.d/[SK]*; do + case "${s##/etc/rc$runlevel.d/S??}" in + gdm|xdm|kdm|reboot|halt) + break + ;; + esac + num_steps=$(($num_steps + 1)) + done + step=0 + + # First, run the KILL scripts. + if [ $previous != N ] + then + for i in /etc/rc$runlevel.d/K[0-9][0-9]* + do + # Check if the script is there. + [ ! -f $i ] && continue + + # Stop the service. + startup $i stop + done + fi + + # Now run the START scripts for this runlevel. + for i in /etc/rc$runlevel.d/S* + do + [ ! -f $i ] && continue + + if [ $previous != N ] && [ $previous != S ] + then + # + # Find start script in previous runlevel and + # stop script in this runlevel. + # + suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]} + stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix + previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix + # + # If there is a start script in the previous level + # and _no_ stop script in this level, we don't + # have to re-start the service. + # + [ -f $previous_start ] && [ ! -f $stop ] && continue + fi + case "$runlevel" in + 0|6) + startup $i stop + ;; + *) + startup $i start + ;; + esac + done + fi diff --git a/skel-root/general/files-etc/inittab b/skel-root/general/files-etc/inittab new file mode 100644 index 00000000..6b1d7c69 --- /dev/null +++ b/skel-root/general/files-etc/inittab @@ -0,0 +1,37 @@ +# /etc/inittab: init configuration. + +# The default runlevel. +id:3:initdefault: + +# Boot-time system configuration/initialization script. +# This is run first except when booting in emergency (-b) mode. +si::sysinit:/etc/init.d/rcS + +# /etc/init.d executes the S and K scripts upon change +# of runlevel. +# +# Runlevel 0 is halt. +# Runlevel 1 is single-user. +# Runlevels 2-5 are multi-user. +# Runlevel 6 is reboot. + +l0:0:wait:/etc/init.d/rc 0 +l1:1:wait:/etc/init.d/rc 1 +l2:2:wait:/etc/init.d/rc 2 +l3:3:wait:/etc/init.d/rc 3 +l4:4:wait:/etc/init.d/rc 4 +l5:5:wait:/etc/init.d/rc 5 +l6:6:wait:/etc/init.d/rc 6 + +# run neutrino gui +gui:3:respawn:/etc/init.d/start_neutrino + +# Stuff to do for the 3-finger salute +#ca::ctrlaltdel:/sbin/reboot + +# Stuff to do before halt or reboot +shd0:06:wait:/etc/init.d/rcK + +# The usual halt or reboot actions +hlt0:0:wait:/sbin/halt -dhp +reb0:6:wait:/sbin/reboot diff --git a/skel-root/hd1/etc/init.d/rcS b/skel-root/hd1/etc/init.d/rcS index f8a44262..5d215531 100755 --- a/skel-root/hd1/etc/init.d/rcS +++ b/skel-root/hd1/etc/init.d/rcS @@ -1,5 +1,13 @@ #!/bin/sh +runlevel=S +prevlevel=N +umask 022 +export runlevel prevlevel + +# source defaults +. /etc/default/rcS + . /etc/profile . /etc/init.d/functions . /etc/init.d/globals @@ -64,7 +72,7 @@ LOGINFO "init frontpanel ..." # Frontpanel insmod cs_frontpanel.ko -# update +# update kernel if [ -x /etc/init.d/stb_update.sh ]; then /etc/init.d/stb_update.sh fi @@ -152,6 +160,12 @@ dt -t"BOOT NI-IMAGE" # change default core pattern echo "/tmp/core.%e.%p.%t" > /proc/sys/kernel/core_pattern +# trap CTRL-C only in this shell so we can interrupt subprocesses +trap ":" INT QUIT TSTP + +# call all parts in order +exec /etc/init.d/rc S + # starting services and daemons in order of the symlink names LOGINFO "run initscripts start ..." run_initscripts start diff --git a/skel-root/hd1/etc/inittab b/skel-root/hd1/etc/inittab deleted file mode 100644 index 6899d820..00000000 --- a/skel-root/hd1/etc/inittab +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/inittab: init configuration. - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/start_neutrino - -::askfirst:-/bin/sh - -::restart:/sbin/init -::ctrlaltdel:/sbin/reboot -::shutdown:/etc/init.d/rcK diff --git a/skel-root/hd2/etc/init.d/rcS b/skel-root/hd2/etc/init.d/rcS index 638a3e88..266624fe 100755 --- a/skel-root/hd2/etc/init.d/rcS +++ b/skel-root/hd2/etc/init.d/rcS @@ -1,5 +1,13 @@ #!/bin/sh +runlevel=S +prevlevel=N +umask 022 +export runlevel prevlevel + +# source defaults +. /etc/default/rcS + . /etc/profile . /etc/init.d/functions . /etc/init.d/globals @@ -8,7 +16,7 @@ SHOWINFO "start" mount -t proc proc /proc -# update +# update kernel if [ -x /etc/init.d/stb_update.sh ]; then /etc/init.d/stb_update.sh fi @@ -158,10 +166,14 @@ dt -ls02 dt -c dt -t"BOOT NI-IMAGE" +# trap CTRL-C only in this shell so we can interrupt subprocesses +trap ":" INT QUIT TSTP + +# call all parts in order +exec /etc/init.d/rc S + # starting services and daemons in order of the symlink names LOGINFO "run initscripts start ..." run_initscripts start -service coredump start - SHOWINFO "done" diff --git a/skel-root/hd2/etc/inittab b/skel-root/hd2/etc/inittab deleted file mode 100644 index 6899d820..00000000 --- a/skel-root/hd2/etc/inittab +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/inittab: init configuration. - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/start_neutrino - -::askfirst:-/bin/sh - -::restart:/sbin/init -::ctrlaltdel:/sbin/reboot -::shutdown:/etc/init.d/rcK diff --git a/skel-root/hd51/etc/init.d/rcS b/skel-root/hd51/etc/init.d/rcS index b7f33bc4..3ea391a3 100755 --- a/skel-root/hd51/etc/init.d/rcS +++ b/skel-root/hd51/etc/init.d/rcS @@ -1,5 +1,13 @@ #!/bin/sh +runlevel=S +prevlevel=N +umask 022 +export runlevel prevlevel + +# source defaults +. /etc/default/rcS + . /etc/profile . /etc/init.d/functions . /etc/init.d/globals @@ -95,10 +103,14 @@ service ntpdate start # say hi to everyone echo "Booting... NI" > /dev/dbox/oled0 +# trap CTRL-C only in this shell so we can interrupt subprocesses +trap ":" INT QUIT TSTP + +# call all parts in order +exec /etc/init.d/rc S + # starting services and daemons in order of the symlink names LOGINFO "run initscripts start ..." run_initscripts start -service coredump start - SHOWINFO "done" diff --git a/skel-root/hd51/etc/inittab b/skel-root/hd51/etc/inittab deleted file mode 100644 index 6899d820..00000000 --- a/skel-root/hd51/etc/inittab +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/inittab: init configuration. - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/start_neutrino - -::askfirst:-/bin/sh - -::restart:/sbin/init -::ctrlaltdel:/sbin/reboot -::shutdown:/etc/init.d/rcK diff --git a/skel-root/vuduo/etc/init.d/rcK b/skel-root/vuduo/etc/init.d/rcK index 03cdee44..e7338005 100755 --- a/skel-root/vuduo/etc/init.d/rcK +++ b/skel-root/vuduo/etc/init.d/rcK @@ -23,6 +23,3 @@ LOGINFO "run initscripts stop ..." run_initscripts stop SHOWINFO "done" - -# FIXME -#/bin/turnoff_power diff --git a/skel-root/vuduo/etc/init.d/rcS b/skel-root/vuduo/etc/init.d/rcS index 4b3f3f2b..00a30100 100755 --- a/skel-root/vuduo/etc/init.d/rcS +++ b/skel-root/vuduo/etc/init.d/rcS @@ -1,5 +1,13 @@ #!/bin/sh +runlevel=S +prevlevel=N +umask 022 +export runlevel prevlevel + +# source defaults +. /etc/default/rcS + . /etc/profile . /etc/init.d/functions . /etc/init.d/globals @@ -91,10 +99,14 @@ service ntpdate start # say hi to everyone echo "Booting... NI" > /dev/dbox/oled0 +# trap CTRL-C only in this shell so we can interrupt subprocesses +trap ":" INT QUIT TSTP + +# call all parts in order +exec /etc/init.d/rc S + # starting services and daemons in order of the symlink names LOGINFO "run initscripts start ..." run_initscripts start -service coredump start - SHOWINFO "done" diff --git a/skel-root/vuduo/etc/inittab b/skel-root/vuduo/etc/inittab deleted file mode 100644 index 6899d820..00000000 --- a/skel-root/vuduo/etc/inittab +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/inittab: init configuration. - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/start_neutrino - -::askfirst:-/bin/sh - -::restart:/sbin/init -::ctrlaltdel:/sbin/reboot -::shutdown:/etc/init.d/rcK diff --git a/skel-root/vuplus/etc/init.d/rcK b/skel-root/vuplus/etc/init.d/rcK index 03cdee44..e7338005 100755 --- a/skel-root/vuplus/etc/init.d/rcK +++ b/skel-root/vuplus/etc/init.d/rcK @@ -23,6 +23,3 @@ LOGINFO "run initscripts stop ..." run_initscripts stop SHOWINFO "done" - -# FIXME -#/bin/turnoff_power diff --git a/skel-root/vuplus/etc/init.d/rcS b/skel-root/vuplus/etc/init.d/rcS index c764b61f..8396bae8 100755 --- a/skel-root/vuplus/etc/init.d/rcS +++ b/skel-root/vuplus/etc/init.d/rcS @@ -1,5 +1,13 @@ #!/bin/sh +runlevel=S +prevlevel=N +umask 022 +export runlevel prevlevel + +# source defaults +. /etc/default/rcS + . /etc/profile . /etc/init.d/functions . /etc/init.d/globals @@ -90,10 +98,14 @@ service ntpdate start echo "Booting... NI" > /dev/dbox/oled0 oled -b 5 +# trap CTRL-C only in this shell so we can interrupt subprocesses +trap ":" INT QUIT TSTP + +# call all parts in order +exec /etc/init.d/rc S + # starting services and daemons in order of the symlink names LOGINFO "run initscripts start ..." run_initscripts start -service coredump start - SHOWINFO "done" diff --git a/skel-root/vuplus/etc/inittab b/skel-root/vuplus/etc/inittab deleted file mode 100644 index 6899d820..00000000 --- a/skel-root/vuplus/etc/inittab +++ /dev/null @@ -1,10 +0,0 @@ -# /etc/inittab: init configuration. - -::sysinit:/etc/init.d/rcS -::once:/etc/init.d/start_neutrino - -::askfirst:-/bin/sh - -::restart:/sbin/init -::ctrlaltdel:/sbin/reboot -::shutdown:/etc/init.d/rcK