From 9976f0b2dd10fcaecbecc40efdf2fc207ce751e0 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:02:12 -0500 Subject: [PATCH 01/32] refactored software --- lib/armbian-configng/config.ng.jobs.json | 713 +++++++++++++---------- 1 file changed, 408 insertions(+), 305 deletions(-) diff --git a/lib/armbian-configng/config.ng.jobs.json b/lib/armbian-configng/config.ng.jobs.json index 65668fe7..11913353 100644 --- a/lib/armbian-configng/config.ng.jobs.json +++ b/lib/armbian-configng/config.ng.jobs.json @@ -82,166 +82,168 @@ "id": "S07.1", "description": "Manage SSH login options", "sub": [ - { + { "id": "S07", "description": "Disable root login", "command": [ - "sed -i \"s|^#\\?PermitRootLogin.*|PermitRootLogin no|\" /etc/ssh/sshd_config", - "systemctl restart sshd.service" - ], + "sed -i \"s|^#\\?PermitRootLogin.*|PermitRootLogin no|\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q '^PermitRootLogin yes' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S08", "description": "Enable root login", "command": [ - "sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/\" /etc/ssh/sshd_config" , - "systemctl restart sshd.service" - ], + "sed -i \"s/^#\\?PermitRootLogin.*/PermitRootLogin yes/\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q '^PermitRootLogin no' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S09", "description": "Disable password login", "command": [ - "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication no/\" /etc/ssh/sshd_config" , - "systemctl restart sshd.service" - ], + "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication no/\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q 'PasswordAuthentication yes' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S10", "description": "Enable password login", "command": [ - "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/\" /etc/ssh/sshd_config" , - "systemctl restart sshd.service" - ], + "sed -i \"s/^#\\?PasswordAuthentication.*/PasswordAuthentication yes/\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q 'PasswordAuthentication no' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S11", "description": "Disable Public key authentication login", "command": [ - "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/\" /etc/ssh/sshd_config" , - "systemctl restart sshd.service" - ], + "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication no/\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q 'PubkeyAuthentication yes' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S12", "description": "Enable Public key authentication login", "command": [ - "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication yes/\" /etc/ssh/sshd_config" , - "systemctl restart sshd.service" - ], + "sed -i \"s/^#\\?PubkeyAuthentication.*/PubkeyAuthentication yes/\" /etc/ssh/sshd_config", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q 'PubkeyAuthentication no' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S13", "description": "Disable OTP authentication", "command": [ - "clear", - "! check_if_installed libpam-google-authenticator && ! check_if_installed qrencode || debconf-apt-progress -- apt-get -y purge libpam-google-authenticator qrencode", - "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication no/\" /etc/ssh/sshd_config || sed -i \"0,/KbdInteractiveAuthentication/s//ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config" , - "sed -i '/^auth required pam_google_authenticator.so nullok/ d' /etc/pam.d/sshd", - "systemctl restart sshd.service" - ], + "clear", + "! check_if_installed libpam-google-authenticator && ! check_if_installed qrencode || debconf-apt-progress -- apt-get -y purge libpam-google-authenticator qrencode", + "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication no/\" /etc/ssh/sshd_config || sed -i \"0,/KbdInteractiveAuthentication/s//ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config", + "sed -i '/^auth required pam_google_authenticator.so nullok/ d' /etc/pam.d/sshd", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q 'ChallengeResponseAuthentication yes' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S14", "description": "Enable OTP authentication", "command": [ - "check_if_installed libpam-google-authenticator || debconf-apt-progress -- apt-get -y install libpam-google-authenticator", - "check_if_installed qrencode || debconf-apt-progress -- apt-get -y install qrencode", - "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config", - "sed -i $'/KbdInteractiveAuthentication/{iChallengeResponseAuthentication yes\\n:a;n;ba}' /etc/ssh/sshd_config || sed -n -i '/password updating/{p;:a;N;/@include common-password/!ba;s/.*\\n/auth required pam_google_authenticator.so nullok\\nauth required pam_permit.so\\n/};p' /etc/pam.d/sshd", - "[ ! -f /root/.google_authenticator ] && qr_code generate", - "systemctl restart sshd.service" - ], + "check_if_installed libpam-google-authenticator || debconf-apt-progress -- apt-get -y install libpam-google-authenticator", + "check_if_installed qrencode || debconf-apt-progress -- apt-get -y install qrencode", + "sed -i \"s/^#\\?ChallengeResponseAuthentication.*/ChallengeResponseAuthentication yes/\" /etc/ssh/sshd_config", + "sed -i $'/KbdInteractiveAuthentication/{iChallengeResponseAuthentication yes\\n:a;n;ba}' /etc/ssh/sshd_config || sed -n -i '/password updating/{p;:a;N;/@include common-password/!ba;s/.*\\n/auth required pam_google_authenticator.so nullok\\nauth required pam_permit.so\\n/};p' /etc/pam.d/sshd", + "[ ! -f /root/.google_authenticator ] && qr_code generate", + "systemctl restart sshd.service" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "! check_if_installed libpam-google-authenticator || ! check_if_installed qrencode || grep -q '^ChallengeResponseAuthentication no' /etc/ssh/sshd_config || ! grep -q 'ChallengeResponseAuthentication' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S15", "description": "Generate new OTP authentication QR code", "command": [ - "qr_code generate" - ], + "qr_code generate" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "", "condition": "grep -q '^ChallengeResponseAuthentication yes' /etc/ssh/sshd_config" - }, - { + }, + { "id": "S16", "description": "Show OTP authentication QR code", - "command": ["qr_code"], + "command": [ + "qr_code" + ], "status": "Active", "doc_link": "", "src_reference": "", "author": "Igor Pecovnik", "condition": "grep -q '^ChallengeResponseAuthentication yes' /etc/ssh/sshd_config && [ -f /root/.google_authenticator ]" - }, - { - "id": "S30", - "description": "Disable last login banner", - "command": [ - "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog no/\" /etc/ssh/sshd_config" , - "systemctl restart ssh.service " - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "grep -q '^PrintLastLog yes' /etc/ssh/sshd_config" - }, - { - "id": "S31", - "description": "Enable last login banner", - "command": [ - "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog yes/\" /etc/ssh/sshd_config" , - "systemctl restart ssh.service " - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "grep -q '^PrintLastLog no' /etc/ssh/sshd_config" - } - ] + }, + { + "id": "S30", + "description": "Disable last login banner", + "command": [ + "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog no/\" /etc/ssh/sshd_config", + "systemctl restart ssh.service " + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "grep -q '^PrintLastLog yes' /etc/ssh/sshd_config" + }, + { + "id": "S31", + "description": "Enable last login banner", + "command": [ + "sed -i \"s/^#\\?PrintLastLog.*/PrintLastLog yes/\" /etc/ssh/sshd_config", + "systemctl restart ssh.service " + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "grep -q '^PrintLastLog no' /etc/ssh/sshd_config" + } + ] }, { "id": "S17", @@ -281,7 +283,9 @@ "id": "S19", "description": "Switch to rolling release", "prompt": "This will switch to rolling releases\n\nwould you like to continue?", - "command": [ "set_rolling" ], + "command": [ + "set_rolling" + ], "status": "Active", "doc_link": "", "src_reference": "https://github.com/armbian/config/blob/master/debian-config-jobs#L1446", @@ -292,7 +296,9 @@ "id": "S20", "description": "Switch to stable release", "prompt": "This will switch to stable releases\n\nwould you like to continue?", - "command": [ "set_stable" ], + "command": [ + "set_stable" + ], "status": "Active", "doc_link": "", "src_reference": "https://github.com/armbian/config/blob/master/debian-config-jobs#L1446", @@ -303,7 +309,9 @@ "id": "S21", "description": "Enable read only filesystem", "prompt": "This will enable Armbian read-only filesystem. Reboot is mandatory?\n\nWould you like to continue?", - "command": [ "manage_overlayfs enable" ], + "command": [ + "manage_overlayfs enable" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -314,7 +322,9 @@ "id": "S22", "description": "Disable read only filesystem", "prompt": "This will disable Armbian read-only filesystem. Reboot is mandatory?\n\nWould you like to continue?", - "command": [ "manage_overlayfs disable" ], + "command": [ + "manage_overlayfs disable" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -324,7 +334,9 @@ { "id": "S23", "description": "Adjust welcome screen (motd)", - "command": [ "adjust_motd" ], + "command": [ + "adjust_motd" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -335,7 +347,9 @@ "id": "S24", "description": "Install alternative kernels", "prompt": "Switching between kernels might change functionality of your device. \n\nIt might fail to boot!", - "command": [ "switch_kernels" ], + "command": [ + "switch_kernels" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -352,54 +366,64 @@ "id": "N01", "description": "Configure network interfaces", "sub": [ - { - "id": "N02", - "description": "Add interface", - "command": [ "network_config armbian" ], - "status": "Active", - "author": "Igor Pecovnik", - "condition": "" - }, - { - "id": "N03", - "description": "Revert to defaults", - "command": [ "default_network_config" ], - "status": "Active", - "author": "Igor Pecovnik", - "condition": "[[ -f /etc/netplan/armbian.yaml ]] && ! cat /etc/netplan/armbian.yaml | diff -q 1>/dev/null <(netplan get all) - || [[ ! -f /etc/netplan/10-dhcp-all-interfaces.yaml ]] && ! cat /etc/netplan/10-dhcp-all-interfaces.yaml 2>/dev/null | diff -q 1>/dev/null <(netplan get all) -" - }, - { - "id": "N04", - "description": "Show draft configuration", - "command": [ "show_message <<< \"$(netplan get all)\"" ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "Igor Pecovnik", - "condition": "[[ -f /etc/netplan/armbian.yaml ]]" - }, - { - "id": "N05", - "description": "Apply changes", - "prompt": "This will apply new network configuration\n\nwould you like to continue?", - "command": [ "netplan apply" ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "Igor Pecovnik", - "condition": "[[ -f /etc/netplan/armbian.yaml ]] && ! cat /etc/netplan/armbian.yaml | diff -q 1>/dev/null <(netplan get all) - || [[ -f /etc/netplan/10-dhcp-all-interfaces.yaml ]]" - }, - { - "id": "N06", - "description": "Show active status", - "command": [ "show_message <<< \"$(netplan status --all)\"" ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "Igor Pecovnik", - "condition": "[ -f /etc/netplan/armbian.yaml ] && [ netplan status 2>/dev/null ]" - } - ] + { + "id": "N02", + "description": "Add interface", + "command": [ + "network_config armbian" + ], + "status": "Active", + "author": "Igor Pecovnik", + "condition": "" + }, + { + "id": "N03", + "description": "Revert to defaults", + "command": [ + "default_network_config" + ], + "status": "Active", + "author": "Igor Pecovnik", + "condition": "[[ -f /etc/netplan/armbian.yaml ]] && ! cat /etc/netplan/armbian.yaml | diff -q 1>/dev/null <(netplan get all) - || [[ ! -f /etc/netplan/10-dhcp-all-interfaces.yaml ]] && ! cat /etc/netplan/10-dhcp-all-interfaces.yaml 2>/dev/null | diff -q 1>/dev/null <(netplan get all) -" + }, + { + "id": "N04", + "description": "Show draft configuration", + "command": [ + "show_message <<< \"$(netplan get all)\"" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "Igor Pecovnik", + "condition": "[[ -f /etc/netplan/armbian.yaml ]]" + }, + { + "id": "N05", + "description": "Apply changes", + "prompt": "This will apply new network configuration\n\nwould you like to continue?", + "command": [ + "netplan apply" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "Igor Pecovnik", + "condition": "[[ -f /etc/netplan/armbian.yaml ]] && ! cat /etc/netplan/armbian.yaml | diff -q 1>/dev/null <(netplan get all) - || [[ -f /etc/netplan/10-dhcp-all-interfaces.yaml ]]" + }, + { + "id": "N06", + "description": "Show active status", + "command": [ + "show_message <<< \"$(netplan status --all)\"" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "Igor Pecovnik", + "condition": "[ -f /etc/netplan/armbian.yaml ] && [ netplan status 2>/dev/null ]" + } + ] }, { "id": "N15", @@ -420,10 +444,10 @@ "description": "Remove Bluetooth support", "command": [ "see_current_apt ", - "debconf-apt-progress -- apt-get -y remove bluetooth bluez bluez-tools", - "check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y remove pulseaudio-module-bluetooth blueman", + "debconf-apt-progress -- apt-get -y remove bluetooth bluez bluez-tools", + "check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y remove pulseaudio-module-bluetooth blueman", "debconf-apt-progress -- apt -y -qq autoremove" - ], + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -434,7 +458,9 @@ "id": "N17", "description": "Bluetooth Discover", "prompt": "This will enable bluetooth and discover devices\n\nWould you like to continue?", - "command": [ "connect_bt_interface" ], + "command": [ + "connect_bt_interface" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -445,7 +471,9 @@ "id": "N18", "description": "Toggle system IPv6/IPv4 internet protocol", "prompt": "This will toggle your internet protocol\nWould you like to continue?", - "command": [ "toggle_ipv6 | show_infobox" ], + "command": [ + "toggle_ipv6 | show_infobox" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -461,7 +489,7 @@ "id": "L00", "description": "Change Global timezone (WIP)", "command": [ - "dpkg-reconfigure tzdata" + "dpkg-reconfigure tzdata" ], "status": "Active", "doc_link": "", @@ -472,9 +500,9 @@ "id": "L01", "description": "Change Locales reconfigure the language and character set", "command": [ - "dpkg-reconfigure locales", - "source /etc/default/locale ; sed -i \"s/^LANGUAGE=.*/LANGUAGE=$LANG/\" /etc/default/locale", - "export LANGUAGE=$LANG" + "dpkg-reconfigure locales", + "source /etc/default/locale ; sed -i \"s/^LANGUAGE=.*/LANGUAGE=$LANG/\" /etc/default/locale", + "export LANGUAGE=$LANG" ], "status": "Active", "doc_link": "", @@ -485,8 +513,8 @@ "id": "L02", "description": "Change Keyboard layout", "command": [ - "dpkg-reconfigure keyboard-configuration ; setupcon ", - "update-initramfs -u" + "dpkg-reconfigure keyboard-configuration ; setupcon ", + "update-initramfs -u" ], "status": "Active", "doc_link": "", @@ -511,13 +539,27 @@ "description": "Run/Install 3rd party applications", "sub": [ { - "id": "SW01.1", - "description": "Desktop Environments", + "id": "SW19", + "description": "Update Application Repository", + "prompt": "This will update the apt repository\nWould you like to continue?", + "command": [ + "debconf-apt-progress -- apt update" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "" + }, + { + "id": "Desktops", + "description": "Install Desktop Environments", "sub": [ { "id": "SW02", "description": "Install XFCE desktop", - "command": [ "install_de \"xfce\""], + "command": [ + "install_de \"xfce\"" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -527,7 +569,9 @@ { "id": "SW03", "description": "Install Gnome desktop", - "command": [ "install_de \"gnome\""], + "command": [ + "install_de \"gnome\"" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -537,7 +581,9 @@ { "id": "SW04", "description": "Install i3-wm desktop", - "command": [ "install_de \"i3-wm\""], + "command": [ + "install_de \"i3-wm\"" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -547,7 +593,9 @@ { "id": "SW05", "description": "Install Cinnamon desktop", - "command": [ "install_de \"cinnamon\""], + "command": [ + "install_de \"cinnamon\"" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -557,7 +605,9 @@ { "id": "SW06", "description": "Install kde-neon desktop", - "command": [ "install_de \"kde-neon\""], + "command": [ + "install_de \"kde-neon\"" + ], "status": "Active", "doc_link": "", "src_reference": "", @@ -567,7 +617,7 @@ ] }, { - "id": "SW01.2", + "id": "Netconfig", "description": "Network tools", "sub": [ { @@ -683,50 +733,40 @@ ] }, { - "id": "SW01.3", - "description": "Development", - "sub": [ - { - "id": "SW17", - "description": "Install tools for cloning and managing repositories (git)", - "command": [ - "get_user_continue \"This operation will install git.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y install git" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed git" - }, - { - "id": "SW18", - "description": "Remove tools for cloning and managing repositories (git)", - "command": [ - "get_user_continue \"This operation will remove git.\n\nDo you wish to continue?\" process_input", - "debconf-apt-progress -- apt-get -y purge git" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "check_if_installed git" - } + "id": "DevTools", + "description": "Development", + "sub": [ + { + "id": "SW17", + "description": "Install tools for cloning and managing repositories (git)", + "command": [ + "get_user_continue \"This operation will install git.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y install git" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed git" + }, + { + "id": "SW18", + "description": "Remove tools for cloning and managing repositories (git)", + "command": [ + "get_user_continue \"This operation will remove git.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y purge git" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed git" + } ] }, { - "id": "SW19", - "description": "Update Application Repository", - "prompt": "This will update the apt repository\nWould you like to continue?", - "command": [ "debconf-apt-progress -- apt update" ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "" - }, - { - "id": "SW20", - "description": "SWystem benchmaking and diagnostics", + "id": "Benchy", + "description": "System benchmaking and diagnostics", "command": [ "see_monitoring" ], @@ -737,116 +777,179 @@ "condition": "[ -f /usr/bin/armbianmonitor ]" }, { - "id": "SW01.4", - "description": "Softy - 3rd party apps", + "id": "Containers", + "description": "Containerlization and Virtual Machines", + "sub": [ + { + "id": "SW25", + "description": "Install Docker Minimal", + "prompt": "This operation will install Docker Minimal.\nWould you like to continue?", + "command": [ + "install_docker" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed docker-ce" + }, + { + "id": "SW26", + "description": "Install Docker Engine", + "prompt": "This operation will install Docker Engine.\nWould you like to continue?", + "command": [ + "install_docker engine" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed docker-compose-plugin" + }, + { + "id": "SW27", + "description": "Remove Docker", + "prompt": "This operation will purge Docker.\nWould you like to continue?", + "command": [ + "apt_install_wrapper apt -y purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed docker-ce" + }, + { + "id": "SW28", + "description": "Purge all Docker images, containers, and volumes", + "prompt": "This operation will delete all Docker images, containers, and volumes.\nWould you like to continue?", + "command": [ + "rm -rf /var/lib/docker", + "rm -rf /var/lib/containerd" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed docker-ce && [ -d /var/lib/docker ]" + } + ] + }, + { + "id": "Media", + "description": "Media Servers and Editors", "sub": [ - { - "id": "SW21", - "description": "Install Plex Media server", - "prompt": "This operation will install Plex Media server.\nWould you like to continue?", - "command": [ - "install_plexmediaserver" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed plexmediaserver" - }, - { - "id": "SW22", - "description": "Remove Plex Media server", - "prompt": "This operation will purge Plex Media server.\nWould you like to continue?", - "command": [ - "apt_install_wrapper apt-get -y purge plexmediaserver", - "sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "check_if_installed plexmediaserver" - }, - { - "id": "SW23", - "description": "Install Emby server", - "prompt": "This operation will install Emby server.\nWould you like to continue?", - "command": [ - "install_embyserver" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed emby-server" - }, - { - "id": "SW24", - "description": "Remove Emby server", - "prompt": "This operation will purge Emby server.\nWould you like to continue?", - "command": [ - "apt_install_wrapper apt -y purge emby-server" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "check_if_installed emby-server" - }, - { - "id": "SW25", - "description": "Install Docker Minimal", - "prompt": "This operation will install Docker Minimal.\nWould you like to continue?", - "command": [ - "install_docker" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed docker-ce" - }, - { - "id": "SW26", - "description": "Install Docker Engine", - "prompt": "This operation will install Docker Engine.\nWould you like to continue?", - "command": [ - "install_docker engine" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed docker-compose-plugin" - }, - { - "id": "SW27", - "description": "Remove Docker", - "prompt": "This operation will purge Docker.\nWould you like to continue?", - "command": [ - "apt_install_wrapper apt -y purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "check_if_installed docker-ce" - }, - { - "id": "SW28", - "description": "Purge all Docker images, containers, and volumes", - "prompt": "This operation will delete all Docker images, containers, and volumes.\nWould you like to continue?", - "command": [ - "rm -rf /var/lib/docker", - "rm -rf /var/lib/containerd" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed docker-ce && [ -d /var/lib/docker ]" - } - ] + { + "id": "SW21", + "description": "Install Plex Media server", + "prompt": "This operation will install Plex Media server.\nWould you like to continue?", + "command": [ + "install_plexmediaserver" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed plexmediaserver" + }, + { + "id": "SW22", + "description": "Remove Plex Media server", + "prompt": "This operation will purge Plex Media server.\nWould you like to continue?", + "command": [ + "apt_install_wrapper apt-get -y purge plexmediaserver", + "sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed plexmediaserver" + }, + { + "id": "SW23", + "description": "Install Emby server", + "prompt": "This operation will install Emby server.\nWould you like to continue?", + "command": [ + "install_embyserver" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed emby-server" + }, + { + "id": "SW24", + "description": "Remove Emby server", + "prompt": "This operation will purge Emby server.\nWould you like to continue?", + "command": [ + "apt_install_wrapper apt -y purge emby-server" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed emby-server" + } + ] + }, + { + "id": "Management", + "description": "Remote Management tools", + "sub": [ + { + "id": "M00", + "description": "Install Cockpit web-based management tool", + "prompt": "This operation will install Cockpit.\ncockpit cockpit-ws cockpit-system cockpit-storaged\nWould you like to continue?", + "command": [ + "apt_install_wrapper apt -y install cockpit cockpit-ws cockpit-system cockpit-storaged " + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed cockpit" + }, + { + "id": "M01", + "description": "Purge Cockpit web-based management tool", + "prompt": "This operation will purge Cockpit.\nWould you like to continue?", + "command": [ + "apt_install_wrapper apt -y purge cockpit" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed cockpit" + }, + { + "id": "M02", + "description": "Start Cockpit Service", + "command": [ + "sudo systemctl enable --now cockpit.socket | show_infobox " + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed cockpit && ! systemctl is-enabled cockpit.socket > /dev/null 2>&1" + }, + { + "id": "M03", + "description": "Stop Cockpit Service", + "command": [ + "systemctl stop cockpit cockpit.socket", + "systemctl disable cockpit.socket | show_infobox " + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed cockpit && systemctl is-enabled cockpit.socket > /dev/null 2>&1" + } + ] } ] }, @@ -879,4 +982,4 @@ ] } ] -} +} \ No newline at end of file From b16db304d9eee4425755a612180eea53e36ac532 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:42:06 -0500 Subject: [PATCH 02/32] styles fix --- lib/armbian-configng/config.ng.docs.sh | 16 ++++++++-------- lib/armbian-configng/config.ng.software.sh | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index 410e4842..c1c401df 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -37,8 +37,8 @@ sudo armbian-config $(see_full_list) -## Install -Armbian installation +## Install +Armbian installation ~~~ sudo apt install armbian-config ~~~ @@ -46,12 +46,12 @@ sudo apt install armbian-config 3rd party Debian based distributions ~~~ { - sudo wget https://apt.armbian.com/armbian.key -O key - sudo gpg --dearmor < key | sudo tee /usr/share/keyrings/armbian.gpg > /dev/null - sudo chmod go+r /usr/share/keyrings/armbian.gpg - sudo echo "deb [arch=\$(dpkg --print-architecture) signed-by=/usr/share/keyrings/armbian.gpg] http://apt.armbian.com \$(lsb_release -cs) main \$(lsb_release -cs)-utils \$(lsb_release -cs)-desktop" | sudo tee /etc/apt/sources.list.d/armbian.list - sudo apt update - sudo apt install armbian-config + sudo wget https://apt.armbian.com/armbian.key -O key + sudo gpg --dearmor < key | sudo tee /usr/share/keyrings/armbian.gpg > /dev/null + sudo chmod go+r /usr/share/keyrings/armbian.gpg + sudo echo "deb [arch=\$(dpkg --print-architecture) signed-by=/usr/share/keyrings/armbian.gpg] http://apt.armbian.com \$(lsb_release -cs) main \$(lsb_release -cs)-utils \$(lsb_release -cs)-desktop" | sudo tee /etc/apt/sources.list.d/armbian.list + sudo apt update + sudo apt install armbian-config } ~~~ diff --git a/lib/armbian-configng/config.ng.software.sh b/lib/armbian-configng/config.ng.software.sh index 4575f44d..cadaa83b 100644 --- a/lib/armbian-configng/config.ng.software.sh +++ b/lib/armbian-configng/config.ng.software.sh @@ -95,7 +95,7 @@ install_docker() { # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$distro \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null apt_install_wrapper apt-get update From f964fd5d6b7b1c699c6deec3ac01bd20b29a6f59 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:48:59 -0500 Subject: [PATCH 03/32] styles --- lib/armbian-configng/config.ng.docs.sh | 79 +++++++++++++------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index c1c401df..3ac89327 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -96,7 +96,7 @@ Click for more info: A list of the jobs defined in the Jobs file. - $(see_jq_menu_list) + $(see_jq_menu_list) @@ -137,23 +137,23 @@ sudo apt install git jq whiptail Get Development and contribute: ~~~ { - git clone https://github.com/armbian/configng - cd configng - ./armbian-configng --help + git clone https://github.com/armbian/configng + cd configng + ./armbian-configng --help } ~~~ Install and test Development deb: ~~~ { - sudo apt install whiptail - latest_release=\$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) - deb_url=\$(echo "\$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') - curl -LO "\$deb_url" - deb_file=\$(echo "\$deb_url" | awk -F"/" '{print \$NF}') - sudo dpkg -i "\$deb_file" - sudo dpkg --configure -a - sudo apt --fix-broken install + sudo apt install whiptail + latest_release=\$(curl -s https://api.github.com/repos/armbian/configng/releases/latest) + deb_url=\$(echo "\$latest_release" | jq -r '.assets[] | select(.name | endswith(".deb")) | .browser_download_url') + curl -LO "\$deb_url" + deb_file=\$(echo "\$deb_url" | awk -F"/" '{print \$NF}') + sudo dpkg -i "\$deb_file" + sudo dpkg --configure -a + sudo apt --fix-broken install } ~~~ @@ -185,9 +185,9 @@ function serve_doc() { python3 -m http.server > /tmp/config.log 2>&1 & local server_pid=$! local input=(" - Starting server... - Server PID: $server_pid - + Starting server... + Server PID: $server_pid + Press [Enter] to exit" ) @@ -436,14 +436,13 @@ module_options+=( # This function is used to generate a markdown list from the json object using jq. # function see_jq_menu_list() { - jq -r ' - .menu[] | - .sub[] | - "### " + .id + "\n\n" + - (.description // "No description available") + "\n\nJobs:\n\n~~~\n" + - ((.command // ["No commands available"]) | join("\n")) + - "\n~~~\n" + .menu[] | + .sub[] | + "### " + .id + "\n\n" + + (.description // "No description available") + "\n\nJobs:\n\n~~~\n" + + ((.command // ["No commands available"]) | join("\n")) + + "\n~~~\n" ' $json_file } @@ -464,24 +463,24 @@ see_cmd_list() { if [[ -n "$help_menu" && "$help_menu" != "cmd" ]]; then echo "$json_data" | jq -r --arg menu "$help_menu" ' - def recurse_menu(menu; level): - menu | .id as $id | .description as $desc | - if has("sub") then - if level == 0 then - "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - elif level == 1 then - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - else - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - end - else - if level == 0 then - " --cmd \($id) - \($desc)" - elif level == 1 then - " --cmd \($id) - \($desc)" - else - "\t--cmd \($id) - \($desc)" - end + def recurse_menu(menu; level): + menu | .id as $id | .description as $desc | + if has("sub") then + if level == 0 then + "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + elif level == 1 then + " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + else + " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + end + else + if level == 0 then + " --cmd \($id) - \($desc)" + elif level == 1 then + " --cmd \($id) - \($desc)" + else + "\t--cmd \($id) - \($desc)" + end end; # Find the correct menu if $menu is passed, otherwise show all From 43f3249dceff1ddadb5713054ed129497b48b238 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:51:20 -0500 Subject: [PATCH 04/32] styels ng.doc --- lib/armbian-configng/config.ng.docs.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index 3ac89327..2ce4247e 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -95,9 +95,9 @@ Click for more info: Jobs / JSON Object A list of the jobs defined in the Jobs file. - - $(see_jq_menu_list) - +~~~ +$(see_jq_menu_list) +~~~ @@ -137,9 +137,9 @@ sudo apt install git jq whiptail Get Development and contribute: ~~~ { - git clone https://github.com/armbian/configng - cd configng - ./armbian-configng --help +git clone https://github.com/armbian/configng +cd configng +./armbian-configng --help } ~~~ From a71436b211538ee87e92d9dfe724276093217dd6 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:52:47 -0500 Subject: [PATCH 05/32] modified: lib/armbian-configng/config.ng.docs.sh --- lib/armbian-configng/config.ng.docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index 2ce4247e..c1816c9b 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -188,7 +188,7 @@ function serve_doc() { Starting server... Server PID: $server_pid - Press [Enter] to exit" + Press [Enter] to exit" ) $DIALOG --title "Message Box" --msgbox "$input" 0 0 From 35141f3b1bb24011a50d20670f9a21e85bd61eee Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:56:32 -0500 Subject: [PATCH 06/32] style functions.sh --- lib/armbian-configng/config.ng.functions.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/armbian-configng/config.ng.functions.sh b/lib/armbian-configng/config.ng.functions.sh index 5e0ee905..9055b957 100644 --- a/lib/armbian-configng/config.ng.functions.sh +++ b/lib/armbian-configng/config.ng.functions.sh @@ -597,19 +597,19 @@ function execute_command() { # Extract commands local commands=$(jq -r --arg id "$id" ' - .menu[] | - .. | - objects | - select(.id == $id) | - .command[]?' "$json_file") + .menu[] | + .. | + objects | + select(.id == $id) | + .command[]?' "$json_file") # Check if a prompt exists local prompt=$(jq -r --arg id "$id" ' - .menu[] | - .. | - objects | - select(.id == $id) | - .prompt?' "$json_file") + .menu[] | + .. | + objects | + select(.id == $id) | + .prompt?' "$json_file") # If a prompt exists, display it and wait for user confirmation if [[ "$prompt" != "null" && $INPUTMODE != "cmd" ]]; then From 9ef2298f87de3d7cea482d20cff666d30ac9ff71 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 14:59:46 -0500 Subject: [PATCH 07/32] remove SW19 --- lib/armbian-configng/config.ng.jobs.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib/armbian-configng/config.ng.jobs.json b/lib/armbian-configng/config.ng.jobs.json index 11913353..6a29a8e2 100644 --- a/lib/armbian-configng/config.ng.jobs.json +++ b/lib/armbian-configng/config.ng.jobs.json @@ -538,18 +538,6 @@ "id": "Software", "description": "Run/Install 3rd party applications", "sub": [ - { - "id": "SW19", - "description": "Update Application Repository", - "prompt": "This will update the apt repository\nWould you like to continue?", - "command": [ - "debconf-apt-progress -- apt update" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "" - }, { "id": "Desktops", "description": "Install Desktop Environments", From b71453edba04c3915f5ba7f6c511863def4bf789 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:03:52 -0500 Subject: [PATCH 08/32] style systme.md --- lib/armbian-configng/config.ng.system.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index be250305..b42606a0 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -214,10 +214,10 @@ function toggle_ssh_lastlog() { else # If PrintLastLog is found, toggle between 'yes' and 'no' sed -i '/^#\?PrintLastLog /{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ - }' "${SDCARD}/etc/ssh/sshd_config" + s/PrintLastLog yes/PrintLastLog no/; + t; + s/PrintLastLog no/PrintLastLog yes/ + }' "${SDCARD}/etc/ssh/sshd_config" sudo service ssh restart fi From c8e309cc85bc307a09ed21116bcf69749a0f707c Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:05:19 -0500 Subject: [PATCH 09/32] style test system.ng --- lib/armbian-configng/config.ng.system.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index b42606a0..d40a68a8 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -214,10 +214,10 @@ function toggle_ssh_lastlog() { else # If PrintLastLog is found, toggle between 'yes' and 'no' sed -i '/^#\?PrintLastLog /{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ - }' "${SDCARD}/etc/ssh/sshd_config" + s/PrintLastLog yes/PrintLastLog no/; + t; + s/PrintLastLog no/PrintLastLog yes/ + }' "${SDCARD}/etc/ssh/sshd_config" sudo service ssh restart fi From e66aa8b259fb1fefd688675dd5beeed8b21d2bc4 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:06:53 -0500 Subject: [PATCH 10/32] style --- lib/armbian-configng/config.ng.system.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index d40a68a8..1bc1d56c 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -213,11 +213,12 @@ function toggle_ssh_lastlog() { sudo service ssh restart else # If PrintLastLog is found, toggle between 'yes' and 'no' - sed -i '/^#\?PrintLastLog /{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ - }' "${SDCARD}/etc/ssh/sshd_config" + sed -i '/^#\?PrintLastLog / +{ + s/PrintLastLog yes/PrintLastLog no/; + t; + s/PrintLastLog no/PrintLastLog yes/ +}' "${SDCARD}/etc/ssh/sshd_config" sudo service ssh restart fi From d28a1c4294e199b059dc945295f83c456d2751ce Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:09:02 -0500 Subject: [PATCH 11/32] restore from main --- lib/armbian-configng/config.ng.system.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index 1bc1d56c..9e3b596f 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -213,12 +213,11 @@ function toggle_ssh_lastlog() { sudo service ssh restart else # If PrintLastLog is found, toggle between 'yes' and 'no' - sed -i '/^#\?PrintLastLog / -{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ -}' "${SDCARD}/etc/ssh/sshd_config" + sed -i '/^#\?PrintLastLog /{ + s/PrintLastLog yes/PrintLastLog no/; + t; + s/PrintLastLog no/PrintLastLog yes/ + }' "${SDCARD}/etc/ssh/sshd_config" sudo service ssh restart fi @@ -282,4 +281,4 @@ function adjust_motd() { # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd -} +} \ No newline at end of file From aa4686bc913768e0bb6c893f6b596d904bb0fafa Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:11:28 -0500 Subject: [PATCH 12/32] shellcheck fix --- lib/armbian-configng/config.ng.system.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index 9e3b596f..0a6f14d1 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -13,10 +13,10 @@ module_options+=( # function apt_install_wrapper() { if [ -t 0 ]; then - debconf-apt-progress -- $@ + debconf-apt-progress -- "$@" else # Terminal not defined - proceed without TUI - $@ + "$@" fi } @@ -277,7 +277,7 @@ function adjust_motd() { INLIST=($(grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d"=" -f2 | sed "s/\"//g")) CHOICES=$(whiptail --separate-output --nocancel --title "Adjust welcome screen" --checklist "" 11 50 5 "${LIST[@]}" 3>&1 1>&2 2>&3) - INSERT=$(echo ${INLIST[@]} ${CHOICES[@]} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//') + INSERT="$(echo ${INLIST[@]} ${CHOICES[@]} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd From 24262981ab5a40513395dbdfc243f7624d477380 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:13:31 -0500 Subject: [PATCH 13/32] shellcheck fix --- lib/armbian-configng/config.ng.system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index 0a6f14d1..fbe38f33 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -277,7 +277,7 @@ function adjust_motd() { INLIST=($(grep THIS_SCRIPT= /etc/update-motd.d/* | cut -d"=" -f2 | sed "s/\"//g")) CHOICES=$(whiptail --separate-output --nocancel --title "Adjust welcome screen" --checklist "" 11 50 5 "${LIST[@]}" 3>&1 1>&2 2>&3) - INSERT="$(echo ${INLIST[@]} ${CHOICES[@]} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" + INSERT="$(echo "${INLIST[@]}" "${CHOICES[@]}" | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd From fcfe277d7cd98af812fb3c1561c9c79dc22d0510 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:15:26 -0500 Subject: [PATCH 14/32] style fix system.ng --- lib/armbian-configng/config.ng.system.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index fbe38f33..f1b60d81 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -213,11 +213,12 @@ function toggle_ssh_lastlog() { sudo service ssh restart else # If PrintLastLog is found, toggle between 'yes' and 'no' - sed -i '/^#\?PrintLastLog /{ - s/PrintLastLog yes/PrintLastLog no/; - t; - s/PrintLastLog no/PrintLastLog yes/ - }' "${SDCARD}/etc/ssh/sshd_config" + sed -i '/^#\?PrintLastLog / +{ + s/PrintLastLog yes/PrintLastLog no/; + t; + s/PrintLastLog no/PrintLastLog yes/ +}' "${SDCARD}/etc/ssh/sshd_config" sudo service ssh restart fi @@ -280,5 +281,3 @@ function adjust_motd() { INSERT="$(echo "${INLIST[@]}" "${CHOICES[@]}" | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd - -} \ No newline at end of file From 4c76bbd72753a314831a5abcf5b1c52b6ab01cc4 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:18:04 -0500 Subject: [PATCH 15/32] style: fix system.ng --- lib/armbian-configng/config.ng.system.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index f1b60d81..9d7d0f7a 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -281,3 +281,4 @@ function adjust_motd() { INSERT="$(echo "${INLIST[@]}" "${CHOICES[@]}" | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd +} \ No newline at end of file From 41b697705f8f4221f7e0fcccd8b0e6a94ef328f7 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:22:24 -0500 Subject: [PATCH 16/32] fix style docs.sh --- lib/armbian-configng/config.ng.docs.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index c1816c9b..31dea25a 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -481,15 +481,15 @@ see_cmd_list() { else "\t--cmd \($id) - \($desc)" end - end; + end; - # Find the correct menu if $menu is passed, otherwise show all - if $menu == "" then - .menu | map(recurse_menu(. ; 0)) | join("\n") - else - .menu | map(select(.id == $menu) | recurse_menu(. ; 0)) | join("\n") - end - ' + # Find the correct menu if $menu is passed, otherwise show all + if $menu == "" then + .menu | map(recurse_menu(. ; 0)) | join("\n") + else + .menu | map(select(.id == $menu) | recurse_menu(. ; 0)) | join("\n") + end + ' elif [[ -z "$1" || "$1" == "cmd" ]]; then echo "$json_data" | jq -r --arg menu "$help_menu" ' def recurse_menu(menu; level): @@ -537,9 +537,10 @@ Please use 'armbian-config --help' for more information. Usage: $script_name main=[arguments] selection=[options] EOF - cat << EOF - $script_name main=System selection=Headers - Install headers: - $script_name main=System selection=Headers_remove - Remove headers: + +cat << EOF +$script_name main=System selection=Headers - Install headers: +$script_name main=System selection=Headers_remove - Remove headers: EOF From 639671007e213e7594d4a2dbdef6ae4bc658a3bd Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:24:09 -0500 Subject: [PATCH 17/32] fix docs style --- lib/armbian-configng/config.ng.docs.sh | 5 ++--- lib/armbian-configng/config.ng.system.sh | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index 31dea25a..fea20c6f 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -539,9 +539,8 @@ Usage: $script_name main=[arguments] selection=[options] EOF cat << EOF -$script_name main=System selection=Headers - Install headers: -$script_name main=System selection=Headers_remove - Remove headers: - + $script_name main=System selection=Headers - Install headers: + $script_name main=System selection=Headers_remove - Remove headers: EOF # TODO Migrate following features diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index 9d7d0f7a..4fffcc4f 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -281,4 +281,4 @@ function adjust_motd() { INSERT="$(echo "${INLIST[@]}" "${CHOICES[@]}" | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ' | sed 's/ *$//')" # adjust motd config sed -i "s/^MOTD_DISABLE=.*/MOTD_DISABLE=\"$INSERT\"/g" /etc/default/armbian-motd -} \ No newline at end of file +} From 2d46b787fdef22096ee24906ceb9976c7ce5f6e1 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:25:51 -0500 Subject: [PATCH 18/32] style --- lib/armbian-configng/config.ng.docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index fea20c6f..34fb10e8 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -511,7 +511,7 @@ see_cmd_list() { "\t--cmd \($id) - \($desc)" end end; - .menu | map(recurse_menu(. ; 0)) | join("\n") + .menu | map(recurse_menu(. ; 0)) | join("\n") ' else From f1366515bda0cbe367d0a26059e326c17e34bf0d Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:38:44 -0500 Subject: [PATCH 19/32] fix --- lib/armbian-configng/config.ng.docs.sh | 45 +++++++++++++------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index 34fb10e8..d16579bc 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -483,7 +483,7 @@ see_cmd_list() { end end; - # Find the correct menu if $menu is passed, otherwise show all + # Find the correct menu if $menu is passed, otherwise show all if $menu == "" then .menu | map(recurse_menu(. ; 0)) | join("\n") else @@ -492,33 +492,34 @@ see_cmd_list() { ' elif [[ -z "$1" || "$1" == "cmd" ]]; then echo "$json_data" | jq -r --arg menu "$help_menu" ' - def recurse_menu(menu; level): - menu | .id as $id | .description as $desc | - if has("sub") then - if level == 0 then - "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - elif level == 1 then - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - else - " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) - end - else - if level == 0 then - " --cmd \($id) - \($desc)" - elif level == 1 then - " --cmd \($id) - \($desc)" - else - "\t--cmd \($id) - \($desc)" - end - end; - .menu | map(recurse_menu(. ; 0)) | join("\n") - ' + def recurse_menu(menu; level): + menu | .id as $id | .description as $desc | + if has("sub") then + if level == 0 then + "\n \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + elif level == 1 then + " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + else + " \($id) - \($desc)\n" + (.sub | map(recurse_menu(. ; level + 1)) | join("\n")) + end + else + if level == 0 then + " --cmd \($id) - \($desc)" + elif level == 1 then + " --cmd \($id) - \($desc)" + else + "\t--cmd \($id) - \($desc)" + end + end; + .menu | map(recurse_menu(. ; 0)) | join("\n") + ' else echo "nope" fi } + module_options+=( ["see_cli_legacy,author"]="Joey Turner" ["see_cli_legacy,ref_link"]="" From f9f58d0efa016d6ce7e676c6b042e674939b8db4 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:39:54 -0500 Subject: [PATCH 20/32] remove trailing space --- lib/armbian-configng/config.ng.docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/armbian-configng/config.ng.docs.sh b/lib/armbian-configng/config.ng.docs.sh index d16579bc..cf3bb46d 100644 --- a/lib/armbian-configng/config.ng.docs.sh +++ b/lib/armbian-configng/config.ng.docs.sh @@ -489,7 +489,7 @@ see_cmd_list() { else .menu | map(select(.id == $menu) | recurse_menu(. ; 0)) | join("\n") end - ' + ' elif [[ -z "$1" || "$1" == "cmd" ]]; then echo "$json_data" | jq -r --arg menu "$help_menu" ' def recurse_menu(menu; level): From 8156a6a0d9bb2b7d38d4ea831ea40eeb8f06e71c Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 15:51:57 -0500 Subject: [PATCH 21/32] refined see_current_apt to check if < 10 minuts --- lib/armbian-configng/config.ng.functions.sh | 24 +++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/armbian-configng/config.ng.functions.sh b/lib/armbian-configng/config.ng.functions.sh index 9055b957..167c1e38 100644 --- a/lib/armbian-configng/config.ng.functions.sh +++ b/lib/armbian-configng/config.ng.functions.sh @@ -853,36 +853,42 @@ module_options+=( see_current_apt() { # Number of seconds in a day local day=86400 - + local ten_minutes=600 # Get the current date as a Unix timestamp local now=$(date +%s) # Get the timestamp of the most recently updated file in /var/lib/apt/lists/ - local update=$(stat -c %Y /var/lib/apt/lists/* | sort -n | tail -1) + local update=$(stat -c %Y /var/lib/apt/lists/* 2>/dev/null | sort -n | tail -1) + + # Check if the update timestamp was found + if [[ -z "$update" ]]; then + echo "No package lists found." + return 1 # No package lists exist + fi # Calculate the number of seconds since the last update local elapsed=$((now - update)) + # Check if any apt-related processes are running if ps -C apt-get,apt,dpkg > /dev/null; then - echo "A pkg is running." + echo "A package manager is currently running." export running_pkg="true" return 1 # The processes are running else export running_pkg="false" - #echo "apt, apt-get, or dpkg is not currently running" fi + # Check if the package list is up-to-date - if ((elapsed < day)); then - #echo "Checking for apt-daily.service" - echo "$(date -u -d @${elapsed} +"%T")" + if ((elapsed < ten_minutes)); then + echo "The package lists are up-to-date." return 0 # The package lists are up-to-date else - #echo "Checking for apt-daily.service" - echo "Update the package lists" + echo "Update the package lists." # Suggest updating return 1 # The package lists are not up-to-date fi } + module_options+=( ["are_headers_installed,author"]="Gunjan Gupta" ["are_headers_installed,ref_link"]="" From 76a4a3a1ec9f72cb6947d1dcd7c890edf14f5055 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 17:37:33 -0500 Subject: [PATCH 22/32] refactor: improve see_current_apt function to check if package lists are up-to-date pass optio n to update --- lib/armbian-configng/config.ng.functions.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/armbian-configng/config.ng.functions.sh b/lib/armbian-configng/config.ng.functions.sh index 167c1e38..4b82589d 100644 --- a/lib/armbian-configng/config.ng.functions.sh +++ b/lib/armbian-configng/config.ng.functions.sh @@ -842,8 +842,8 @@ module_options+=( ["see_current_apt,author"]="Joey Turner" ["see_current_apt,ref_link"]="" ["see_current_apt,feature"]="see_current_apt" - ["see_current_apt,desc"]="Check when apt list was last updated" - ["see_current_apt,example"]="see_current_apt" + ["see_current_apt,desc"]="Check when apt list was last updated and suggest updating or update" + ["see_current_apt,example"]="see_current_apt || see_current_apt update" ["see_current_apt,doc_link"]="" ["see_current_apt,status"]="Active" ) @@ -852,6 +852,7 @@ module_options+=( # see_current_apt() { # Number of seconds in a day + local update_apt="$1" local day=86400 local ten_minutes=600 # Get the current date as a Unix timestamp @@ -880,11 +881,12 @@ see_current_apt() { # Check if the package list is up-to-date if ((elapsed < ten_minutes)); then - echo "The package lists are up-to-date." + [[ "$update_apt" != "update" ]] && echo "The package lists are up-to-date." return 0 # The package lists are up-to-date else - echo "Update the package lists." # Suggest updating - return 1 # The package lists are not up-to-date + [[ "$update_apt" != "update" ]] && echo "Update the package lists." # Suggest updating + [[ "$update_apt" == "update" ]] && apt_install_wrapper apt-get update + return 0 # The package lists are not up-to-date fi } From 7a564a2f434ab47feeab11b61f6c59940674339e Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 18:25:58 -0500 Subject: [PATCH 23/32] updated M03 to check and update apt --- lib/armbian-configng/config.ng.jobs.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/armbian-configng/config.ng.jobs.json b/lib/armbian-configng/config.ng.jobs.json index 6a29a8e2..09123296 100644 --- a/lib/armbian-configng/config.ng.jobs.json +++ b/lib/armbian-configng/config.ng.jobs.json @@ -891,6 +891,7 @@ "description": "Install Cockpit web-based management tool", "prompt": "This operation will install Cockpit.\ncockpit cockpit-ws cockpit-system cockpit-storaged\nWould you like to continue?", "command": [ + "see_current_apt update", "apt_install_wrapper apt -y install cockpit cockpit-ws cockpit-system cockpit-storaged " ], "status": "Active", From bd42c33f50ff76ede70a8f6fb643855c13c2a3d9 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:35:45 -0500 Subject: [PATCH 24/32] added test --- tests/M00.conf | 3 +++ tests/M01.conf | 3 +++ tests/S17.conf | 3 --- tests/S18.conf | 2 -- 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 tests/M00.conf create mode 100644 tests/M01.conf delete mode 100644 tests/S17.conf delete mode 100644 tests/S18.conf diff --git a/tests/M00.conf b/tests/M00.conf new file mode 100644 index 00000000..40b77b64 --- /dev/null +++ b/tests/M00.conf @@ -0,0 +1,3 @@ +ENABLED=true +PREINSTALL="bash bin/armbian-configng --cmd M01" +CONDITION="[ ! dpkg -l | grep cockpit ]" diff --git a/tests/M01.conf b/tests/M01.conf new file mode 100644 index 00000000..77d82846 --- /dev/null +++ b/tests/M01.conf @@ -0,0 +1,3 @@ +ENABLED=true +PREINSTALL="bash bin/armbian-configng --cmd M00" +CONDITION="[ dpkg -l | grep cockpit ]" \ No newline at end of file diff --git a/tests/S17.conf b/tests/S17.conf deleted file mode 100644 index 12b75eca..00000000 --- a/tests/S17.conf +++ /dev/null @@ -1,3 +0,0 @@ -ENABLED=true -PREINSTALL="bash bin/armbian-configng --cmd S18" -CONDITION="[ ! -f /usr/bin/zsh ]" diff --git a/tests/S18.conf b/tests/S18.conf deleted file mode 100644 index bea6f840..00000000 --- a/tests/S18.conf +++ /dev/null @@ -1,2 +0,0 @@ -ENABLED=true -CONDITION="[ -f /usr/bin/zsh ]" From 734387943e1a60181460ead7e3cc844c8398c078 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:37:11 -0500 Subject: [PATCH 25/32] fix line ending --- tests/M00.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/M00.conf b/tests/M00.conf index 40b77b64..0a67f5e3 100644 --- a/tests/M00.conf +++ b/tests/M00.conf @@ -1,3 +1,3 @@ ENABLED=true PREINSTALL="bash bin/armbian-configng --cmd M01" -CONDITION="[ ! dpkg -l | grep cockpit ]" +CONDITION="[ ! dpkg -l | grep cockpit ]" \ No newline at end of file From eff3b7f782f54e97afa6084ae65bd016a34df5eb Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:38:21 -0500 Subject: [PATCH 26/32] fix newline --- tests/M00.conf | 2 +- tests/M01.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/M00.conf b/tests/M00.conf index 0a67f5e3..40b77b64 100644 --- a/tests/M00.conf +++ b/tests/M00.conf @@ -1,3 +1,3 @@ ENABLED=true PREINSTALL="bash bin/armbian-configng --cmd M01" -CONDITION="[ ! dpkg -l | grep cockpit ]" \ No newline at end of file +CONDITION="[ ! dpkg -l | grep cockpit ]" diff --git a/tests/M01.conf b/tests/M01.conf index 77d82846..91350244 100644 --- a/tests/M01.conf +++ b/tests/M01.conf @@ -1,3 +1,3 @@ ENABLED=true PREINSTALL="bash bin/armbian-configng --cmd M00" -CONDITION="[ dpkg -l | grep cockpit ]" \ No newline at end of file +CONDITION="[ dpkg -l | grep cockpit ]" From 5de70eea9d3134ff19ec346d2e5ec0674ec6886b Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:43:49 -0500 Subject: [PATCH 27/32] tests --- tests/M00.conf | 3 +-- tests/M01.conf | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/M00.conf b/tests/M00.conf index 40b77b64..f683ef34 100644 --- a/tests/M00.conf +++ b/tests/M00.conf @@ -1,3 +1,2 @@ ENABLED=true -PREINSTALL="bash bin/armbian-configng --cmd M01" -CONDITION="[ ! dpkg -l | grep cockpit ]" +CONDITION="[ dpkg -l | grep cockpit ]" diff --git a/tests/M01.conf b/tests/M01.conf index 91350244..97d64a34 100644 --- a/tests/M01.conf +++ b/tests/M01.conf @@ -1,3 +1,2 @@ ENABLED=true -PREINSTALL="bash bin/armbian-configng --cmd M00" -CONDITION="[ dpkg -l | grep cockpit ]" +CONDITION="[ ! dpkg -l | grep cockpit ]" From 8e7311d7b0dd7ce694bed7d73e88066dd9ee3ae6 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:45:52 -0500 Subject: [PATCH 28/32] test --- tests/M00.conf | 2 +- tests/M01.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/M00.conf b/tests/M00.conf index f683ef34..17e0529a 100644 --- a/tests/M00.conf +++ b/tests/M00.conf @@ -1,2 +1,2 @@ -ENABLED=true +ENABLED=false CONDITION="[ dpkg -l | grep cockpit ]" diff --git a/tests/M01.conf b/tests/M01.conf index 97d64a34..5f7d5b13 100644 --- a/tests/M01.conf +++ b/tests/M01.conf @@ -1,2 +1,2 @@ -ENABLED=true +ENABLED=false CONDITION="[ ! dpkg -l | grep cockpit ]" From 7f69c971d37ec6f4d20c1c732361634d824fe0c7 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 22:52:06 -0500 Subject: [PATCH 29/32] test --- tests/M00.conf | 4 ++-- tests/M01.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/M00.conf b/tests/M00.conf index 17e0529a..8017bb57 100644 --- a/tests/M00.conf +++ b/tests/M00.conf @@ -1,2 +1,2 @@ -ENABLED=false -CONDITION="[ dpkg -l | grep cockpit ]" +ENABLED=ture +CONDITION="[ -f /usr/bin/cockpit-bridge ]" diff --git a/tests/M01.conf b/tests/M01.conf index 5f7d5b13..e605e4d7 100644 --- a/tests/M01.conf +++ b/tests/M01.conf @@ -1,2 +1,2 @@ -ENABLED=false -CONDITION="[ ! dpkg -l | grep cockpit ]" +ENABLED=true +CONDITION="[ ! -f /usr/bin/cockpit-bridge ]" From efa2b440df1601b448b9abc6cac61f7db8a98742 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 23:16:52 -0500 Subject: [PATCH 30/32] fixconflict --- lib/armbian-configng/config.ng.software.sh | 44 ++++++++++------------ 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/lib/armbian-configng/config.ng.software.sh b/lib/armbian-configng/config.ng.software.sh index cadaa83b..bd01f24b 100644 --- a/lib/armbian-configng/config.ng.software.sh +++ b/lib/armbian-configng/config.ng.software.sh @@ -82,33 +82,27 @@ module_options+=( # install_docker() { # Check if repo for distribution exists. - distro=$(echo $DISTRO | tr '[:upper:]' '[:lower:]') - URL="https://download.docker.com/linux/$distro/dists/$(. /etc/os-release && echo "$VERSION_CODENAME")" + URL="https://download.docker.com/linux/${DISTRO,,}/dists/$DISTROID" if wget --spider "${URL}" 2> /dev/null; then # Add Docker's official GPG key: - apt_install_wrapper apt-get update - apt_install_wrapper apt-get -y install ca-certificates curl - sudo install -m 0755 -d /etc/apt/keyrings - sudo curl -fsSL https://download.docker.com/linux/$distro/gpg -o /etc/apt/keyrings/docker.asc - sudo chmod a+r /etc/apt/keyrings/docker.asc - - # Add the repository to Apt sources: - echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/$distro \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - apt_install_wrapper apt-get update - - # Install docker - if [ "$1" = "engine" ]; then - apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - else - apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io + wget -qO - https://download.docker.com/linux/${DISTRO,,}/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/docker.gpg > /dev/null + if [[ $? -eq 0 ]]; then + # Add the repository to Apt sources: + cat <<- EOF > "/etc/apt/sources.list.d/docker.list" + deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/${DISTRO,,} $DISTROID stable + EOF + apt_install_wrapper apt-get update + # Install docker + if [ "$1" = "engine" ]; then + apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + else + apt_install_wrapper apt-get -y install docker-ce docker-ce-cli containerd.io + fi + systemctl enable docker.service > /dev/null 2>&1 + systemctl enable containerd.service > /dev/null 2>&1 + whiptail --msgbox "To test that Docker has installed successfully\nrun the following command: docker run hello-world" 9 70 fi - systemctl enable docker.service > /dev/null 2>&1 - systemctl enable containerd.service > /dev/null 2>&1 - whiptail --msgbox "To test that Docker has installed successfully\nrun the following command: docker run hello-world" 9 70 else - whiptail --msgbox "ERROR ! $distro $(. /etc/os-release && echo "$VERSION_CODENAME") distribution not found in repository!" 7 70 + whiptail --msgbox "ERROR ! ${DISTRO} $DISTROID distribution not found in repository!" 7 70 fi -} +} \ No newline at end of file From 762bf3aebefc80fba2441e88ec03899aa0af3a47 Mon Sep 17 00:00:00 2001 From: Tearran Date: Tue, 24 Sep 2024 23:20:18 -0500 Subject: [PATCH 31/32] fix styles --- lib/armbian-configng/config.ng.software.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/armbian-configng/config.ng.software.sh b/lib/armbian-configng/config.ng.software.sh index bd01f24b..84ff09b2 100644 --- a/lib/armbian-configng/config.ng.software.sh +++ b/lib/armbian-configng/config.ng.software.sh @@ -105,4 +105,4 @@ install_docker() { else whiptail --msgbox "ERROR ! ${DISTRO} $DISTROID distribution not found in repository!" 7 70 fi -} \ No newline at end of file +} From 0f1b197cea23b3313be47350ec813d1f563c498b Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 25 Sep 2024 14:39:29 +0200 Subject: [PATCH 32/32] Return tests that were deleted accidentally --- tests/S17.conf | 3 +++ tests/S18.conf | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 tests/S17.conf create mode 100644 tests/S18.conf diff --git a/tests/S17.conf b/tests/S17.conf new file mode 100644 index 00000000..12b75eca --- /dev/null +++ b/tests/S17.conf @@ -0,0 +1,3 @@ +ENABLED=true +PREINSTALL="bash bin/armbian-configng --cmd S18" +CONDITION="[ ! -f /usr/bin/zsh ]" diff --git a/tests/S18.conf b/tests/S18.conf new file mode 100644 index 00000000..bea6f840 --- /dev/null +++ b/tests/S18.conf @@ -0,0 +1,2 @@ +ENABLED=true +CONDITION="[ -f /usr/bin/zsh ]"