diff --git a/lib/armbian-configng/config.ng.functions.sh b/lib/armbian-configng/config.ng.functions.sh index e241659b..287d6bee 100644 --- a/lib/armbian-configng/config.ng.functions.sh +++ b/lib/armbian-configng/config.ng.functions.sh @@ -95,7 +95,7 @@ module_options+=( function check_if_installed (){ local DPKG_Status="$(dpkg -s "$1" 2>/dev/null | awk -F": " '/^Status/ {print $2}')" - if [[ "X${DPKG_Status}" = "X" || "${DPKG_Status}" = *deinstall* ]]; then + if [[ "X${DPKG_Status}" = "X" || "${DPKG_Status}" = *deinstall* || "${DPKG_Status}" = *not-installed* ]]; then return 1 else return 0 @@ -212,12 +212,12 @@ function set_runtime_variables(){ fi fi - # Determine which network renderer is in use for NetPlan - if systemctl is-active systemd-networkd 1>/dev/null; then - renderer=networkd - else - renderer=NetworkManager - fi + # Determine which network renderer is in use for NetPlan + if systemctl is-active systemd-networkd 1>/dev/null; then + renderer=networkd + else + renderer=NetworkManager + fi DIALOG_CANCEL=1 DIALOG_ESC=255 diff --git a/lib/armbian-configng/config.ng.jobs.json b/lib/armbian-configng/config.ng.jobs.json index 559038cf..1762f236 100644 --- a/lib/armbian-configng/config.ng.jobs.json +++ b/lib/armbian-configng/config.ng.jobs.json @@ -724,7 +724,118 @@ "src_reference": "", "author": "", "condition": "[ -f /usr/bin/armbianmonitor ]" - + }, + { + "id": "SW01.4", + "description": "Softy - 3rd party apps", + "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 ]" + } + ] } ] }, diff --git a/lib/armbian-configng/config.ng.software.sh b/lib/armbian-configng/config.ng.software.sh index f8a8dc45..4575f44d 100644 --- a/lib/armbian-configng/config.ng.software.sh +++ b/lib/armbian-configng/config.ng.software.sh @@ -1,22 +1,114 @@ module_options+=( - ["see_monitoring,author"]="Joey Turner" - ["see_monitoring,ref_link"]="" - ["see_monitoring,feature"]="see_monitoring" - ["see_monitoring,desc"]="Menu for armbianmonitor features" - ["see_monitoring,example"]="see_monitoring" - ["see_monitoring,status"]="review" - ["see_monitoring,doc_link"]="" + ["see_monitoring,author"]="Joey Turner" + ["see_monitoring,ref_link"]="" + ["see_monitoring,feature"]="see_monitoring" + ["see_monitoring,desc"]="Menu for armbianmonitor features" + ["see_monitoring,example"]="see_monitoring" + ["see_monitoring,status"]="review" + ["see_monitoring,doc_link"]="" ) # # @decrition generate a menu for armbianmonitor # function see_monitoring() { - if [ -f /usr/bin/htop ]; then - choice=$(armbianmonitor -h | grep -Ev '^\s*-c\s|^\s*-M\s' | show_menu) + if [ -f /usr/bin/htop ]; then + choice=$(armbianmonitor -h | grep -Ev '^\s*-c\s|^\s*-M\s' | show_menu) - armbianmonitor -$choice - - else - echo "htop is not installed" - fi + armbianmonitor -$choice + + else + echo "htop is not installed" + fi +} + +module_options+=( + ["update_skel,author"]="Kat Schwarz" + ["update_skel,ref_link"]="" + ["update_skel,feature"]="install_plexmediaserver" + ["update_skel,desc"]="Install plexmediaserver from repo using apt" + ["update_skel,example"]="install_plexmediaserver" + ["update_skel,status"]="Active" +) +# +# Install plexmediaserver using apt +# +install_plexmediaserver() { + if [ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]; then + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/plexmediaserver.gpg] https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1 + else + sed -i "/downloads.plex.tv/s/^#//g" /etc/apt/sources.list.d/plexmediaserver.list > /dev/null 2>&1 + fi + # Note: for compatibility with existing source file in some builds format must be gpg not asc + # and location must be /usr/share/keyrings + wget -qO- https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor | sudo tee /usr/share/keyrings/plexmediaserver.gpg > /dev/null 2>&1 + apt_install_wrapper apt-get update + apt_install_wrapper apt-get -y install plexmediaserver + whiptail --msgbox "To test that Plex Media Server has installed successfully\nIn a web browser go to http://localhost:32400/web or \nhttp://127.0.0.1:32400/web on this computer." 9 70 +} + +module_options+=( + ["update_skel,author"]="Kat Schwarz" + ["update_skel,ref_link"]="" + ["update_skel,feature"]="install_embyserver" + ["update_skel,desc"]="Download a embyserver deb file from a URL and install using apt" + ["update_skel,example"]="install_embyserver" + ["update_skel,status"]="Active" +) +# +# Download a deb file from a URL and install using wget and apt with dialog progress bars +# +install_embyserver() { + URL=$(curl -s https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | + grep "/emby-server-deb.*$(dpkg --print-architecture).deb" | cut -d : -f 2,3 | tr -d '"') + cd ~/ + wget -O "emby-server.deb" $URL 2>&1 | stdbuf -oL awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | + whiptail --gauge "Please wait\nDownloading ${URL##*/}" 8 70 0 + apt_install_wrapper apt-get -y install ~/emby-server.deb + unlink emby-server.deb + whiptail --msgbox "To test that Emby Server has installed successfully\nIn a web browser go to http://localhost:8096 or \nhttp://127.0.0.1:8096 on this computer." 9 70 +} + +module_options+=( + ["update_skel,author"]="Kat Schwarz" + ["update_skel,ref_link"]="" + ["update_skel,feature"]="install_docker" + ["update_skel,desc"]="Install docker from a repo using apt" + ["update_skel,example"]="install_docker engine" + ["update_skel,status"]="Active" +) +# +# Install Docker from repo using apt +# Setup sources list and GPG key then install the app. If you want a full desktop then $1=desktop +# +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")" + 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 + 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 + fi }