commit 76ce8eab95eac0448e57ee6ca321021481f761af Author: lw-everestlinux Date: Tue Sep 13 17:52:14 2022 -0400 Initial commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9a169f4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2007-2009 Jim Gifford and Ryan Oliver + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ab1faa1 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +ETCDIR := /etc +EXTDIR := ${DESTDIR}${ETCDIR} +MODE := 754 +DIRMODE := 755 +CONFMODE := 644 + +install-bootscripts: create-dirs + install -m ${CONFMODE} clfs/rc.d/init.d/functions ${EXTDIR}/rc.d/init.d/ + install -m ${MODE} clfs/rc.d/startup ${EXTDIR}/rc.d/ + install -m ${MODE} clfs/rc.d/shutdown ${EXTDIR}/rc.d/ + install -m ${MODE} clfs/rc.d/init.d/syslog ${EXTDIR}/rc.d/init.d/ + ln -sf ../init.d/syslog ${EXTDIR}/rc.d/start/S05syslog + ln -sf ../init.d/syslog ${EXTDIR}/rc.d/stop/K99syslog + +all: install-bootscripts install-dropbear install-netplug + +create-dirs: + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/start + install -d -m ${DIRMODE} ${EXTDIR}/rc.d/stop + +install-dropbear: create-dirs + install -m ${MODE} clfs/rc.d/init.d/sshd ${EXTDIR}/rc.d/init.d/ + ln -sf ../init.d/sshd ${EXTDIR}/rc.d/start/S30sshd + ln -sf ../init.d/sshd ${EXTDIR}/rc.d/stop/K30sshd + +install-netplug: create-dirs + install -m ${MODE} clfs/rc.d/init.d/netplugd ${EXTDIR}/rc.d/init.d/ + ln -sf ../init.d/netplugd ${EXTDIR}/rc.d/start/S10netplugd + ln -sf ../init.d/netplugd ${EXTDIR}/rc.d/stop/K90netplugd + +.PHONY: all create-dirs install-bootscripts install-dropbear install-netplug diff --git a/clfs/rc.d/init.d/functions b/clfs/rc.d/init.d/functions new file mode 100755 index 0000000..3c8521d --- /dev/null +++ b/clfs/rc.d/init.d/functions @@ -0,0 +1,21 @@ +# Common Routines +# + +# Default Path for scripts +# +PATH=/bin:/sbin:/usr/bin:/usr/sbin + +# Check status and print +# OK or FAIL +# +check_status() +{ + local ERR=$? + echo -en "\\033[65G" + if [ $ERR = 0 ]; then + echo -en "\\033[1;32mOK" + else + echo -en "\\033[1;31mFAIL" + fi + echo -e "\\033[0;39m" +} diff --git a/clfs/rc.d/init.d/netplugd b/clfs/rc.d/init.d/netplugd new file mode 100755 index 0000000..acde2c8 --- /dev/null +++ b/clfs/rc.d/init.d/netplugd @@ -0,0 +1,25 @@ +#!/bin/ash + +# Netplugd Startup Script + +. /etc/rc.d/init.d/functions + +case "$1" in +start) + echo -n "Starting netplugd: " + netplugd + check_status + ;; +stop) + echo -n "Stopping netplugd: " + killall netplugd + check_status + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/clfs/rc.d/init.d/sshd b/clfs/rc.d/init.d/sshd new file mode 100755 index 0000000..f11daa1 --- /dev/null +++ b/clfs/rc.d/init.d/sshd @@ -0,0 +1,54 @@ +#!/bin/ash +# +# DropBear SSH + +. /etc/rc.d/init.d/functions + +DSSKEY=/etc/dropbear/dropbear_dss_host_key +RSAKEY=/etc/dropbear/dropbear_rsa_host_key +PIDFILE=/var/run/dropbear.pid + +case "$1" in +start) + if [ ! -r "$DSSKEY" ]; then + echo -n "Generating DSS host key: " + dropbearkey -t dss -f "$DSSKEY" >/dev/null 2>&1 + check_status + fi + if [ ! -r "$RSAKEY" ]; then + echo -n "Generating RSA host key: " + dropbearkey -t rsa -f "$RSAKEY" >/dev/null 2>&1 + check_status + fi + if [ -r "$PIDFILE" ]; then + echo "Service dropbear already running." + else + echo -n "Starting SSH server: " + dropbear + check_status + fi + ;; +stop) + if [ -r "$PIDFILE" ]; then + echo -n "Stopping dropbear SSH server: " + kill `cat "$PIDFILE"` + check_status + else + echo "Service dropbear not running." + fi + ;; +restart) + $0 stop + $0 start + ;; +status) + if [ -r "$PIDFILE" ]; then + echo "Service dropbear running (PID $(cat "$PIDFILE"))." + else + echo "Service dropbear not running." + fi + ;; +*) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 +esac diff --git a/clfs/rc.d/init.d/syslog b/clfs/rc.d/init.d/syslog new file mode 100755 index 0000000..a7c1d68 --- /dev/null +++ b/clfs/rc.d/init.d/syslog @@ -0,0 +1,34 @@ +#!/bin/ash + +# Syslog Startup Script +# + +. /etc/rc.d/init.d/functions + +SYSLOG_ROTATE_SIZE=65536 + +case "$1" in +start) + echo -n "Starting syslogd: " + syslogd -m 0 -s $SYSLOG_ROTATE_SIZE -L + check_status + echo -n "Starting klogd: " + klogd + check_status + ;; +stop) + echo -n "Stopping klogd: " + killall klogd + check_status + echo -n "Stopping syslogd: " + killall syslogd + check_status + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/clfs/rc.d/shutdown b/clfs/rc.d/shutdown new file mode 100755 index 0000000..4958523 --- /dev/null +++ b/clfs/rc.d/shutdown @@ -0,0 +1,42 @@ +#!/bin/ash + +# System Shutdown Script +# + +. /etc/rc.d/init.d/functions + +echo "[ /\ ] Stopping Everest Linux" + +echo +echo "System is going down for reboot or halt now." +echo + + +echo "Starting stop scripts." + +for i in /etc/rc.d/stop/* +do + if [ -x $i ]; then + $i stop + fi +done + +if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then + echo -n "Syncing system clock to hardware clock: " + hwclock --systohc --utc + check_status +fi + +if [ -x /sbin/swapoff ] && [ -s /etc/fstab ]; then + echo -n "Disabling swap space: " + swapoff -a + check_status +fi + +echo -n "Syncing all filesystems: " +sync +check_status + +echo -n "Unmounting all filesystems: " +umount -a -r + diff --git a/clfs/rc.d/startup b/clfs/rc.d/startup new file mode 100755 index 0000000..074763e --- /dev/null +++ b/clfs/rc.d/startup @@ -0,0 +1,98 @@ +#!/bin/ash + +# System Startup Script +# +. /etc/rc.d/init.d/functions + +echo "[ /\ ] Starting Everest Linux" + +echo "Mounting filesystems: " + +/bin/mount -t proc none /proc +/bin/mount -t sysfs none /sys +/bin/mount -t tmpfs /tmp /tmp +/bin/mkdir /dev/pts +/bin/mkdir /dev/shm + +/bin/echo "/sbin/mdev" > /proc/sys/kernel/hotplug + +echo -n "Starting mdev: " +/sbin/mdev -s +check_status + +echo -n "Mounting devpts: " +/bin/mount -t devpts none /dev/pts +check_status + +echo -n "Mounting shared memory: " +/bin/mount -t tmpfs none /dev/shm +check_status + +if [ -x /sbin/hwclock ] && [ -e /dev/rtc0 ]; then + echo -n "Setting system clock: " + hwclock --hctosys --utc + check_status +fi + +if [ -x /sbin/fsck ]; then + echo "Starting fsck for local filesystems." + fsck -A -C -R -T -t nonfs,nosmbfs + if [ "$?" -gt 2 ]; then + echo "WARNING: Errors found while checking filesystems." + echo "You can login as root now, the system will reboot after logout." + sulogin + reboot + elif [ "$?" = "2" ]; then + echo "NOTICE: System needs to be rebooted now." + sleep 1 + reboot + else + echo -n "Checking local filesystems: " + check_status + fi +fi + + +if [ -x /sbin/swapon ]; then + echo -n "Enabling swap space: " + swapon -a + check_status +fi + +echo -n "Remounting root rw: " +mount -o remount,rw / +check_status + +echo -n "Linking /var/tmp and /tmp: " +ln -s ../tmp /var/tmp +check_status + +echo -n "Setting hostname: " +hostname -F /etc/HOSTNAME +check_status + +echo -n "Cleaning up system: " +rm -rf /var/run/* +> /var/run/utmp +touch /var/log/wtmp +touch /var/log/messages +chmod 0664 /var/run/utmp +chmod 0664 /var/log/wtmp +chmod 0660 /var/log/messages +rm -rf /tmp/* +check_status + +echo -n "Setting up interface lo: " +ifconfig lo up 127.0.0.1 +check_status + +echo "Running start scripts." + +for i in /etc/rc.d/start/* +do + if [ -x $i ]; then + $i start + fi +done + +exit 0