scripts dutchification - batch 3

This commit is contained in:
bergware
2023-10-04 01:42:26 +02:00
parent 077770b71a
commit bf19257f95
7 changed files with 309 additions and 294 deletions
+16 -13
View File
@@ -1,13 +1,16 @@
#!/bin/bash
#
# rc.4 This file is executed by init(8) when the system is being
# initialized for run level 4 (XDM)
# script: rc.4
#
# Version: @(#)/etc/rc.d/rc.4 2.00 02/17/93
# This file is executed by init(8) when the system is being initialized for run level 4 (XDM)
#
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com>
# Version: 2.00 02/17/93
#
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# At least 47% rewritten by: Patrick J. Volkerding <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Tell the viewers what's going to happen...
echo "Starting up X11 session manager..."
@@ -15,39 +18,39 @@ echo "Starting up X11 session manager..."
# If you'd like to start something different or in a different order than
# the options below, create your own startup script /etc/rc.d/rc.4.local
# and make it executable and it will be used instead:
if [ -x /etc/rc.d/rc.4.local ]; then
if [[ -x /etc/rc.d/rc.4.local ]]; then
exec /bin/bash /etc/rc.d/rc.4.local
fi
# Try to use GNOME's gdm session manager. This comes first because if
# gdm is on the machine then the user probably installed it and wants
# to use it by default:
if [ -x /usr/bin/gdm ]; then
if [[ -x /usr/bin/gdm ]]; then
exec /usr/bin/gdm
fi
# Someone thought that gdm looked prettier in /usr/sbin,
# so look there, too:
if [ -x /usr/sbin/gdm ]; then
if [[ -x /usr/sbin/gdm ]]; then
exec /usr/sbin/gdm
fi
# Not there? OK, try to use KDE's kdm session manager:
if [ -x /opt/kde/bin/kdm ]; then
if [[ -x /opt/kde/bin/kdm ]]; then
exec /opt/kde/bin/kdm -nodaemon
elif [ -x /usr/bin/kdm ]; then
elif [[ -x /usr/bin/kdm ]]; then
exec /usr/bin/kdm -nodaemon
fi
# Look for SDDM as well:
if [ -x /usr/bin/sddm ]; then
if [[ -x /usr/bin/sddm ]]; then
exec /usr/bin/sddm
fi
# If all you have is XDM, I guess it will have to do:
if [ -x /usr/bin/xdm ]; then
if [[ -x /usr/bin/xdm ]]; then
exec /usr/bin/xdm -nodaemon
elif [ -x /usr/X11R6/bin/xdm ]; then
elif [[ -x /usr/X11R6/bin/xdm ]]; then
exec /usr/X11R6/bin/xdm -nodaemon
fi
+8 -4
View File
@@ -1,9 +1,13 @@
#! /bin/sh
#!/bin/bash
#
# rc.4.local This file is executed by rc.4
# script: rc.4.local
#
# This file is executed by rc.4
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Try to use SLiM login manager:
if [ -x /usr/bin/slim ]; then
# Try to use SLiM login manager
if [[ -x /usr/bin/slim ]]; then
exec /usr/bin/slim
fi
+70 -69
View File
@@ -1,21 +1,23 @@
#!/bin/bash
#
# rc.6 This file is executed by init when it goes into runlevel
# 0 (halt) or runlevel 6 (reboot). It kills all processes,
# unmounts file systems and then either halts or reboots.
# script: rc.6
#
# Version: @(#)/etc/rc.d/rc.6 15.0 Wed Nov 10 21:19:42 UTC 2021
# This file is executed by init when it goes into runlevel 0 (halt) or runlevel 6 (reboot).
# It kills all processes, unmounts file systems and then either halts or reboots.
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
# Version: 2.47 Sat Jan 13 13:37:26 PST 2001
#
# limetech - modified for Unraid OS
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by: Patrick J. Volkerding, <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Set the path.
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
@@ -26,16 +28,15 @@ echo "Running shutdown script $0:"
# Find out how we were called.
case "$0" in
*0)
shutdown_command="halt"
;;
*6)
shutdown_command=reboot
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
;;
*0)
SHUTDOWN_COMMAND="halt"
;;
*6)
SHUTDOWN_COMMAND="reboot"
;;
*)
echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
exit 1
esac
# Restart init. This prevents init from hanging on to file handles for removed
@@ -44,28 +45,28 @@ esac
# Save the system time to the hardware clock using hwclock --systohc.
# This will also create or update the timestamps in /etc/adjtime.
if [ -x /sbin/hwclock ]; then
if [[ -x /sbin/hwclock ]]; then
# Check for a broken motherboard RTC clock (where ioports for rtc are
# unknown) to prevent hwclock causing a hang:
if ! grep -q " : rtc" /proc/ioports ; then
if ! grep -q " : rtc" /proc/ioports; then
CLOCK_OPT="--directisa"
fi
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
if grep -q "^LOCAL" /etc/adjtime ; then
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
if grep -q "^LOCAL" /etc/adjtime; then
echo "Saving system time to the hardware clock (localtime)."
else
echo "Saving system time to the hardware clock (UTC)."
fi
/sbin/hwclock $CLOCK_OPT --systohc
elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
elif grep -q "^UTC" /etc/hardwareclock 2>/dev/null; then
echo "Saving system time to the hardware clock (UTC)."
if [ ! -r /etc/adjtime ]; then
if [[ ! -r /etc/adjtime ]]; then
echo "Creating system time correction file /etc/adjtime."
fi
/sbin/hwclock $CLOCK_OPT --utc --systohc
else
echo "Saving system time to the hardware clock (localtime)."
if [ ! -r /etc/adjtime ]; then
if [[ ! -r /etc/adjtime ]]; then
echo "Creating system time correction file /etc/adjtime."
fi
/sbin/hwclock $CLOCK_OPT --localtime --systohc
@@ -73,126 +74,126 @@ if [ -x /sbin/hwclock ]; then
fi
# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
if [[ -x /etc/rc.d/rc.local_shutdown ]]; then
/etc/rc.d/rc.local_shutdown stop
fi
# Stop mcelog
if [ -x /etc/rc.d/rc.mcelog ]; then
if [[ -x /etc/rc.d/rc.mcelog ]]; then
/etc/rc.d/rc.mcelog stop
fi
# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
if [[ -x /etc/rc.d/rc.samba ]]; then
/etc/rc.d/rc.samba stop
fi
# Stop avahi:
if [ -x /etc/rc.d/rc.avahidaemon ]; then
if [[ -x /etc/rc.d/rc.avahidaemon ]]; then
/etc/rc.d/rc.avahidaemon stop
/etc/rc.d/rc.avahidnsconfd stop
fi
# Shut down WireGuard
if [ -x /etc/rc.d/rc.wireguard ]; then
if [[ -x /etc/rc.d/rc.wireguard ]]; then
/etc/rc.d/rc.wireguard stop
fi
# Shut down OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
if [[ -x /etc/rc.d/rc.openldap ]]; then
/etc/rc.d/rc.openldap stop
fi
# Shut down the SASL authentication daemon:
if [ -x /etc/rc.d/rc.saslauthd ]; then
if [[ -x /etc/rc.d/rc.saslauthd ]]; then
/etc/rc.d/rc.saslauthd stop
fi
# Stop the MySQL database:
if [ -x /etc/rc.d/rc.mysqld -a -r /var/run/mysql/mysql.pid ]; then
if [[ -x /etc/rc.d/rc.mysqld && -r /var/run/mysql/mysql.pid ]]; then
/etc/rc.d/rc.mysqld stop
fi
# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
if [[ -x /etc/rc.d/rc.nfsd ]]; then
/etc/rc.d/rc.nfsd stop
fi
# Shut down the SSH server:
if [ -x /etc/rc.d/rc.sshd ]; then
if [[ -x /etc/rc.d/rc.sshd ]]; then
/etc/rc.d/rc.sshd stop
fi
# Stop the Network Time Protocol daemon:
if [ -x /etc/rc.d/rc.ntpd ]; then
if [[ -x /etc/rc.d/rc.ntpd ]]; then
/etc/rc.d/rc.ntpd stop
fi
# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
unset FUSER_DELAY
for dir in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do
for dir in $(mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1); do
echo "Killing processes holding NFS mount $dir open..."
# Background this to prevent fuser from also blocking shutdown:
/usr/bin/fuser -k -M -m "$dir" &
FUSER_DELAY=5
done
# If fuser was run, let it have some delay:
if [ ! -z "$FUSER_DELAY" ]; then
if [[ ! -z "$FUSER_DELAY" ]]; then
sleep $FUSER_DELAY
fi
# Unmount any NFS, SMB, or CIFS filesystems:
echo "Unmounting remote filesystems:"
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
# Update PATH hashes:
hash -r
# Stop D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
if [[ -x /etc/rc.d/rc.messagebus ]]; then
/etc/rc.d/rc.messagebus stop
fi
# Bring down the networking system, but first make sure that this
# isn't a diskless client with the / partition mounted via NFS:
if ! /bin/mount | /bin/grep -q -e 'on / type nfs' -e 'on / type nfs4' ; then
if [ -x /etc/rc.d/rc.inet1 ]; then
if ! mount | grep -q -e 'on / type nfs' -e 'on / type nfs4'; then
if [[ -x /etc/rc.d/rc.inet1 ]]; then
/etc/rc.d/rc.inet1 stop
fi
fi
# In case dhcpcd might have been manually started on the command line,
# look for the .pid file, and shut dhcpcd down if it's found:
if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
/sbin/dhcpcd -k 1> /dev/null 2> /dev/null
if ls /etc/dhcpc/*.pid 1>/dev/null 2>/dev/null; then
dhcpcd -k 1>/dev/null 2>/dev/null
# A little time for /etc/resolv.conf and/or other files to
# restore themselves.
sleep 2
fi
# Turn off process accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
/sbin/accton off
fi
# Terminate acpid before syslog:
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
if [[ -x /etc/rc.d/rc.acpid && -r /var/run/acpid.pid ]]; then # quit
/etc/rc.d/rc.acpid stop
fi
# Stop udev:
if [ -x /etc/rc.d/rc.udev ]; then
if [[ -x /etc/rc.d/rc.udev ]]; then
/etc/rc.d/rc.udev force-stop
fi
# Kill all remaining processes.
OMITPIDS="$(for p in $(pgrep mdmon); do echo -o $p; done)" # Don't kill mdmon
if [ ! "$1" = "fast" ]; then
if [[ $1 != fast ]]; then
echo "Sending all processes the SIGTERM signal."
/sbin/killall5 -15 $OMITPIDS
/bin/sleep 5
killall5 -15 $OMITPIDS
sleep 5
echo "Sending all processes the SIGKILL signal."
/sbin/killall5 -9 $OMITPIDS
killall5 -9 $OMITPIDS
fi
# limetech - let's keep this on the USB flash
@@ -201,13 +202,13 @@ fi
cp /var/lib/seedrng/seed.credit /boot/config/random-seed 2>/dev/null
# Before unmounting file systems write a reboot or halt record to wtmp.
$shutdown_command -w
$SHUTDOWN_COMMAND -w
# Turn off swap:
if [ ! "$(cat /proc/swaps | wc -l)" = "1" ]; then
if [[ ! $(cat /proc/swaps | wc -l) == 1 ]]; then
echo "Turning off swap."
/sbin/swapoff -a
/bin/sync
swapoff -a
sync
fi
# Unmount local file systems:
@@ -221,56 +222,56 @@ while IFS= read -r line; do
mount_path=$(echo "$line" | awk '{print $2}')
[[ " ${EXCLUDE_TYPES[@]} " =~ " ${mount_type} " ]] && continue
[[ " ${EXCLUDE_PATHS[@]} " =~ " ${mount_path} " ]] && continue
/sbin/umount -v "$mount_path"
umount -v "$mount_path"
done <<< "$MOUNTS"
# limetech - shut down the unraid driver if started
if /bin/grep -qs 'mdState=STARTED' /proc/mdstat ; then
if grep -qs 'mdState=STARTED' /proc/mdstat; then
echo "Stopping md/unraid driver:"
echo "stop" > /proc/mdcmd
if /bin/grep -qs 'mdState=STOPPED' /proc/mdstat ; then
echo "stop" >/proc/mdcmd
if grep -qs 'mdState=STOPPED' /proc/mdstat; then
echo "Clean shutdown"
/bin/rm -f /boot/config/forcesync
rm -f /boot/config/forcesync
else
echo "Unclean shutdown - Cannot stop md/unraid driver"
fi
fi
# This never hurts:
/bin/sync
sync
# now remount /boot read-only
echo "Remounting /boot read-only:"
/sbin/mount -v -o remount,ro /boot
mount -v -o remount,ro /boot
echo "Remounting root filesystem read-only:"
/bin/mount -v -n -o remount,ro /
mount -v -n -o remount,ro /
# sleep 3 fixes problems with some hard drives that don't
# otherwise finish syncing before reboot or poweroff
/bin/sleep 3
sleep 3
# This is to ensure all processes have completed on SMP machines:
wait
if [ -x /sbin/genpowerd ]; then
if [[ -x /sbin/genpowerd ]]; then
# See if this is a powerfail situation:
if grep -E -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
if grep -E -q "FAIL|SCRAM" /etc/upsstatus 2>/dev/null; then
# Signal UPS to shut off the inverter:
/sbin/genpowerd -k
if [ ! $? = 0 ]; then
if [[ ! $? == 0 ]]; then
echo
echo "There was an error signaling the UPS."
echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
echo "the serial line and UPS type."
# Wasting 15 seconds of precious power:
/bin/sleep 15
sleep 15
fi
fi
fi
# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
if [ "$shutdown_command" = "reboot" ]; then
if [[ $SHUTDOWN_COMMAND == reboot ]]; then
echo "Rebooting."
/sbin/reboot
else
+28 -26
View File
@@ -1,78 +1,81 @@
#!/bin/bash
#
# rc.K This file is executed by init when it goes into runlevel
# 1, which is the administrative state. It kills all
# daemons and then puts the system into single user mode.
# Note that the file systems are kept mounted.
# script: rc.K
#
# Version: @(#)/etc/rc.d/rc.K 3.1415 Sat Jan 13 13:37:26 PST 2001
# This file is executed by init when it goes into runlevel 1, which is the administrative state.
# It kills all daemons and then puts the system into single user mode.
# Note that the file systems are kept mounted.
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by: Patrick J. Volkerding <volkerdi@slackware.com>
# Version: 3.1415 Sat Jan 13 13:37:26 PST 2001
#
# Author: Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified by: Patrick J. Volkerding <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Set the path.
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
# Load a custom screen font if the user has an rc.font script.
if [ -x /etc/rc.d/rc.font ]; then
if [[ -x /etc/rc.d/rc.font ]]; then
/etc/rc.d/rc.font
fi
# Load any needed keyboard mappings:
if [ -x /etc/rc.d/rc.keymap ]; then
if [[ -x /etc/rc.d/rc.keymap ]]; then
/etc/rc.d/rc.keymap
fi
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
# Try to turn off quota:
if grep -q quota /etc/fstab ; then
if [ -x /sbin/quotaoff ]; then
if [[ -x /sbin/quotaoff ]]; then
echo "Turning off filesystem quotas."
/sbin/quotaoff -a
fi
fi
# Try to turn off accounting:
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
/sbin/accton off
fi
# Run any local shutdown scripts:
if [ -x /etc/rc.d/rc.local_shutdown ]; then
if [[ -x /etc/rc.d/rc.local_shutdown ]]; then
/etc/rc.d/rc.local_shutdown stop
fi
# Stop the Apache web server:
if [ -x /etc/rc.d/rc.httpd ]; then
if [[ -x /etc/rc.d/rc.httpd ]]; then
/etc/rc.d/rc.httpd stop
fi
# Stop the Samba server:
if [ -x /etc/rc.d/rc.samba ]; then
if [[ -x /etc/rc.d/rc.samba ]]; then
/etc/rc.d/rc.samba stop
fi
# Shut down the NFS server:
if [ -x /etc/rc.d/rc.nfsd ]; then
if [[ -x /etc/rc.d/rc.nfsd ]]; then
/etc/rc.d/rc.nfsd stop
fi
# Kill any processes (typically gam) that would otherwise prevent
# unmounting NFS volumes:
unset FUSER_DELAY
for dir in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1) ; do
echo "Killing processes holding NFS mount $dir open..."
for DIR in $(/bin/mount | grep -e 'type nfs ' -e 'type nfs4 ' | sed -e 's|.* on ||g' | cut -d ' ' -f 1); do
echo "Killing processes holding NFS mount $DIR open..."
# Background this to prevent fuser from also blocking shutdown:
/usr/bin/fuser -k -M -m "$dir" &
/usr/bin/fuser -k -M -m "$DIR" &
FUSER_DELAY=5
done
# If fuser was run, let it have some delay:
if [ ! -z "$FUSER_DELAY" ]; then
if [[ -n "$FUSER_DELAY" ]]; then
sleep $FUSER_DELAY
fi
@@ -81,14 +84,14 @@ echo "Unmounting remote filesystems:"
/bin/umount -v -a -l -f -r -t nfs,nfs4,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"
# Shut down PCMCIA devices:
if [ -x /etc/rc.d/rc.pcmcia ] ; then
if [[ -x /etc/rc.d/rc.pcmcia ]]; then
/etc/rc.d/rc.pcmcia stop
# The cards might need a little extra time here to deactivate:
sleep 5
fi
# Terminate acpid before syslog:
if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
if [[ -x /etc/rc.d/rc.acpid && -r /var/run/acpid.pid ]]; then # quit
/etc/rc.d/rc.acpid stop
fi
@@ -98,7 +101,7 @@ echo
echo "Sending all processes the SIGHUP signal."
killall5 -1 $OMITPIDS
echo -n "Waiting for processes to hang up"
for loop in 0 1 2 3 4 5 ; do
for LOOP in {1..5}; do
sleep 1
echo -n "."
done
@@ -106,7 +109,7 @@ echo
echo "Sending all processes the SIGTERM signal."
killall5 -15 $OMITPIDS
echo -n "Waiting for processes to terminate"
for loop in 0 1 2 3 4 5 ; do
for LOOP in {1..5}; do
sleep 1
echo -n "."
done
@@ -114,7 +117,7 @@ echo
echo "Sending all processes the SIGKILL signal."
killall5 -9 $OMITPIDS
echo -n "Waiting for processes to exit"
for loop in 0 1 2 3 4 5 ; do
for LOOP in {1..5}; do
sleep 1
echo -n "."
done
@@ -123,4 +126,3 @@ echo
# Now go to the single user level
echo "Going to single user mode..."
/sbin/telinit -t 1 1
+60 -59
View File
@@ -1,29 +1,30 @@
#!/bin/bash
#
# rc.M This file is executed by init(8) when the system is being
# initialized for one of the "multi user" run levels (i.e.
# levels 1 through 6). It usually does mounting of file
# systems et al.
# script: rc.M
#
# Version: @(#)/etc/rc.d/rc.M 15.0 Fri Nov 12 18:51:28 UTC 2021
# This file is executed by init(8) when the system is being initialized for one of the "multi user" run levels (i.e. levels 1 through 6).
# It usually does mounting of file systems et al.
#
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
# Version: 15.0 Fri Nov 12 18:51:28 UTC 2021
#
# LimeTech - Modified for Unraid OS
# Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
# Heavily modified by Patrick Volkerding <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Tell the viewers what's going to happen.
echo "Going multiuser..."
# Update all the shared library links:
if [ -x /sbin/ldconfig ]; then
if [[ -x /sbin/ldconfig ]]; then
echo "Updating shared library links: /sbin/ldconfig &"
/sbin/ldconfig &
fi
# Call the setterm init script to set screen blanking and power management
# defaults:
if [ -x /etc/rc.d/rc.setterm ]; then
if [[ -x /etc/rc.d/rc.setterm ]]; then
/etc/rc.d/rc.setterm
fi
@@ -32,8 +33,8 @@ fi
# Set the permissions on /var/log/dmesg according to whether the kernel
# permits non-root users to access kernel dmesg information:
if [ -r /proc/sys/kernel/dmesg_restrict ]; then
if [ $(cat /proc/sys/kernel/dmesg_restrict) = 1 ]; then
if [[ -r /proc/sys/kernel/dmesg_restrict ]]; then
if [[ $(cat /proc/sys/kernel/dmesg_restrict) == 1 ]]; then
touch /var/log/dmesg
chmod 640 /var/log/dmesg
fi
@@ -45,12 +46,12 @@ fi
/bin/dmesg -s 65536 > /var/log/dmesg
# Start the system logger.
if [ -x /etc/rc.d/rc.rsyslogd ]; then
if [[ -x /etc/rc.d/rc.rsyslogd ]]; then
/etc/rc.d/rc.rsyslogd start
fi
# Update the X font indexes:
if [ -x /usr/bin/fc-cache ]; then
if [[ -x /usr/bin/fc-cache ]]; then
echo "Updating X font indexes: /usr/bin/fc-cache -f &"
/usr/bin/fc-cache -f &
fi
@@ -58,76 +59,76 @@ fi
# Run rc.udev again. This will start udev if it is not already running
# (for example, upon return from runlevel 1), otherwise it will trigger it
# to look for device changes and to generate persistent rules if needed.
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
if ! grep -wq nohotplug /proc/cmdline ; then
if [ -x /etc/rc.d/rc.udev ]; then
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems; then
if ! grep -wq nohotplug /proc/cmdline; then
if [[ -x /etc/rc.d/rc.udev ]]; then
/etc/rc.d/rc.udev start
fi
fi
fi
# Initialize the networking hardware.
if [ -x /etc/rc.d/rc.inet1 ]; then
if [[ -x /etc/rc.d/rc.inet1 ]]; then
/etc/rc.d/rc.inet1
fi
# Start D-Bus:
if [ -x /etc/rc.d/rc.messagebus ]; then
if [[ -x /etc/rc.d/rc.messagebus ]]; then
/etc/rc.d/rc.messagebus start
fi
# Start the session/seat daemon:
if [ -x /etc/rc.d/rc.elogind -a -x /bin/loginctl ]; then
if [[ -x /etc/rc.d/rc.elogind && -x /bin/loginctl ]]; then
/etc/rc.d/rc.elogind start
elif [ -x /etc/rc.d/rc.consolekit -a -x /usr/sbin/console-kit-daemon ]; then
elif [[ -x /etc/rc.d/rc.consolekit && -x /usr/sbin/console-kit-daemon ]]; then
/etc/rc.d/rc.consolekit start
fi
# Start Bluetooth:
if [ -x /etc/rc.d/rc.bluetooth ]; then
if [[ -x /etc/rc.d/rc.bluetooth ]]; then
/etc/rc.d/rc.bluetooth start
fi
# Start networking daemons:
if [ -x /etc/rc.d/rc.inet2 ]; then
if [[ -x /etc/rc.d/rc.inet2 ]]; then
/etc/rc.d/rc.inet2
fi
# Mount any additional filesystem types that haven't already been mounted:
mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done
mount -a -v 2>/dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} "; done
# Start the Network Time Protocol daemon:
if [ -x /etc/rc.d/rc.ntpd ]; then
if [[ -x /etc/rc.d/rc.ntpd ]]; then
/etc/rc.d/rc.ntpd start
fi
# Remove stale locks and junk files (must be done after mount -a!)
/bin/rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2> /dev/null
rm -f /var/lock/* /var/spool/uucp/LCK..* /tmp/.X*lock /tmp/.X11-unix/* 2>/dev/null
# Ensure basic filesystem permissions sanity.
chmod 755 / 2> /dev/null
chmod 755 / 2>/dev/null
chmod 1777 /tmp /var/tmp
# Start ACPI daemon.
if [ -x /etc/rc.d/rc.acpid ]; then
if [[ -x /etc/rc.d/rc.acpid ]]; then
/etc/rc.d/rc.acpid start
fi
# Enable CPU frequency scaling:
if [ -x /etc/rc.d/rc.cpufreq ]; then
if [[ -x /etc/rc.d/rc.cpufreq ]]; then
/etc/rc.d/rc.cpufreq start
fi
# Update any existing icon cache files:
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then
for theme_dir in /usr/share/icons/* ; do
if [ -r ${theme_dir}/icon-theme.cache ]; then
if find /usr/share/icons -maxdepth 2 2>/dev/null | grep -q icon-theme.cache; then
for theme_dir in /usr/share/icons/*; do
if [[ -r ${theme_dir}/icon-theme.cache ]]; then
echo "Updating icon-theme.cache in ${theme_dir}..."
/usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
/usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1>/dev/null 2>/dev/null &
fi
done
# This would be a large file and probably shouldn't be there.
if [ -r /usr/share/icons/icon-theme.cache ]; then
if [[ -r /usr/share/icons/icon-theme.cache ]]; then
echo "Deleting icon-theme.cache in /usr/share/icons..."
#/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null &
rm -f /usr/share/icons/icon-theme.cache
@@ -135,42 +136,42 @@ if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; t
fi
# Update mime database:
if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
if [[ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]]; then
echo "Updating MIME database: /usr/bin/update-mime-database /usr/share/mime &"
/usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
fi
# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
if [ -x /usr/bin/update-gtk-immodules ]; then
if [[ -x /usr/bin/update-gtk-immodules ]]; then
echo "Updating gtk.immodules:"
echo " /usr/bin/update-gtk-immodules &"
/usr/bin/update-gtk-immodules > /dev/null 2>&1 &
/usr/bin/update-gtk-immodules 1>/dev/null 2>/dev/null &
fi
if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
if [[ -x /usr/bin/update-gdk-pixbuf-loaders ]]; then
echo "Updating gdk-pixbuf.loaders:"
echo " /usr/bin/update-gdk-pixbuf-loaders &"
HOME=/root /usr/bin/update-gdk-pixbuf-loaders > /dev/null 2>&1 &
HOME=/root /usr/bin/update-gdk-pixbuf-loaders 1>/dev/null 2>/dev/null &
fi
if [ -x /usr/bin/update-pango-querymodules ]; then
if [[ -x /usr/bin/update-pango-querymodules ]]; then
echo "Updating pango.modules:"
echo " /usr/bin/update-pango-querymodules &"
/usr/bin/update-pango-querymodules > /dev/null 2>&1 &
/usr/bin/update-pango-querymodules 1>/dev/null 2>/dev/null &
fi
if [ -x /usr/bin/glib-compile-schemas ]; then
if [[ -x /usr/bin/glib-compile-schemas ]]; then
echo "Compiling GSettings XML schema files:"
echo " /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas &"
/usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas >/dev/null 2>&1 &
/usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas 1>/dev/null 2>/dev/null &
fi
# Start dnsmasq, a simple DHCP/DNS server:
if [ -x /etc/rc.d/rc.dnsmasq ]; then
if [[ -x /etc/rc.d/rc.dnsmasq ]]; then
/etc/rc.d/rc.dnsmasq start
fi
# Start smartd, which monitors the status of S.M.A.R.T. compatible
# hard drives and reports any problems:
if [ -x /etc/rc.d/rc.smartd ]; then
if [[ -x /etc/rc.d/rc.smartd ]]; then
/etc/rc.d/rc.smartd start
fi
@@ -179,76 +180,76 @@ fi
# create the file /var/log/pacct (touch /var/log/pacct). By default, process
# accounting is not enabled (since /var/log/pacct does not exist). This is
# because the log file can get VERY large.
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
if [[ -x /sbin/accton && -r /var/log/pacct ]]; then
chmod 640 /var/log/pacct
/sbin/accton /var/log/pacct
fi
# Start crond (Dillon's crond):
if [ -x /etc/rc.d/rc.crond ]; then
if [[ -x /etc/rc.d/rc.crond ]]; then
/etc/rc.d/rc.crond start
fi
# Start atd (manages jobs scheduled with 'at'):
if [ -x /etc/rc.d/rc.atd ]; then
if [[ -x /etc/rc.d/rc.atd ]]; then
/etc/rc.d/rc.atd start
fi
# Load a custom screen font if the user has an rc.font script.
if [ -x /etc/rc.d/rc.font ]; then
if [[ -x /etc/rc.d/rc.font ]]; then
/etc/rc.d/rc.font
fi
# Load a custom keymap if the user has an rc.keymap script.
if [ -x /etc/rc.d/rc.keymap ]; then
if [[ -x /etc/rc.d/rc.keymap ]]; then
/etc/rc.d/rc.keymap
fi
# Start the MariaDB database:
if [ -x /etc/rc.d/rc.mysqld ]; then
if [[ -x /etc/rc.d/rc.mysqld ]]; then
/etc/rc.d/rc.mysqld start
fi
# Start the SASL authentication server. This provides SASL
# authentication services for sendmail/postfix:
if [ -x /etc/rc.d/rc.saslauthd ]; then
if [[ -x /etc/rc.d/rc.saslauthd ]]; then
/etc/rc.d/rc.saslauthd start
fi
# Start OpenLDAP:
if [ -x /etc/rc.d/rc.openldap ]; then
if [[ -x /etc/rc.d/rc.openldap ]]; then
/etc/rc.d/rc.openldap start
fi
# Start WireGuard
if [ -x /etc/rc.d/rc.wireguard ]; then
if [[ -x /etc/rc.d/rc.wireguard ]]; then
/etc/rc.d/rc.wireguard start
fi
# Start avahi:
if [ -x /etc/rc.d/rc.avahidaemon ]; then
if [[ -x /etc/rc.d/rc.avahidaemon ]]; then
/etc/rc.d/rc.avahidaemon start
/etc/rc.d/rc.avahidnsconfd start
fi
# Start Samba (a file/print server for Windows machines).
# Samba can be started in /etc/inetd.conf instead.
if [ -x /etc/rc.d/rc.samba ]; then
if [[ -x /etc/rc.d/rc.samba ]]; then
/etc/rc.d/rc.samba start
fi
# Start mcelog
if [ -x /etc/rc.d/rc.mcelog ]; then
if [[ -x /etc/rc.d/rc.mcelog ]]; then
/etc/rc.d/rc.mcelog start
fi
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
# Start the local setup procedure.
if [ -x /etc/rc.d/rc.local ]; then
if [[ -x /etc/rc.d/rc.local ]]; then
/etc/rc.d/rc.local
fi
+58 -55
View File
@@ -1,21 +1,24 @@
#!/bin/bash
#
# /etc/rc.d/rc.S: System initialization script.
# script: rc.S
#
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
# LimeTech - Modified for Unraid OS
# System initialization script.
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# Set the path.
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin
# Mount /proc if it is not already mounted:
if [ ! -d /proc/sys ]; then
/sbin/mount -v proc /proc -n -t proc 2> /dev/null
if [[ ! -d /proc/sys ]]; then
mount -v proc /proc -n -t proc 2> /dev/null
fi
# Mount /sys if it is not already mounted:
if [ ! -d /sys/kernel ]; then
/sbin/mount -v sysfs /sys -n -t sysfs 2> /dev/null
if [[ ! -d /sys/kernel ]]; then
mount -v sysfs /sys -n -t sysfs 2> /dev/null
fi
# The efivarfs filesystem is used for reading and writing EFI variables, such
@@ -23,21 +26,21 @@ fi
# the /sys/firmware/efi/efivars directory. To modify this behavior, edit the
# file: /etc/default/efivarfs
# Only try to mount if this directory exists (so the kernel supports efivarfs):
if [ -d /sys/firmware/efi/efivars ]; then
if [[ -d /sys/firmware/efi/efivars ]]; then
# Only try to mount if efivarfs is not already mounted:
if ! /sbin/mount | /bin/grep -wq efivarfs ; then
if ! mount | grep -wq efivarfs; then
# Mount according to /etc/default/efivarfs:
if [ -r /etc/default/efivarfs ]; then
if [[ -r /etc/default/efivarfs ]]; then
. /etc/default/efivarfs
else # default
EFIVARFS=rw
EFIVARFS="rw"
fi
case "$EFIVARFS" in
'rw')
/sbin/mount -o rw -t efivarfs none /sys/firmware/efi/efivars
'rw')
mount -o rw -t efivarfs none /sys/firmware/efi/efivars
;;
'ro')
/sbin/mount -o ro -t efivarfs none /sys/firmware/efi/efivars
'ro')
mount -o ro -t efivarfs none /sys/firmware/efi/efivars
;;
esac
fi
@@ -45,42 +48,42 @@ fi
# If /run exists, mount a tmpfs on it (unless the
# initrd has already done so):
if [ -d /run ]; then
if ! /bin/grep -wq "tmpfs /run tmpfs" /proc/mounts ; then
/sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755,size=32M,nodev,nosuid,noexec
if [[ -d /run ]]; then
if ! grep -wq "tmpfs /run tmpfs" /proc/mounts; then
mount -v -n -t tmpfs tmpfs /run -o mode=0755,size=32M,nodev,nosuid,noexec
fi
fi
# limetech - lets mount debugfs
/sbin/mount -v -t debugfs none /sys/kernel/debug
# LimeTech - lets mount debugfs
mount -v -t debugfs none /sys/kernel/debug
# limetech - determine if the 'unraidlabel' kernel append parameter was
# LimeTech - determine if the 'unraidlabel' kernel append parameter was
# provided to override which device is mounted for /boot (default: UNRAID)
UNRAIDLABEL="UNRAID"
UNRAIDROOT=
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
unraidlabel=*)
UNRAIDLABEL="${x#unraidlabel=}"
;;
root=*)
UNRAIDROOT="${x#root=}"
;;
esac
case "$x" in
unraidlabel=*)
UNRAIDLABEL="${x#unraidlabel=}"
;;
root=*)
UNRAIDROOT="${x#root=}"
;;
esac
done
# limetech - poll for device with $UNRAIDLABEL present, with 30-sec timeout
# LimeTech - poll for device with $UNRAIDLABEL present, with 30-sec timeout
# this serves to synchronize this script with USB subsystem
abort() {
read -p "$1 - press ENTER key to reboot ..."
read -p "$1 - press ENTER key to reboot..."
echo
/sbin/reboot
}
find_device() {
# find which USB flash device/partition has the indicated label
local i
for i in {1..30} ; do
for i in {1..30}; do
DEVICE=$(/sbin/blkid -L $UNRAIDLABEL)
[[ -z $DEVICE ]] && sleep 1 || return 0
done
@@ -90,35 +93,35 @@ echo -n "waiting up to 30 sec for device with label $UNRAIDLABEL to come online
find_device && echo "found $DEVICE" || abort "not found"
echo "Checking $DEVICE ..."
/sbin/fsck.fat -a -w $DEVICE 2>/dev/null
fsck.fat -a -w $DEVICE 2>/dev/null
/sbin/mount -v -t vfat -o auto,rw,flush,noatime,nodiratime,dmask=77,fmask=177,shortname=mixed $DEVICE /boot || abort "cannot mount $DEVICE"
mount -v -t vfat -o auto,rw,flush,noatime,nodiratime,dmask=77,fmask=177,shortname=mixed $DEVICE /boot || abort "cannot mount $DEVICE"
# check initial files used to boot
bzcheck () {
bzcheck(){
local BZFILE=$1
if [[ -f /boot/config/skipbzcheck ]]; then
echo "Skipping $BZFILE checksum verification"
return
fi
echo "Verifying $BZFILE checksum ..."
[[ ! -f "/boot/$BZFILE" ]] && abort "$BZFILE not present"
[[ -f "/boot/$BZFILE" ]] || abort "$BZFILE not present"
local BZFILECHK="$BZFILE.sha256"
[[ ! -f "/boot/$BZFILECHK" ]] && abort "$BZFILECHK not present"
local SUM1=$(/bin/sha256sum /boot/$BZFILE)
local SUM2=$(/bin/cat /boot/$BZFILECHK)
[[ "${SUM1:0:63}" != "${SUM2:0:63}" ]] && abort "$BZFILE checksum error"
[[ -f "/boot/$BZFILECHK" ]] || abort "$BZFILECHK not present"
local HASH1=$(/bin/sha256sum /boot/$BZFILE)
local HASH2=$(/bin/cat /boot/$BZFILECHK)
[[ ${HASH1:0:64} != ${HASH2:0:64} ]] && abort "$BZFILE checksum error"
}
bzmount () {
bzmount(){
local BZFILE=$1
local MNTDIR=$2
bzcheck $BZFILE
/bin/mkdir -p /$MNTDIR
/sbin/mount -v -r -t squashfs /boot/$BZFILE /$MNTDIR || abort "cannot mount $BZFILE"
mkdir -p /$MNTDIR
mount -v -r -t squashfs /boot/$BZFILE /$MNTDIR || abort "cannot mount $BZFILE"
# setup an overlayfs
/bin/mkdir -p /var/local/overlay/$MNTDIR
/bin/mkdir -p /var/local/overlay-work/$MNTDIR
/sbin/mount -v -t overlay overlay -o lowerdir=/$MNTDIR,upperdir=/var/local/overlay/$MNTDIR,workdir=/var/local/overlay-work/$MNTDIR /$MNTDIR
mkdir -p /var/local/overlay/$MNTDIR
mkdir -p /var/local/overlay-work/$MNTDIR
mount -v -t overlay overlay -o lowerdir=/$MNTDIR,upperdir=/var/local/overlay/$MNTDIR,workdir=/var/local/overlay-work/$MNTDIR /$MNTDIR
}
if [[ $UNRAIDROOT == "" ]]; then
bzcheck "bzimage"
@@ -129,28 +132,28 @@ if [[ $UNRAIDROOT == "" ]]; then
bzmount "bzfirmware" "usr"
# now that /usr is mounted make /etc/rc.d a symlink
/bin/rm -r /etc/rc.d
/bin/ln -s /usr/local/etc/rc.d /etc
rm -rf /etc/rc.d
ln -sf /usr/local/etc/rc.d /etc
# move /var/log to a tmpfs
/bin/mv /var/log/* /var/empty
/sbin/mount -t tmpfs -o size=128m,mode=0755 tmpfs /var/log
/bin/mv /var/empty/* /var/log
mv -f /var/log/* /var/empty
mount -t tmpfs -o size=128m,mode=0755 tmpfs /var/log
mv -f /var/empty/* /var/log
else
echo "Checking root filesystem"
/sbin/fsck -C -a $UNRAIDROOT
fsck -C -a $UNRAIDROOT
RETVAL=$?
[[ $RETVAL -ge 2 ]] && abort "fsck failed with return value $RETVAL"
# Remount the root filesystem in read-write mode
echo "Remounting $UNRAIDROOT with read-write enabled."
/sbin/mount -w -v -n -o remount /
mount -w -v -n -o remount /
RETVAL=$?
[[ $RETVAL -gt 0 ]] && abort "failed to remount $UNRAIDROOT r/w with return value $RETVAL"
fi
# invoke testing hook
if [[ -f /boot/config/rc.S.extra ]]; then
source /boot/config/rc.S.extra
. /boot/config/rc.S.extra
fi
# and continue in separate script
source /etc/rc.d/rc.S.cont
. /etc/rc.d/rc.S.cont
+69 -68
View File
@@ -1,19 +1,20 @@
#!/bin/bash
#
# /etc/rc.d/rc.S: System initialization script (continuation)
# script: rc.S.cont
#
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
# LimeTech - Modified for Unraid OS
#
# System initialization script (continuation)
# source'ed by rc.S
# Mostly written by: Patrick J. Volkerding, <volkerdi@slackware.com>
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# limetech - bind selected devices to vfio-pci
/usr/local/sbin/vfio-pci 1> /var/log/vfio-pci 2> /var/log/vfio-pci-errors
# LimeTech - bind selected devices to vfio-pci
/usr/local/sbin/vfio-pci 1>/var/log/vfio-pci 2>/var/log/vfio-pci-errors
# Run the kernel module script. This updates the module dependencies and
# Run the kernel module script. This updates the module dependencies and
# also supports manually loading kernel modules through rc.modules.local.
if [ -x /etc/rc.d/rc.modules ]; then
if [[ -x /etc/rc.d/rc.modules ]]; then
/etc/rc.d/rc.modules
fi
@@ -25,33 +26,33 @@ fi
# device nodes that you need in the /dev directory. Even USB and IEEE1394
# devices will need to have the modules loaded by hand if udev is not used.
# So use it. :-)
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems ; then
if ! grep -wq nohotplug /proc/cmdline ; then
if [ -x /etc/rc.d/rc.udev ]; then
if grep -wq sysfs /proc/mounts && grep -q devtmpfs /proc/filesystems; then
if ! grep -wq nohotplug /proc/cmdline; then
if [[ -x /etc/rc.d/rc.udev ]]; then
/etc/rc.d/rc.udev start
fi
fi
fi
# Mount Control Groups filesystem interface:
if grep -wq cgroup /proc/filesystems ; then
if grep -wq cgroup /proc/filesystems; then
# Christoph H. - Check if unraidcgroup1 is passed over in command line
if grep -wq unraidcgroup1 /proc/cmdline ; then
if [ -d /sys/fs/cgroup ]; then
if grep -wq unraidcgroup1 /proc/cmdline; then
if [[ -d /sys/fs/cgroup ]]; then
# See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
# Check if we have some tools to autodetect the available cgroup controllers
if [ -x /bin/cut -a -x /bin/tail ]; then
if [[ -x /bin/cut && -x /bin/tail ]]; then
# Mount a tmpfs as the cgroup filesystem root
mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
# Autodetect available controllers and mount them in subfolders
controllers="$(/bin/cut -f 1 /proc/cgroups | /bin/tail -n +2)"
for i in $controllers; do
CONTROLLERS="$(cut -f 1 /proc/cgroups | tail -n +2)"
for i in $CONTROLLERS; do
mkdir /sys/fs/cgroup/$i
mount -t cgroup -o $i $i /sys/fs/cgroup/$i
done
unset i controllers
unset i CONTROLLERS
# Eric S. figured out this needs to go here...
echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy
echo 1 >/sys/fs/cgroup/memory/memory.use_hierarchy
else
# We can't use autodetection so fall back mounting them all together
mount -t cgroup cgroup /sys/fs/cgroup
@@ -61,7 +62,7 @@ if grep -wq cgroup /proc/filesystems ; then
mount -t cgroup cgroup /dev/cgroup
fi
else
if [ -d /sys/fs/cgroup ]; then
if [[ -d /sys/fs/cgroup ]]; then
# See https://docs.kernel.org/admin-guide/cgroup-v2.html (section Mounting)
# Mount a tmpfs as the cgroup2 filesystem root
mount -t tmpfs -o mode=0755,size=8M cgroup_root /sys/fs/cgroup
@@ -77,7 +78,7 @@ fi
mount /hugetlbfs
# Enable swapping:
/sbin/swapon -a 2> /dev/null
swapon -a 2>/dev/null
# Set the tick and frequency for the system clock.
# Default values are: TICK=10000 and FREQ=0
@@ -85,7 +86,7 @@ TICK=10000
FREQ=0
# If there's a /etc/default/adjtimex config file, source it to override
# the default TICK and FREQ:
if [ -r /etc/default/adjtimex ]; then
if [[ -r /etc/default/adjtimex ]]; then
. /etc/default/adjtimex
fi
if /sbin/adjtimex --tick $TICK --frequency $FREQ; then
@@ -95,20 +96,20 @@ else
fi
# Set the system time from the hardware clock using hwclock --hctosys.
if [ -x /sbin/hwclock ]; then
if [[ -x /sbin/hwclock ]]; then
# Check for a broken motherboard RTC clock (where ioports for rtc are
# unknown) to prevent hwclock causing a hang:
if ! grep -q " : rtc" /proc/ioports ; then
CLOCK_OPT="--directisa"
fi
if [ /etc/adjtime -nt /etc/hardwareclock ]; then
if grep -q "^LOCAL" /etc/adjtime ; then
if [[ /etc/adjtime -nt /etc/hardwareclock ]]; then
if grep -q "^LOCAL" /etc/adjtime; then
echo -n "Setting system time from the hardware clock (localtime): "
else
echo -n "Setting system time from the hardware clock (UTC): "
fi
/sbin/hwclock $CLOCK_OPT --hctosys
elif grep -wq "^localtime" /etc/hardwareclock 2> /dev/null ; then
elif grep -wq "^localtime" /etc/hardwareclock 2>/dev/null; then
echo -n "Setting system time from the hardware clock (localtime): "
/sbin/hwclock $CLOCK_OPT --localtime --hctosys
else
@@ -119,49 +120,49 @@ if [ -x /sbin/hwclock ]; then
fi
# Configure ISA Plug-and-Play devices:
if [ -r /etc/isapnp.conf ]; then
if [ -x /sbin/isapnp ]; then
if [[ -r /etc/isapnp.conf ]]; then
if [[ -x /sbin/isapnp ]]; then
/sbin/isapnp /etc/isapnp.conf
fi
fi
# Configure kernel parameters:
if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then
if [[ -x /sbin/sysctl && -r /etc/sysctl.conf ]]; then
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
/sbin/sysctl -e --system
elif [ -x /sbin/sysctl ]; then
elif [[ -x /sbin/sysctl ]]; then
echo "Configuring kernel parameters: /sbin/sysctl -e --system"
# Don't say "Applying /etc/sysctl.conf" or complain if the file doesn't exist
/sbin/sysctl -e --system 2> /dev/null | grep -v "Applying /etc/sysctl.conf"
/sbin/sysctl -e --system 2>/dev/null | grep -v "Applying /etc/sysctl.conf"
fi
# Clean up some temporary files:
rm -f /etc/nologin /etc/dhcpc/*.pid /etc/forcefsck /etc/fastboot \
/var/state/saslauthd/saslauthd.pid /tmp/.Xauth* 1> /dev/null 2> /dev/null
rm -rf /tmp/{kde-[a-zA-Z]*,ksocket-[a-zA-Z]*,hsperfdata_[a-zA-Z]*,plugtmp*}
if [ -d /var/lib/pkgtools/setup/tmp ]; then
if [[ -d /var/lib/pkgtools/setup/tmp ]]; then
( cd /var/lib/pkgtools/setup/tmp && rm -rf * )
elif [ -d /var/log/setup/tmp ]; then
elif [[ -d /var/log/setup/tmp ]]; then
( cd /var/log/setup/tmp && rm -rf * )
fi
# Clear /var/lock/subsys:
if [ -d /var/lock/subsys ]; then
if [[ -d /var/lock/subsys ]]; then
rm -f /var/lock/subsys/*
fi
# Start libcgroup services:
if [ -x /etc/rc.d/rc.cgconfig -a -x /etc/rc.d/rc.cgred -a -d /sys/fs/cgroup ]; then
/etc/rc.d/rc.cgconfig start ; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf"
if [[ -x /etc/rc.d/rc.cgconfig && -x /etc/rc.d/rc.cgred && -d /sys/fs/cgroup ]]; then
/etc/rc.d/rc.cgconfig start; echo " /usr/sbin/cgconfigparser -l /etc/cgconfig.conf"
/etc/rc.d/rc.cgred start
fi
# Create /tmp/{.ICE-unix,.X11-unix} if they are not present:
if [ ! -e /tmp/.ICE-unix ]; then
if [[ ! -e /tmp/.ICE-unix ]]; then
mkdir -p /tmp/.ICE-unix
chmod 1777 /tmp/.ICE-unix
fi
if [ ! -e /tmp/.X11-unix ]; then
if [[ ! -e /tmp/.X11-unix ]]; then
mkdir -p /tmp/.X11-unix
chmod 1777 /tmp/.X11-unix
fi
@@ -175,7 +176,7 @@ chmod 664 /var/run/utmp
mkdir -p /var/run/faillock
# If there are SystemV init scripts for this runlevel, run them.
if [ -x /etc/rc.d/rc.sysvinit ]; then
if [[ -x /etc/rc.d/rc.sysvinit ]]; then
/etc/rc.d/rc.sysvinit
fi
@@ -183,61 +184,61 @@ fi
# CAREFUL! This can make some systems hang if the rc.serial script isn't
# set up correctly. If this happens, you may have to edit the file from a
# boot disk, and/or set it as non-executable:
if [ -x /etc/rc.d/rc.serial ]; then
if [[ -x /etc/rc.d/rc.serial ]]; then
/etc/rc.d/rc.serial start
fi
# limetech - let's keep this on the USB flash
# LimeTech - let's keep this on the USB flash
## Carry an entropy pool between reboots to improve randomness.
mkdir -p /var/lib/seedrng
chmod 600 /var/lib/seedrng
cp /boot/config/random-seed /var/lib/seedrng/seed.no-credit 2>/dev/null
/usr/sbin/seedrng
# limetech - restore hostname from ident.cfg file on flash and ensure hostname is
# LimeTech - restore hostname from ident.cfg file on flash and ensure hostname is
# defined as localhost alias in /etc/hosts (this lets wins name resolution work)
NAME="Tower"
timeZone="America/Los_Angeles"
if [ -r /boot/config/ident.cfg ]; then
source <(/usr/bin/fromdos < /boot/config/ident.cfg)
TIMEZONE="America/Los_Angeles"
if [[ -r /boot/config/ident.cfg ]]; then
. <(fromdos </boot/config/ident.cfg)
NAME=${NAME//[^a-zA-Z\-\.0-9]/\-}
fi
echo "$NAME" >/etc/HOSTNAME
echo "# Generated" >/etc/hosts
echo "127.0.0.1 $NAME localhost" >>/etc/hosts
echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
echo "127.0.0.1 $NAME localhost" >>/etc/hosts
echo "54.149.176.35 keys.lime-technology.com" >>/etc/hosts
# limetech - restore the configured timezone
if [ "$timeZone" = "custom" ]; then
# LimeTech - restore the configured timezone
if [[ $TIMEZONE == custom ]]; then
ln -sf /boot/config/timezone /etc/localtime
else
ln -sf /usr/share/zoneinfo/$timeZone /etc/localtime
ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
# limetech - restore password files stored on flash
if [ -r /boot/config/passwd ]; then
while IFS=: read -r username password userid groupid comment homedir cmdshell ; do
if [[ $username = root ]]; then
sed -i "s|^root:.*|root:x:0:0:$comment:/root:/bin/bash|" /etc/passwd
# LimeTech - restore password files stored on flash
if [[ -r /boot/config/passwd ]]; then
while IFS=: read -r USERNAME PASSWORD USERID GROUPID COMMENT HOMEDIR CMDSHELL; do
if [[ $USERNAME == root ]]; then
sed -i "s|^root:.*|root:x:0:0:$COMMENT:/root:/bin/bash|" /etc/passwd
fi
if (( userid >= 1000 )); then
echo "$username:x:$userid:$groupid:$comment:/:/bin/false" >> /etc/passwd
if (( USERID >= 1000 )); then
echo "$USERNAME:x:$USERID:$GROUPID:$COMMENT:/:/bin/false" >> /etc/passwd
fi
done < /boot/config/passwd
if [ -r /boot/config/shadow ]; then
cp /boot/config/shadow /etc
done </boot/config/passwd
if [[ -r /boot/config/shadow ]]; then
cp -f /boot/config/shadow /etc
chmod 600 /etc/shadow
fi
fi
/usr/sbin/pwconv
if [ -r /boot/config/smbpasswd ]; then
cp /boot/config/smbpasswd /var/lib/samba/private
if [[ -r /boot/config/smbpasswd ]]; then
cp -f /boot/config/smbpasswd /var/lib/samba/private
fi
if [ -r /boot/config/secrets.tdb ]; then
cp /boot/config/secrets.tdb /var/lib/samba/private
if [[ -r /boot/config/secrets.tdb ]]; then
cp -f /boot/config/secrets.tdb /var/lib/samba/private
fi
# limetech - restore custom rsyslog.conf config file from flash if present
if [ -r /boot/config/rsyslog.conf ]; then
/usr/bin/fromdos </boot/config/rsyslog.conf >/etc/rsyslog.conf
# LimeTech - restore custom rsyslog.conf config file from flash if present
if [[ -r /boot/config/rsyslog.conf ]]; then
fromdos </boot/config/rsyslog.conf >/etc/rsyslog.conf
fi