diff --git a/data/translations/danish.trans b/data/translations/danish.trans index f487bb1..e048b89 100644 --- a/data/translations/danish.trans +++ b/data/translations/danish.trans @@ -486,3 +486,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! \ No newline at end of file diff --git a/data/translations/dutch.trans b/data/translations/dutch.trans index 259dfe1..3489b71 100644 --- a/data/translations/dutch.trans +++ b/data/translations/dutch.trans @@ -483,3 +483,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! \ No newline at end of file diff --git a/data/translations/english.trans b/data/translations/english.trans index b7512cf..d8ea096 100644 --- a/data/translations/english.trans +++ b/data/translations/english.trans @@ -481,3 +481,12 @@ _AddPkgs="Choose any extra packages you would like to add.\nSearch packages by t _ExtraTitle="Extra Packages" _ExtraBody="Would you like to add any additional packages to your installation?" +_TweaksMenuTitle="System tweaks" +_PerfBody="Settings to configure your system to a specific workload" +_TweaksBody="Various configuration options" +_PerfMenu="Performance" +_SetSchd="I/O schedulers" +_SetSwap="Swap configuration" +_AutologEnable="Enable automatic login" +_HibrnEnable="Enable hibernation" + diff --git a/data/translations/french.trans b/data/translations/french.trans index 340f399..6dde5f8 100644 --- a/data/translations/french.trans +++ b/data/translations/french.trans @@ -487,3 +487,12 @@ Appuyez sur Tab pour sélectionner plusieurs paquets puis validez avec Entrée." #Extra _ExtraTitle="Paquets additionnels" _ExtraBody="Voulez-vous ajouter des paquets additionnels à votre installation ?" + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! \ No newline at end of file diff --git a/data/translations/german.trans b/data/translations/german.trans index 4338753..9f7c26a 100644 --- a/data/translations/german.trans +++ b/data/translations/german.trans @@ -476,3 +476,12 @@ _AddPkgs="Wähle zusätzliche Pakete zur Installation.\nSuchen durch Eingabe des #Extra _ExtraTitle="Zusätzliche Pakete" _ExtraBody="Möchten Sie der Installation zusätzliche Pakete hinzufügen?" + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! \ No newline at end of file diff --git a/data/translations/hungarian.trans b/data/translations/hungarian.trans index 3c5bea5..8ec56b4 100644 --- a/data/translations/hungarian.trans +++ b/data/translations/hungarian.trans @@ -484,3 +484,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/italian.trans b/data/translations/italian.trans index 5cb2459..efd2409 100644 --- a/data/translations/italian.trans +++ b/data/translations/italian.trans @@ -483,3 +483,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/polish.trans b/data/translations/polish.trans index 46b7302..3c38275 100644 --- a/data/translations/polish.trans +++ b/data/translations/polish.trans @@ -483,3 +483,12 @@ Wciśnij [tab], by zaznaczyć wiele pakietów i [enter], by kontynuować." #Extra _ExtraTitle="Dodatkowe pakiety" _ExtraBody="Czy chciałbyś dodać jakieś dodatkowe pakiety do swojej instalacji?" + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/portuguese.trans b/data/translations/portuguese.trans index c9c169f..1a59801 100644 --- a/data/translations/portuguese.trans +++ b/data/translations/portuguese.trans @@ -482,3 +482,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/portuguese_brasil.trans b/data/translations/portuguese_brasil.trans index fc1dce0..0594614 100644 --- a/data/translations/portuguese_brasil.trans +++ b/data/translations/portuguese_brasil.trans @@ -485,3 +485,12 @@ Pressione tab para selecionar multiplos pacotes e prosseguir com Enter." #Extra _ExtraTitle="Pacotes extra" _ExtraBody="Você gostaria de adicionar qualquer pacote a mais em sua instalação?" + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/russian.trans b/data/translations/russian.trans index 3eeb79d..a96b416 100644 --- a/data/translations/russian.trans +++ b/data/translations/russian.trans @@ -485,3 +485,12 @@ _AddPkgs="Выберите любые дополнительные пакеты, #Extra _ExtraTitle="Дополнительные пакеты" _ExtraBody="Хотели бы вы добавить какие-либо дополнительные пакеты для установки?" + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/data/translations/spanish.trans b/data/translations/spanish.trans index ba65ef1..8c6fdb3 100644 --- a/data/translations/spanish.trans +++ b/data/translations/spanish.trans @@ -483,3 +483,12 @@ Press tab to select multiple packages and proceed with Enter." # translate me ! #Extra _ExtraTitle="Extra packages" # translate me ! _ExtraBody="Would you like to add any additional packages to your installation?" # translate me ! + +_TweaksMenuTitle="System tweaks" # translate me ! +_PerfBody="Settings to configure your system to a specific workload" # translate me ! +_TweaksBody="Various configuration options" # translate me ! +_PerfMenu="Performance" # translate me ! +_SetSchd="I/O schedulers" # translate me ! +_SetSwap="Swap configuration" # translate me ! +_AutologEnable="Enable automatic login" # translate me ! +_HibrnEnable="Enable hibernation" # translate me ! diff --git a/lib/util-advanced.sh b/lib/util-advanced.sh index 34a32ae..dc3265f 100644 --- a/lib/util-advanced.sh +++ b/lib/util-advanced.sh @@ -649,3 +649,87 @@ security_menu() { esac done } + +enable_console_logging() { + echo "ForwardToConsole=yes +TTYPath=/dev/tty12" >> /mnt/etc/systemd/jounald.conf + sed -i '/MaxLevelConsole/ s/#//' /mnt/etc/systemd/journald.conf +} + +enable_hibernation() { +if DIALOG " Hibernation setup " --yesno "\nAre you sure you want to enable hibernation automatically? \n " 0 0; then + if ! [[ -e /mnt/etc/fstab ]]; then + generate_fstab + fi + basestrap ${MOUNTPOINT} "hibernator" + arch_chroot "hibernator" 2>$ERR + check_for_error "Running hibernator" $? + [[ $? == 0 ]] && DIALOG " Hibernation setup " --infobox "\nHibernator was successfully run \n " 0 0 +else + return 0 +fi +} + +enable_autologin() { + dm=$(file /mnt/etc/systemd/system/display-manager.service 2>/dev/null | awk -F'/' '{print $NF}' | cut -d. -f1) + [[ -z $dm ]] && dm=xlogin + if DIALOG " Autologin setup " --yesno "\nThis option enables autologin using $dm.\n\nProceed? \n " 0 0; then + #detect displaymanager + if [[ $(echo /mnt/home/* | xargs -n1 | wc -l) == 1 ]]; then + autologin_user=$(echo /mnt/home/* | cut -d/ -f4) + else + autologin_user=$(echo /mnt/home/* | cut -d/ -f4 | fzf --reverse --prompt="user> " --header="Choose the user to automatically log in") + fi + #enable autologin + case "$(echo $dm)" in + gdm) sed -i "s/^AutomaticLogin=*/AutomaticLogin=$autologin_user/g" /mnt/etc/gdm/custom.conf + sed -i 's/^AutomaticLoginEnable=*/AutomaticLoginEnable=true/g' /mnt/etc/gdm/custom.conf + sed -i 's/^TimedLoginEnable=*/TimedLoginEnable=true/g' /mnt/etc/gdm/custom.conf + sed -i 's/^TimedLogin=*/TimedLoginEnable=$autologin_user/g' /mnt/etc/gdm/custom.conf + sed -i 's/^TimedLoginDelay=*/TimedLoginDelay=0/g' /mnt/etc/gdm/custom.conf + ;; + lightdm) sed -i "s/^#autologin-user=/autologin-user=$autologin_user/" /mnt/etc/lightdm/lightdm.conf + sed -i 's/^#autologin-user-timeout=0/autologin-user-timeout=0/' /mnt/etc/lightdm/lightdm.conf + arch_chroot "groupadd -r autologin" + arch_chroot "gpasswd -a $autologin_user autologin" + ;; + sddm) xsession=$(echo /usr/share/xsessions/* | xargs -n1 | head -n1) + [[ -e /mnt/etc/sddm.conf ]] || arch_chroot "sddm --example-config > /etc/sddm.conf" + sed -i "s/^User=/User=$autologin_user/g" /mnt/etc/sddm.conf + sed -i "s/^Session/Session=$xsession/g" /mnt/etc/sddm.conf + ;; + lxdm) sed -i "s/^# autologin=dgod/autologin=$autologin_user/g" /mnt/etc/lxdm/lxdm.conf + ;; + *) basestrap ${MOUNTPOINT} "xlogin" + arch_chroot "systemctl enable xlogin@${autologin_user}" + ;; + esac +fi +} + +set_schedulers() { + [[ -e /mnt/etc/udev/rules.d/60-ioscheduler.rules ]] || \ + echo '# set scheduler for non-rotating disks +# noop and deadline are recommended for non-rotating disks +# for rotational disks, cfq gives better performance and bfq-sq more responsive desktop environment +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline" +# set scheduler for rotating disks +ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq-sq"' > /mnt/etc/udev/rules.d/60-ioscheduler.rules + nano /mnt/etc/udev/rules.d/60-ioscheduler.rules +} + +set_swappiness() { + [[ -e /mnt/etc/sysctl.d/99-sysctl.conf ]] || \ + echo 'vm.swappiness = 10 +vm.vfs_cache_pressure = 50 +#vm.dirty_ratio = 3' > /mnt/etc/sysctl.d/99-sysctl.conf + nano /mnt/etc/sysctl.d/99-sysctl.conf +} + +preloader() { + if DIALOG " Preload setup " --yesno "\n Enabling preload loads often used applications to ram in advance in order to start them up more quickly. \n\nProceed? \n " 0 0; then + basestrap ${MOUNTPOINT} "preload" + arch_chroot "systemctl enable preload" + fi + +} \ No newline at end of file diff --git a/lib/util-menu.sh b/lib/util-menu.sh index de7127f..d45ebba 100644 --- a/lib/util-menu.sh +++ b/lib/util-menu.sh @@ -96,11 +96,11 @@ install_core_menu() { submenu 8 DIALOG " $_InstCrMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_MMBody\n$_InstCrMenuBody\n " 0 0 8 \ "1" "$_InstBse" \ - "2" "$_InstBootldr" \ - "3" "$_ConfBseMenuTitle" \ + "2" "$_InstBootldr|>" \ + "3" "$_ConfBseMenuTitle|>" \ "4" "$_InstMulCust" \ - "5" "$_SecMenuTitle|>" \ - "6" "$_SeeConfOptTitle" \ + "5" "$_TweaksMenuTitle|>" \ + "6" "$_SeeConfOptTitle|>" \ "7" "$_ChrootTitle" \ "8" "$_Back" 2>${ANSWER} HIGHLIGHT_SUB=$(cat ${ANSWER}) @@ -114,7 +114,7 @@ install_core_menu() { ;; "4") install_cust_pkgs ;; - "5") check_base && security_menu + "5") check_base && tweaks_menu ;; "6") check_base && { type edit_configs &>/dev/null || import ${LIBDIR}/util-config.sh @@ -137,10 +137,10 @@ install_desktop_system_menu() { submenu 7 DIALOG " $_InstDsMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_MMBody\n$_InstDsMenuBody\n " 0 0 7 \ "1" "$_InstDEStable|>" \ - "2" "$_InstBootldr" \ - "3" "$_ConfBseMenuTitle" \ - "4" "$_SecMenuTitle|>" \ - "5" "$_SeeConfOptTitle" \ + "2" "$_InstBootldr|>" \ + "3" "$_ConfBseMenuTitle|>" \ + "4" "$_TweaksMenuTitle|>" \ + "5" "$_SeeConfOptTitle|>" \ "6" "$_ChrootTitle" \ "7" "$_Back" 2>${ANSWER} HIGHLIGHT_SUB=$(cat ${ANSWER}) @@ -152,7 +152,7 @@ install_desktop_system_menu() { ;; "3") check_base && config_base_menu ;; - "4") check_base && security_menu + "4") check_base && tweaks_menu ;; "5") check_base && { type edit_configs &>/dev/null || import ${LIBDIR}/util-config.sh @@ -176,10 +176,10 @@ install_custom_menu() { DIALOG " $_InstCsMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_InstCsMenuBody\n " 0 0 9 \ "1" "$_InstBse" \ "2" "$_InstDE|>" \ - "3" "$_InstBootldr" \ - "4" "$_ConfBseMenuTitle" \ + "3" "$_InstBootldr|>" \ + "4" "$_ConfBseMenuTitle|>" \ "5" "$_InstMulCust" \ - "6" "$_SecMenuTitle|>" \ + "6" "$_TweaksMenuTitle|>" \ "7" "$_SeeConfOptTitle" \ "8" "$_ChrootTitle" \ "9" "$_Back" 2>${ANSWER} @@ -196,7 +196,7 @@ install_custom_menu() { ;; "5") install_cust_pkgs ;; - "6") check_base && security_menu + "6") check_base && tweaks_menu ;; "7") check_base && { type edit_configs &>/dev/null || import ${LIBDIR}/util-config.sh @@ -480,3 +480,67 @@ install_graphics_menu() { ;; esac } + +tweaks_menu() { + local PARENT="$FUNCNAME" + declare -i loopmenu=1 + while ((loopmenu)); do + submenu 7 + DIALOG " $_TweaksMenuTitle " --default-item ${HIGHLIGHT_SUB} --menu "\n$_TweaksBody " 0 0 5 \ + "1" "$_AutologEnable" \ + "2" "$_HibrnEnable" \ + "3" "$_PerfMenu|>" \ + "4" "$_SecMenuTitle|>" \ + "5" "$_Back" 2>${ANSWER} + HIGHLIGHT_SUB=$(cat ${ANSWER}) + + case $(cat ${ANSWER}) in + "1") enable_autologin + ;; + "2") enable_hibernation + ;; + "3") performance_menu + ;; + "4") security_menu + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} + +performance_menu() { + local PARENT="$FUNCNAME" + declare -i loopmenu=1 + while ((loopmenu)); do + submenu 3 + DIALOG " $_PerfMenu " --default-item ${HIGHLIGHT_SUB} --menu "\n$_PerfBody\n " 0 0 4 \ + "1" "$_SetSchd" \ + "2" "$_SetSwap" \ + "3" "Preload" \ + "4" "$_Back" 2>${ANSWER} + HIGHLIGHT_SUB=$(cat ${ANSWER}) + + case $(cat ${ANSWER}) in + "1") set_schedulers + ;; + "2") set_swappiness + ;; + "3") preloader + ;; + *) loopmenu=0 + return 0 + ;; + esac + done +} + +_TweaksMenuTitle="System tweaks" +_PerfBody="Settings to configure your system to a specific workload" +_TweaksBody="Various configuration options" +_PerfMenu="Performance" +_SetSchd="I/O schedulers" +_SetSwap="Swap configuration" +_AutologEnable="Enable automatic login" +_HibrnEnable="Enable hibernation" \ No newline at end of file