scripts dutchification - batch 1

This commit is contained in:
bergware
2023-10-01 21:10:20 +02:00
parent dfbe59fbe3
commit 0e18d59137

View File

@@ -1,27 +1,34 @@
#!/bin/bash
#
# /etc/rc.d/rc.local: Local system initialization script.
# script: rc.local
#
# Local system initialization script.
# Put any local startup commands in here. Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.
#
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, October 2023
# run & log functions
. /etc/rc.d/rc.runlog
# irqbalance daemon distributes interrupts over processors and cores
#if [ -x /usr/sbin/irqbalance ]; then
# /usr/sbin/irqbalance
#fi
# if [ -x /usr/sbin/irqbalance ]; then
# /usr/sbin/irqbalance
# fi
# reclaim 1.6M of microcode files that are no longer needed
rm -rf /kernel
# 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 mcelog
if [ -x /etc/rc.d/rc.mcelog ]; then
if [[ -x /etc/rc.d/rc.mcelog ]]; then
/etc/rc.d/rc.mcelog start
fi
@@ -44,7 +51,7 @@ mkdir -p $CONFIG/ssl/certs
# upgrade network configuration (if needed) and (re)generates our welcome text
if [[ -x /usr/local/sbin/create_network_ini ]]; then
/usr/local/sbin/create_network_ini init >/dev/null 2>&1 &
/usr/local/sbin/create_network_ini init 1>/dev/null 2>/dev/null &
fi
# Needed by dynamix
@@ -62,99 +69,100 @@ if [[ -x /usr/local/sbin/monitor_nchan ]]; then
/usr/local/sbin/monitor_nchan
fi
# First boot following unRAID Server OS update: delete plugin file
# First boot following Unraid Server OS update: delete plugin file
rm -f /boot/plugins/unRAIDServer.plg
rm -f $CONFIG/plugins/unRAIDServer.plg
# These plugins are now integrated in the OS or obsolete and may interfere
Obsolete="vfio.pci dynamix.wireguard dynamix.ssd.trim dynamix.file.manager gui.search"
for Plugin in $Obsolete ; do
if [[ -e $CONFIG/plugins/$Plugin.plg ]]; then
logger "moving obsolete plugin $Plugin.plg to $CONFIG/plugins-error"
OBSOLETE="vfio.pci dynamix.wireguard dynamix.ssd.trim dynamix.file.manager gui.search"
for PLUGIN in $OBSOLETE; do
if [[ -e $CONFIG/plugins/$PLUGIN.plg ]]; then
log "moving obsolete plugin $PLUGIN.plg to $CONFIG/plugins-error"
# preserve ssd-trim config
if [[ $Plugin = "dynamix.ssd.trim" ]]; then
if [[ -e $CONFIG/plugins/$Plugin/$Plugin.cfg ]]; then
if [[ $PLUGIN = "dynamix.ssd.trim" ]]; then
if [[ -e $CONFIG/plugins/$PLUGIN/$PLUGIN.cfg ]]; then
echo "[ssd]" >> $CONFIG/plugins/dynamix/dynamix.cfg
cat $CONFIG/plugins/$Plugin/$Plugin.cfg >> $CONFIG/plugins/dynamix/dynamix.cfg
cat $CONFIG/plugins/$PLUGIN/$PLUGIN.cfg >> $CONFIG/plugins/dynamix/dynamix.cfg
fi
if [[ -e $CONFIG/plugins/$Plugin/ssd-trim.cron ]]; then
mv $CONFIG/plugins/$Plugin/ssd-trim.cron $CONFIG/plugins/dynamix/ssd-trim.cron
if [[ -e $CONFIG/plugins/$PLUGIN/ssd-trim.cron ]]; then
mv $CONFIG/plugins/$PLUGIN/ssd-trim.cron $CONFIG/plugins/dynamix/ssd-trim.cron
fi
fi
mv $CONFIG/plugins/$Plugin.plg $CONFIG/plugins-error/
rm -rf $CONFIG/plugins/$Plugin
mv $CONFIG/plugins/$PLUGIN.plg $CONFIG/plugins-error/
rm -rf $CONFIG/plugins/$PLUGIN
fi
done
# uninstall obsolete plugins
#
# these plugins with these versions or older are incompatible with this version of Unraid
# if found, they will be moved from ${CONFIG}/plugins to ${CONFIG}/plugins-error
# if found, they will be moved from $CONFIG/plugins to $CONFIG/plugins-error
# in theory, newer versions will be ok
#
function obsplg {
Plugin=$1
BadVer=$2
if [[ -e "$CONFIG/plugins/$Plugin.plg" ]]; then
Ver=$(/usr/local/sbin/plugin version "$CONFIG/plugins/$Plugin.plg")
obsolete(){
local PLUGIN=$1
local BADVER=$2
if [[ -e "$CONFIG/plugins/$PLUGIN.plg" ]]; then
local VERSION=$(/usr/local/sbin/plugin version "$CONFIG/plugins/$PLUGIN.plg")
# assumes all version strings are of form YYYY.MM.DD[.letter]
if [[ "$Ver" < "$BadVer" || "$Ver" == "$BadVer" ]]; then
logger "moving obsolete plugin $Plugin.plg version $Ver to $CONFIG/plugins-error"
/usr/local/emhttp/webGui/scripts/notify -e "Plugin Removed" -s "$Plugin" -d "Plugin '$Plugin' version '$Ver' was removed as it is incompatible with this version of Unraid OS" -m "A replacement *may* be available in Community Apps" -i "alert" -l "/Plugins"
mv "$CONFIG/plugins/$Plugin.plg" "$CONFIG/plugins-error/"
if [[ $BADVER <= $VERSION ]]; then
log "moving obsolete plugin $PLUGIN.plg version $VERSION to $CONFIG/plugins-error"
/usr/local/emhttp/webGui/scripts/notify -e "Plugin Removed" -s "$PLUGIN" -d "Plugin '$PLUGIN' version '$VERSION' was removed as it is incompatible with this version of Unraid OS" -m "A replacement *may* be available in Community Apps" -i "alert" -l "/Plugins"
mv "$CONFIG/plugins/$PLUGIN.plg" "$CONFIG/plugins-error/"
# notify needs a delay between notifications
sleep 1
fi
fi
}
# Disk Location by olehj, breaks the dashboard
obsplg "disklocation-master" "2022.06.18"
obsolete "disklocation-master" "2022.06.18"
# Plex Streams by dorgan, breaks the dashboard
obsplg "plexstreams" "2022.08.31"
obsolete "plexstreams" "2022.08.31"
# Corsair PSU Statistics by Fma965, breaks the dashboard
obsplg "corsairpsu" "2021.10.05"
obsolete "corsairpsu" "2021.10.05"
# GPU Statistics by b3rs3rk, breaks the dashboard
obsplg "gpustat" "2022.11.30a"
obsolete "gpustat" "2022.11.30a"
# IPMI Tools by dmacias72, breaks the dashboard
obsplg "ipmi" "2021.01.08"
obsolete "ipmi" "2021.01.08"
# NUT - Network UPS Tools by dmacias72, breaks the dashboard
obsplg "nut" "2022.03.20"
obsolete "nut" "2022.03.20"
# Nerd Tools by dmacias72
obsplg "NerdPack" "2021.08.11"
obsolete "NerdPack" "2021.08.11"
# UPnP Monitor by ljm42, not PHP 8 compatible
obsplg "upnp-monitor" "2020.01.04c"
obsolete "upnp-monitor" "2020.01.04c"
# ZFS-Companion Monitor by campusantu, breaks the dashboard
obsplg "ZFS-companion" "2021.08.24"
obsolete "ZFS-companion" "2021.08.24"
# If "unraidsafemode" indicated, skip installing extra packages and plugins
if [[ -f /boot/unraidsafemode ]] || grep -wq unraidsafemode /proc/cmdline ; then
logger "unRAID Safe Mode (unraidsafemode) has been set"
if [[ -f /boot/unraidsafemode ]] || grep -wq unraidsafemode /proc/cmdline; then
log "Unraid Safe Mode (unraidsafemode) has been set"
else
# Install any extra packages
if [ -d /boot/extra ]; then
logger "Installing /boot/extra packages"
( cd /boot/extra ; find -maxdepth 1 -type f -exec sh -c 'upgradepkg --terse --install-new "$1" | logger' -- {} \; )
if [[ -d /boot/extra ]]; then
log "Installing /boot/extra packages"
( cd /boot/extra ; find -maxdepth 1 -type f -exec sh -c 'upgradepkg --terse --install-new "$1" | log' -- "{}" \; )
fi
# Install plugins
logger "Installing plugins"
log "Installing plugins"
shopt -s nullglob
for Plugin in $CONFIG/plugins/*.plg ; do
/usr/local/sbin/plugin install $Plugin | logger
for PLUGIN in $CONFIG/plugins/*.plg; do
/usr/local/sbin/plugin install $PLUGIN | log
done
shopt -u nullglob
fi
# Install languages
logger "Installing language packs"
log "Installing language packs"
shopt -s nullglob
for Language in $CONFIG/plugins/lang-*.xml ; do
/usr/local/sbin/language install $Language | logger
for LANGUAGE in $CONFIG/plugins/lang-*.xml; do
/usr/local/sbin/language install $LANGUAGE | log
done
shopt -u nullglob
# Invoke the 'go' script
if [ -f $CONFIG/go ]; then
logger "Starting go script"
if [[ -f $CONFIG/go ]]; then
log "Starting go script"
fromdos <$CONFIG/go >/var/tmp/go
chmod +x /var/tmp/go
/var/tmp/go