From e820b962305e94f18bd03fc812dcbb128efd4960 Mon Sep 17 00:00:00 2001 From: Igor Date: Fri, 13 Sep 2024 01:34:48 +0200 Subject: [PATCH] Refactor applications, add desktop execution (#66) * Refactor applications, add desktop execution * Bugfixing --- lib/armbian-configng/config.ng.jobs.json | 244 +++++++++++++++++++---- lib/armbian-configng/config.ng.system.sh | 59 ++++++ 2 files changed, 267 insertions(+), 36 deletions(-) diff --git a/lib/armbian-configng/config.ng.jobs.json b/lib/armbian-configng/config.ng.jobs.json index 89cfd3ea7..11d91c7c3 100644 --- a/lib/armbian-configng/config.ng.jobs.json +++ b/lib/armbian-configng/config.ng.jobs.json @@ -466,38 +466,6 @@ "doc_link": "", "src_reference": "", "author": "" - }, - { - "id": "N17", - "description": "Announce system in the network (Avahi)", - "prompt": "This operation will install avahi-daemon and add configuration files.\nDo you wish to continue?", - "command": [ - "check_if_installed avahi-daemon", - "debconf-apt-progress -- apt-get -y install avahi-daemon libnss-mdns", - "cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/", - "cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/", - "service avahi-daemon restart" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "! check_if_installed avahi-daemon" - }, - { - "id": "N18", - "description": "Disable system announce in the network (Avahi)", - "prompt": "This operation will purge avahi-daemon\nDo you wish to continue?", - "command": [ - "check_if_installed avahi-daemon", - "systemctl stop avahi-daemon avahi-daemon.socket", - "debconf-apt-progress -- apt-get -y purge avahi-daemon" - ], - "status": "Active", - "doc_link": "", - "src_reference": "", - "author": "", - "condition": "check_if_installed avahi-daemon" } ] }, @@ -559,7 +527,211 @@ "description": "Run/Install 3rd party applications", "sub": [ { - "id": "I00", + "id": "SW01", + "description": "Desktop Environments", + "sub": [ + { + "id": "SW02", + "description": "Install XFCE desktop", + "command": [ "install_de \"xfce\""], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "" + }, + { + "id": "SW03", + "description": "Install Gnome desktop", + "command": [ "install_de \"gnome\""], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "" + }, + { + "id": "SW04", + "description": "Install i3-wm desktop", + "command": [ "install_de \"i3-wm\""], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "" + }, + { + "id": "SW05", + "description": "Install Cinnamon desktop", + "command": [ "install_de \"cinnamon\""], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "" + }, + { + "id": "SW06", + "description": "Install kde-neon desktop", + "command": [ "install_de \"kde-neon\""], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "" + } + ] + }, + { + "id": "SW07", + "description": "Network tools", + "sub": [ + { + "id": "SW08", + "description": "Install realtime console network usage monitor (nload)", + "command": [ + "get_user_continue \"This operation will install nload.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y install nload" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed nload" + }, + { + "id": "SW09", + "description": "Remove realtime console network usage monitor (nload)", + "command": [ + "get_user_continue \"This operation will purge nload.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y purge nload" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed nload" + }, + { + "id": "SW10", + "description": "Install bandwidth measuring tool (iperf3)", + "command": [ + "get_user_continue \"This operation will install iperf3.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y install iperf3" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed iperf3" + }, + { + "id": "SW11", + "description": "Remove bandwidth measuring tool (iperf3)", + "command": [ + "get_user_continue \"This operation will purge iperf3.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y purge iperf3" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed iperf3" + }, + { + "id": "SW12", + "description": "Install IP LAN monitor (iptraf-ng)", + "command": [ + "get_user_continue \"This operation will install iptraf-ng.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y install iptraf-ng" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed iptraf-ng" + }, + { + "id": "SW13", + "description": "Remove IP LAN monitor (iptraf-ng)", + "command": [ + "get_user_continue \"This operation will purge nload.\n\nDo you wish to continue?\" process_input", + "debconf-apt-progress -- apt-get -y purge iptraf-ng" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed iptraf-ng" + }, + { + "id": "SW14", + "description": "Install hostname broadcast via mDNS (avahi-daemon)", + "command": [ + "get_user_continue \"This operation will install avahi-daemon and add configuration files.\nDo you wish to continue?\" process_input", + "check_if_installed avahi-daemon", + "debconf-apt-progress -- apt-get -y install avahi-daemon libnss-mdns", + "cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/", + "cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/", + "service avahi-daemon restart" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "! check_if_installed avahi-daemon" + }, + { + "id": "SW15", + "description": "Remove hostname broadcast via mDNS (avahi-daemon)", + "command": [ + "get_user_continue \"This operation will purge avahi-daemon \nDo you wish to continue?\" process_input", + "check_if_installed avahi-daemon", + "systemctl stop avahi-daemon avahi-daemon.socket", + "debconf-apt-progress -- apt-get -y purge avahi-daemon" + ], + "status": "Active", + "doc_link": "", + "src_reference": "", + "author": "", + "condition": "check_if_installed avahi-daemon" + } + ] + }, + { + "id": "SW16", + "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" ], @@ -569,8 +741,8 @@ "author": "" }, { - "id": "I01", - "description": "System benchmaking and diagnostics", + "id": "SW20", + "description": "SWystem benchmaking and diagnostics", "command": [ "see_monitoring" ], @@ -578,7 +750,7 @@ "doc_link": "", "src_reference": "", "author": "", - "condition": "ls /usr/bin/armbianmonitor" + "condition": "[ -f /usr/bin/armbianmonitor ]" } ] diff --git a/lib/armbian-configng/config.ng.system.sh b/lib/armbian-configng/config.ng.system.sh index f24a8e17c..161091cee 100644 --- a/lib/armbian-configng/config.ng.system.sh +++ b/lib/armbian-configng/config.ng.system.sh @@ -1,6 +1,65 @@ #!/bin/bash +module_options+=( +["install_de,author"]="Igor Pecovnik" +["install_de,ref_link"]="" +["install_de,feature"]="install_de" +["install_de,desc"]="Install DE" +["install_de,example"]="install_de" +["install_de,status"]="Active" +) +# +# Install desktop +# +function install_de (){ + + # get user who executed this script + if [ $SUDO_USER ]; then local user=$SUDO_USER; else local user=`whoami`; fi + + #debconf-apt-progress -- + apt-get update + #debconf-apt-progress -- + apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends install armbian-${DISTROID}-desktop-$1 # armbian-bsp-desktop-${BOARD}-${BRANCH} + + # clean apt cache + apt-get -y clean + + # add user to groups + for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do + usermod -aG ${additionalgroup} ${user} 2>/dev/null + done + + # set up profile sync daemon on desktop systems + which psd >/dev/null 2>&1 + if [[ $? -eq 0 && -z $(grep overlay-helper /etc/sudoers) ]]; then + echo "${user} ALL=(ALL) NOPASSWD: /usr/bin/psd-overlay-helper" >> /etc/sudoers + touch /home/${user}/.activate_psd + fi + + # update skel + update_skel + + # desktops has different default login managers + case "$1" in + gnome) + # gdm3 + ;; + *) + # lightdm + mkdir -p /etc/lightdm/lightdm.conf.d + echo "[Seat:*]" > /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf + echo "autologin-user=${username}" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf + echo "autologin-user-timeout=0" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf + echo "user-session=xfce" >> /etc/lightdm/lightdm.conf.d/22-armbian-autologin.conf + ln -s /lib/systemd/system/lightdm.service /etc/systemd/system/display-manager.service >/dev/null 2>&1 + service lightdm start >/dev/null 2>&1 + ;; + esac +exit +} + + module_options+=( ["update_skel,author"]="Igor Pecovnik" ["update_skel,ref_link"]=""