diff --git a/emhttp/plugins/dynamix/Console.page b/emhttp/plugins/dynamix/Console.page new file mode 100644 index 000000000..8ec1ad7f1 --- /dev/null +++ b/emhttp/plugins/dynamix/Console.page @@ -0,0 +1,108 @@ +Menu="UserPreferences" +Type="xmenu" +Title="Console Settings" +Icon="terminal" +Tag="terminal" +--- + + +// selected keyboard layouts +$keymaps = [ + 'by' => 'Belarusian', + 'be-latin1' => 'Belgium (French)', + 'br-abnt' => 'Brazilian', + 'cz' => 'Czech', + 'dk' => 'Danish', + 'nl' => 'Dutch', + 'uk' => 'English (United Kingdom)', + 'us' => 'English (United States)', + 'es' => 'EspaƱol', + 'et' => 'Estonian', + 'fi' => 'Finnish', + 'fr' => 'French', + 'de-latin1-nodeadkeys' => 'German', + 'gr' => 'Greek', + 'hu' => 'Hungarian', + 'is-latin1' => 'Icelandic', + 'it' => 'Italian', + 'il' => 'Israelian', + 'lt' => 'Lithuanian', + 'mk' => 'Macedonian', + 'no' => 'Norwegian', + 'pl' => 'Polish', + 'pt' => 'Portuguese', + 'ro' => 'Romanian', + 'ru' => 'Russian', + 'sk-qwertz' => 'Slovakian', + 'se-latin1' => 'Swedish', + 'de_CH-latin1' => 'Swiss (German)', + 'fr_CH-latin1' => 'Swiss (French)', + 'tr_q-latin5' => 'Turkish' +]; + +// time-out values in minutes +$minutes = [1,5,10,15,30,45,60]; +?> + + +
diff --git a/emhttp/plugins/dynamix/scripts/console b/emhttp/plugins/dynamix/scripts/console new file mode 100755 index 000000000..b0267f701 --- /dev/null +++ b/emhttp/plugins/dynamix/scripts/console @@ -0,0 +1,25 @@ +#!/bin/bash +# Load keyboard layout for local console +loadkeys -q $1 + +# Set screenblank and powersave for local console +if [[ $2 =~ ^[0-9]+$ ]]; then + TERM=linux setterm --blank=$2 --powersave off >/dev/console +elif [[ $2 == disabled ]]; then + TERM=linux setterm --blank=0 --powersave off >/dev/console +else + TERM=linux setterm --blank 15 --powersave powerdown --powerdown 60 >/dev/console +fi + +# Enable or disable persistent bash history +if [[ $3 == 1 ]]; then + if [[ ! -d /boot/config/history ]]; then + mkdir -p /boot/config/history + fi + rm -f /root/.bash_history + touch /boot/config/history/bash_history + ln -s /boot/config/history/bash_history /root/.bash_history +else + rm -f /boot/config/history/bash_history /root/.bash_history + touch /root/.bash_history +fi diff --git a/etc/rc.d/rc.keymap b/etc/rc.d/rc.keymap new file mode 100755 index 000000000..394872f38 --- /dev/null +++ b/etc/rc.d/rc.keymap @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Load a keyboard map. More maps are in /usr/share/kbd/keymaps. + +# Read Unraid config file and set kayboard layout if found. +KBD_LAYOUT=$(grep "keyboard_layout" /boot/config/plugins/dynamix/dynamix.cfg 2>/dev/null | cut -d'=' -f2 | sed 's/"//g') +if [[ ! -z $KBD_LAYOUT ]]; then + loadkeys $KBD_LAYOUT >/dev/null 2>&1 +fi diff --git a/etc/rc.d/rc.local b/etc/rc.d/rc.local index b841af7cc..3e10f5a23 100755 --- a/etc/rc.d/rc.local +++ b/etc/rc.d/rc.local @@ -150,6 +150,17 @@ for LANGUAGE in $CONFIG/plugins/lang-*.xml; do done shopt -u nullglob +# Enable persistent bash history +PERSISTENT_BASH_HISTORY=$(grep "persist_bash_history" /boot/config/plugins/dynamix/dynamix.cfg 2>/dev/null | cut -d'=' -f2 | sed 's/"//g') +if [[ $PERSISTENT_BASH_HISTORY == 1 ]]; then + if [[ ! -d /boot/config/history ]]; then + mkdir -p /boot/config/history + fi + rm -f /root/.bash_history + touch /boot/config/history/bash_history + ln -s /boot/config/history/bash_history /root/.bash_history +fi + # Invoke the 'go' script if [[ -f $CONFIG/go ]]; then log "Starting go script" diff --git a/etc/rc.d/rc.setterm b/etc/rc.d/rc.setterm index 6b4a1137a..aa5a650ab 100755 --- a/etc/rc.d/rc.setterm +++ b/etc/rc.d/rc.setterm @@ -1,16 +1,23 @@ #!/bin/bash # -# script: rc.setterm -# # This file provides the command line for the setterm utility to set the -# terminal attributes (primarily used for screen blanking and power management). +# terminal attributes (primarily used for screen blanking and power +# management). # # LimeTech - modified for Unraid OS # Bergware - modified for Unraid OS, October 2023 -# Screen blanks after 15 minutes idle time, and powers down in one hour -# if the kernel supports APM or ACPI power management (default setting): -setterm -blank 15 -powersave powerdown -powerdown 60 +# Read Unraid config file and set timout or fall back to default +SCREEN_BLANK=$(grep "screen_blank" /boot/config/plugins/dynamix/dynamix.cfg 2>/dev/null | cut -d'=' -f2 | sed 's/"//g') +if [[ $SCREEN_BLANK =~ ^[0-9]+$ ]]; then + setterm --blank $SCREEN_BLANK --powersave off +elif [[ $SCREEN_BLANK == disabled ]]; then + setterm --blank=0 --powersave off +else + # Screen blanks after 15 minutes idle time, and powers down in one hour + # if the kernel supports APM or ACPI power management (default setting): + setterm --blank 15 --powersave powerdown --powerdown 60 +fi # Screen does not blank or use power management features: -# setterm -blank 0 -powersave off -powerdown 0 +#setterm -blank 0 -powersave off -powerdown 0