diff --git a/tools/json/config.network.json b/tools/json/config.network.json index 27484bb6..a340c587 100644 --- a/tools/json/config.network.json +++ b/tools/json/config.network.json @@ -55,25 +55,24 @@ "description": "Install Bluetooth support", "command": [ "see_current_apt ", - "debconf-apt-progress -- apt-get -y install bluetooth bluez bluez-tools", - "check_if_installed xserver-xorg && debconf-apt-progress -- apt-get -y --no-install-recommends install pulseaudio-module-bluetooth blueman" + "pkg_install bluetooth bluez bluez-tools", + "pkg_installed xserver-xorg && pkg_install --no-install-recommends pulseaudio-module-bluetooth blueman" ], "status": "Disabled", "author": "@armbian", - "condition": "! check_if_installed bluetooth && ! check_if_installed bluez && ! check_if_installed bluez-tools" + "condition": "! pkg_installed bluetooth && ! pkg_installed bluez && ! pkg_installed bluez-tools" }, { "id": "NE102", "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 -y -qq autoremove" + "pkg_remove bluetooth bluez bluez-tools", + "pkg_installed xserver-xorg && pkg_remove pulseaudio-module-bluetooth blueman" ], "status": "Disabled", "author": "@armbian", - "condition": "check_if_installed bluetooth || check_if_installed bluez || check_if_installed bluez-tools" + "condition": "pkg_installed bluetooth || pkg_installed bluez || pkg_installed bluez-tools" }, { "id": "NE103", @@ -84,7 +83,7 @@ ], "status": "Disabled", "author": "@armbian", - "condition": "check_if_installed bluetooth || check_if_installed bluez || check_if_installed bluez-tools" + "condition": "pkg_installed bluetooth || pkg_installed bluez || pkg_installed bluez-tools" }, { "id": "NE104", @@ -100,4 +99,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/tools/json/config.software.json b/tools/json/config.software.json index a28cb4e7..be4353eb 100644 --- a/tools/json/config.software.json +++ b/tools/json/config.software.json @@ -266,94 +266,94 @@ "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" + "pkg_install nload" ], "status": "Stable", "author": "@armbian", - "condition": "! check_if_installed nload" + "condition": "! pkg_installed nload" }, { "id": "NET002", "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" + "pkg_remove nload" ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed nload" + "condition": "pkg_installed nload" }, { "id": "NET003", "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" + "pkg_install iperf3" ], "status": "Stable", "author": "@armbian", - "condition": "! check_if_installed iperf3" + "condition": "! pkg_installed iperf3" }, { "id": "NET004", "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" + "pkg_remove iperf3" ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed iperf3" + "condition": "pkg_installed iperf3" }, { "id": "NET005", "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" + "pkg_install iptraf-ng" ], "status": "Stable", "author": "@armbian", - "condition": "! check_if_installed iptraf-ng" + "condition": "! pkg_installed iptraf-ng" }, { "id": "NET006", "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" + "pkg_remove iptraf-ng" ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed iptraf-ng" + "condition": "pkg_installed iptraf-ng" }, { "id": "NET007", "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", + "pkg_installed avahi-daemon", + "pkg_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": "Stable", "author": "@armbian", - "condition": "! check_if_installed avahi-daemon" + "condition": "! pkg_installed avahi-daemon" }, { "id": "NET008", "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", + "pkg_installed avahi-daemon", "systemctl stop avahi-daemon avahi-daemon.socket", - "debconf-apt-progress -- apt-get -y purge avahi-daemon" + "pkg_remove avahi-daemon" ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed avahi-daemon" + "condition": "pkg_installed avahi-daemon" } ] }, @@ -724,22 +724,22 @@ "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" + "pkg_install git" ], "status": "Stable", "author": "@armbian", - "condition": "! check_if_installed git" + "condition": "! pkg_installed git" }, { "id": "DEV002", "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" + "pkg_remove git" ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed git" + "condition": "pkg_installed git" } ] }, @@ -755,7 +755,7 @@ ], "status": "Stable", "author": "@armbian", - "condition": "! check_if_installed openhab" + "condition": "! pkg_installed openhab" }, { "id": "HA002", @@ -765,7 +765,7 @@ ], "status": "Stable", "author": "@armbian", - "condition": "check_if_installed openhab" + "condition": "pkg_installed openhab" }, { "id": "HA003", @@ -775,7 +775,7 @@ ], "status": "Preview", "author": "@igorpecovnik", - "condition": "! check_if_installed homeassistant-supervised && grep -q bookworm /etc/os-release" + "condition": "! pkg_installed homeassistant-supervised && grep -q bookworm /etc/os-release" }, { "id": "HA004", @@ -785,7 +785,7 @@ ], "status": "Preview", "author": "@igorpecovnik", - "condition": "check_if_installed homeassistant-supervised" + "condition": "pkg_installed homeassistant-supervised" } ] }, @@ -812,7 +812,7 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed docker-ce" + "condition": "! pkg_installed docker-ce" }, { "id": "CON002", @@ -823,18 +823,18 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed docker-compose-plugin" + "condition": "! pkg_installed docker-compose-plugin" }, { "id": "CON003", "description": "Remove Docker", "about": "This operation will purge Docker.", "command": [ - "apt_install_wrapper apt -y purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras" + "pkg_remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras" ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed docker-ce" + "condition": "pkg_installed docker-ce" }, { "id": "CON004", @@ -846,7 +846,7 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed docker-ce && [ -d /var/lib/docker ]" + "condition": "! pkg_installed docker-ce && [ -d /var/lib/docker ]" }, { "id": "CON005", @@ -905,19 +905,19 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed plexmediaserver" + "condition": "! pkg_installed plexmediaserver" }, { "id": "MED002", "description": "Remove Plex Media server", "about": "This operation will purge Plex Media server.", "command": [ - "apt_install_wrapper apt-get -y purge plexmediaserver", + "pkg_remove plexmediaserver", "sed -i '/plexmediaserver.gpg/s/^/#/g' /etc/apt/sources.list.d/plexmediaserver.list" ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed plexmediaserver" + "condition": "pkg_installed plexmediaserver" }, { "id": "MED003", @@ -928,18 +928,18 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed emby-server" + "condition": "! pkg_installed emby-server" }, { "id": "MED004", "description": "Remove Emby server", "about": "This operation will purge Emby server.", "command": [ - "apt_install_wrapper apt -y purge emby-server" + "pkg_remove emby-server" ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed emby-server" + "condition": "pkg_installed emby-server" }, { "id": "MED010", @@ -1140,22 +1140,22 @@ "about": "This operation will install Cockpit.\ncockpit cockpit-ws cockpit-system cockpit-storaged", "command": [ "see_current_apt update", - "apt_install_wrapper apt -y install cockpit cockpit-ws cockpit-system cockpit-storaged " + "pkg_install cockpit cockpit-ws cockpit-system cockpit-storaged " ], "status": "Stable", "author": "@schwar3kat", - "condition": "! check_if_installed cockpit" + "condition": "! pkg_installed cockpit" }, { "id": "MAN002", "description": "Purge Cockpit web-based management tool", "about": "This operation will purge Cockpit.", "command": [ - "apt_install_wrapper apt -y purge cockpit" + "pkg_remove cockpit" ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed cockpit" + "condition": "pkg_installed cockpit" }, { "id": "MAN003", @@ -1165,7 +1165,7 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed cockpit && ! systemctl is-enabled cockpit.socket > /dev/null 2>&1" + "condition": "pkg_installed cockpit && ! systemctl is-enabled cockpit.socket > /dev/null 2>&1" }, { "id": "MAN004", @@ -1176,7 +1176,7 @@ ], "status": "Stable", "author": "@schwar3kat", - "condition": "check_if_installed cockpit && systemctl is-enabled cockpit.socket > /dev/null 2>&1" + "condition": "pkg_installed cockpit && systemctl is-enabled cockpit.socket > /dev/null 2>&1" }, { "id": "MAN005", diff --git a/tools/json/config.system.json b/tools/json/config.system.json index 6be7d453..c9fa9783 100644 --- a/tools/json/config.system.json +++ b/tools/json/config.system.json @@ -235,7 +235,7 @@ "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", + "! pkg_installed libpam-google-authenticator && ! pkg_installed qrencode || pkg_remove 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 2>/dev/null | systemctl restart ssh.service 2>/dev/null" @@ -248,8 +248,8 @@ "id": "SY108", "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", + "pkg_installed libpam-google-authenticator || pkg_install libpam-google-authenticator", + "pkg_installed qrencode || pkg_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", @@ -257,7 +257,7 @@ ], "status": "Stable", "author": "@igorpecovnik", - "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" + "condition": "! pkg_installed libpam-google-authenticator || ! pkg_installed qrencode || grep -q '^ChallengeResponseAuthentication no' /etc/ssh/sshd_config || ! grep -q 'ChallengeResponseAuthentication' /etc/ssh/sshd_config" }, { "id": "SY109", diff --git a/tools/modules/functions/check_desktop.sh b/tools/modules/functions/check_desktop.sh index a17f5fdc..49f2fd67 100644 --- a/tools/modules/functions/check_desktop.sh +++ b/tools/modules/functions/check_desktop.sh @@ -15,9 +15,9 @@ function check_desktop() { DISPLAY_MANAGER="" DESKTOP_INSTALLED="" - check_if_installed nodm && DESKTOP_INSTALLED="nodm" - check_if_installed lightdm && DESKTOP_INSTALLED="lightdm" - check_if_installed lightdm && DESKTOP_INSTALLED="gnome" + pkg_installed nodm && DESKTOP_INSTALLED="nodm" + pkg_installed lightdm && DESKTOP_INSTALLED="lightdm" + pkg_installed lightdm && DESKTOP_INSTALLED="gnome" [[ -n $(service lightdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="lightdm" [[ -n $(service nodm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="nodm" [[ -n $(service gdm status 2> /dev/null | grep -w active) ]] && DISPLAY_MANAGER="gdm" diff --git a/tools/modules/functions/check_if_installed.sh b/tools/modules/functions/check_if_installed.sh deleted file mode 100644 index d7bf1fb0..00000000 --- a/tools/modules/functions/check_if_installed.sh +++ /dev/null @@ -1,22 +0,0 @@ -module_options+=( - ["check_if_installed,author"]="@armbian" - ["check_if_installed,ref_link"]="" - ["check_if_installed,feature"]="check_if_installed" - ["check_if_installed,desc"]="Migrated procedures from Armbian config." - ["check_if_installed,example"]="check_if_installed nano" - ["check_if_installed,status"]="Active" -) -# -# check dpkg status of $1 -- currently only 'not installed at all' case caught -# -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* || "${DPKG_Status}" = *not-installed* ]]; then - return 1 - else - return 0 - fi - -} - diff --git a/tools/modules/functions/config_interface.sh b/tools/modules/functions/config_interface.sh index e512e6da..f4669824 100644 --- a/tools/modules/functions/config_interface.sh +++ b/tools/modules/functions/config_interface.sh @@ -460,7 +460,7 @@ see_current_apt() { return 0 # The package lists are up-to-date else [[ "$update_apt" != "update" ]] && echo "Update the package lists." # Suggest updating - [[ "$update_apt" == "update" ]] && apt_install_wrapper apt-get update + [[ "$update_apt" == "update" ]] && pkg_update return 0 # The package lists are not up-to-date fi } diff --git a/tools/modules/functions/package.sh b/tools/modules/functions/package.sh new file mode 100644 index 00000000..38635ce4 --- /dev/null +++ b/tools/modules/functions/package.sh @@ -0,0 +1,97 @@ +# package.sh + +# internal function +_pkg_have_stdin() { [[ -t 0 ]]; } + +declare -A module_options +module_options+=( + ["pkg_configure,author"]="@dimitry-ishenko" + ["pkg_configure,desc"]="Configure an unconfigured package" + ["pkg_configure,example"]="pkg_configure" + ["pkg_configure,feature"]="pkg_configure" + ["pkg_configure,status"]="Interface" +) + +pkg_configure() +{ + _pkg_have_stdin && debconf-apt-progress -- dpkg --configure "$@" || dpkg --configure "$@" +} + +module_options+=( + ["pkg_full_upgrade,author"]="@dimitry-ishenko" + ["pkg_full_upgrade,desc"]="Upgrade installed packages (potentially removing some)" + ["pkg_full_upgrade,example"]="pkg_full_upgrade" + ["pkg_full_upgrade,feature"]="pkg_full_upgrade" + ["pkg_full_upgrade,status"]="Interface" +) + +pkg_full_upgrade() +{ + _pkg_have_stdin && debconf-apt-progress -- apt-get -y full-upgrade "$@" || apt-get -y full-upgrade "$@" +} + +module_options+=( + ["pkg_install,author"]="@dimitry-ishenko" + ["pkg_install,desc"]="Install package" + ["pkg_install,example"]="pkg_install neovim" + ["pkg_install,feature"]="pkg_install" + ["pkg_install,status"]="Interface" +) + +pkg_install() +{ + _pkg_have_stdin && debconf-apt-progress -- apt-get -y install "$@" || apt-get -y install "$@" +} + +module_options+=( + ["pkg_installed,author"]="@dimitry-ishenko" + ["pkg_installed,desc"]="Check if package is installed" + ["pkg_installed,example"]="pkg_installed mc" + ["pkg_installed,feature"]="pkg_installed" + ["pkg_installed,status"]="Interface" +) + +pkg_installed() +{ + local status=$(dpkg -s "$1" 2>/dev/null | sed -n "s/Status: //p") + ! [[ -z "$status" || "$status" = *deinstall* || "$status" = *not-installed* ]] +} + +module_options+=( + ["pkg_remove,author"]="@dimitry-ishenko" + ["pkg_remove,desc"]="Remove package" + ["pkg_remove,example"]="pkg_remove nmap" + ["pkg_remove,feature"]="pkg_remove" + ["pkg_remove,status"]="Interface" +) + +pkg_remove() +{ + _pkg_have_stdin && debconf-apt-progress -- apt-get -y autopurge "$@" || apt-get -y autopurge "$@" +} + +module_options+=( + ["pkg_update,author"]="@dimitry-ishenko" + ["pkg_update,desc"]="Update package repository" + ["pkg_update,example"]="pkg_update" + ["pkg_update,feature"]="pkg_update" + ["pkg_update,status"]="Interface" +) + +pkg_update() +{ + _pkg_have_stdin && debconf-apt-progress -- apt-get -y update || apt-get -y update +} + +module_options+=( + ["pkg_upgrade,author"]="@dimitry-ishenko" + ["pkg_upgrade,desc"]="Upgrade installed packages" + ["pkg_upgrade,example"]="pkg_upgrade" + ["pkg_upgrade,feature"]="pkg_upgrade" + ["pkg_upgrade,status"]="Interface" +) + +pkg_upgrade() +{ + _pkg_have_stdin && debconf-apt-progress -- apt-get -y upgrade "$@" || apt-get -y upgrade "$@" +} diff --git a/tools/modules/functions/set_runtime_variables.sh b/tools/modules/functions/set_runtime_variables.sh index 96dcab05..374da15f 100644 --- a/tools/modules/functions/set_runtime_variables.sh +++ b/tools/modules/functions/set_runtime_variables.sh @@ -26,7 +26,7 @@ function set_runtime_variables() { # If any dependencies are missing, print a combined message and exit if [[ ${#missing_dependencies[@]} -ne 0 ]]; then if is_package_manager_running; then - sudo apt install ${missing_dependencies[*]} + pkg_install ${missing_dependencies[*]} fi fi @@ -45,8 +45,7 @@ function set_runtime_variables() { if is_package_manager_running; then sleep 3 fi - debconf-apt-progress -- apt-get update - debconf-apt-progress -- apt -y -qq --allow-downgrades --no-install-recommends install lsb-release + pkg_install --update --allow-downgrades --no-install-recommends lsb-release fi [[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE" diff --git a/tools/modules/network/default_network_config.sh b/tools/modules/network/default_network_config.sh index 3992ea36..a8105ea9 100644 --- a/tools/modules/network/default_network_config.sh +++ b/tools/modules/network/default_network_config.sh @@ -33,12 +33,12 @@ function default_network_config() { # exceptions if [[ "${NETWORK_RENDERER}" == "NetworkManager" ]]; then # uninstall packages - apt_install_wrapper apt-get -y purge hostapd + pkg_remove hostapd netplan apply nmcli con down br0 else # uninstall packages - apt_install_wrapper apt-get -y purge hostapd networkd-dispatcher + pkg_remove hostapd networkd-dispatcher # drop and delete bridge interface in case its there if [[ -n $(ip link show type bridge) ]]; then ip link set br0 down >/dev/null 2>&1 diff --git a/tools/modules/network/default_wireless_network_config.sh b/tools/modules/network/default_wireless_network_config.sh index de205bdf..4bff6608 100644 --- a/tools/modules/network/default_wireless_network_config.sh +++ b/tools/modules/network/default_wireless_network_config.sh @@ -37,14 +37,14 @@ function default_wireless_network_config(){ # exceptions if [[ "${NETWORK_RENDERER}" == "NetworkManager" ]]; then - # uninstall packages - apt_install_wrapper apt-get -y --no-install-recommends purge hostapd - systemctl restart NetworkManager - else - # uninstall packages - apt_install_wrapper apt-get -y --no-install-recommends purge hostapd networkd-dispatcher - brctl delif br0 $adapter 2> /dev/null - networkctl reconfigure br0 + # uninstall packages + pkg_remove hostapd + systemctl restart NetworkManager + else + # uninstall packages + pkg_remove hostapd networkd-dispatcher + brctl delif br0 $adapter 2> /dev/null + networkctl reconfigure br0 fi } diff --git a/tools/modules/network/module_nfsd.sh b/tools/modules/network/module_nfsd.sh index e18d80b9..2073e5b6 100644 --- a/tools/modules/network/module_nfsd.sh +++ b/tools/modules/network/module_nfsd.sh @@ -24,13 +24,13 @@ function module_nfsd () { case "$1" in "${commands[0]}") - apt_install_wrapper apt-get -y install nfs-common nfs-kernel-server + pkg_install nfs-common nfs-kernel-server # add some exports ${module_options["module_nfsd,feature"]} ${commands[2]} systemctl restart nfs-server.service ;; "${commands[1]}") - apt_install_wrapper apt-get -y autopurge nfs-kernel-server + pkg_remove nfs-kernel-server ;; "${commands[2]}") while true; do diff --git a/tools/modules/network/network_config.sh b/tools/modules/network/network_config.sh index 0dcdf56b..e189743c 100644 --- a/tools/modules/network/network_config.sh +++ b/tools/modules/network/network_config.sh @@ -112,7 +112,7 @@ function network_config() { if [[ -f /etc/netplan/armbian.yaml && "$(netplan get bridges)" != "null" ]]; then ip link set ${adapter} up default_wireless_network_config "${yamlfile}" "${adapter}" - apt_install_wrapper apt-get -y --no-install-recommends install hostapd networkd-dispatcher bridge-utils + pkg_install --no-install-recommends hostapd networkd-dispatcher bridge-utils SELECTED_SSID=$($DIALOG --title "Enter SSID for AP" --inputbox "\nHit enter for defaults" 9 50 "armbian" 3>&1 1>&2 2>&3) if [[ -n "${SELECTED_SSID}" && $? == 0 ]]; then SELECTED_PASSWORD=$($DIALOG --title "Enter new password for $SELECTED_SSID" --passwordbox "\nDefault password: 12345678\n" 9 50 "12345678" 3>&1 1>&2 2>&3) diff --git a/tools/modules/software/install_bazarr.sh b/tools/modules/software/install_bazarr.sh index b1c417b4..39852e77 100644 --- a/tools/modules/software/install_bazarr.sh +++ b/tools/modules/software/install_bazarr.sh @@ -14,7 +14,7 @@ function module_bazarr () { local title="bazarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/bazarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/bazarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_bazarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$BAZARR_BASE" ]] || mkdir -p "$BAZARR_BASE" || { echo "Couldn't create storage directory: $BAZARR_BASE"; exit 1; } docker run -d \ --name=bazarr \ diff --git a/tools/modules/software/install_deluge.sh b/tools/modules/software/install_deluge.sh index 4efff7d5..66b91177 100644 --- a/tools/modules/software/install_deluge.sh +++ b/tools/modules/software/install_deluge.sh @@ -14,7 +14,7 @@ function module_deluge () { local title="deluge" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/deluge?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/deluge?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_deluge () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$DELUGE_BASE" ]] || mkdir -p "$DELUGE_BASE" || { echo "Couldn't create storage directory: $DELUGE_BASE"; exit 1; } docker run -d \ --name=deluge \ diff --git a/tools/modules/software/install_docker.sh b/tools/modules/software/install_docker.sh index d0b33cfc..dc9a8107 100644 --- a/tools/modules/software/install_docker.sh +++ b/tools/modules/software/install_docker.sh @@ -22,12 +22,12 @@ install_docker() { 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 + pkg_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 + pkg_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 + pkg_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 diff --git a/tools/modules/software/install_embyserver.sh b/tools/modules/software/install_embyserver.sh index 8fab9e11..246564f8 100644 --- a/tools/modules/software/install_embyserver.sh +++ b/tools/modules/software/install_embyserver.sh @@ -17,7 +17,7 @@ install_embyserver() { cd ~/ wget -O "emby-server.deb" $URL 2>&1 | stdbuf -oL awk '/[.] +[0-9][0-9]?[0-9]?%/ { print substr($0,63,3) }' | $DIALOG --gauge "Please wait\nDownloading ${URL##*/}" 8 70 0 - apt_install_wrapper apt-get -y install ~/emby-server.deb + pkg_install ~/emby-server.deb unlink emby-server.deb $DIALOG --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 } diff --git a/tools/modules/software/install_haos.sh b/tools/modules/software/install_haos.sh index 4d8725cc..8e02ee41 100644 --- a/tools/modules/software/install_haos.sh +++ b/tools/modules/software/install_haos.sh @@ -14,7 +14,7 @@ module_haos() { - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/home-assistant/{print $1}') local image=$(docker image ls -a | mawk '/home-assistant/{print $3}') fi @@ -38,7 +38,7 @@ module_haos() { echo ;; install) - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker # this hack will allow running it on minimal image, but this has to be done properly in the network section, to allow easy switching systemctl disable systemd-networkd @@ -50,7 +50,7 @@ module_haos() { # https://github.com/armbian/os/blob/main/external/haos-agent.conf # https://github.com/armbian/os/blob/main/external/haos-supervised-installer.conf - apt_install_wrapper apt-get -y install --download-only homeassistant-supervised os-agent + pkg_install --download-only homeassistant-supervised os-agent # determine machine type case "${ARCH}" in @@ -61,7 +61,7 @@ module_haos() { esac # this we can't put behind wrapper - MACHINE="${MACHINE}" apt-get -y install homeassistant-supervised os-agent + MACHINE="${MACHINE}" pkg_install homeassistant-supervised os-agent # workarounding supervisor loosing healthy state https://github.com/home-assistant/supervisor/issues/4381 cat <<- SUPERVISOR_FIX > "/usr/local/bin/supervisor_fix.sh" @@ -124,7 +124,7 @@ module_haos() { # disable service systemctl disable supervisor-fix >/dev/null 2>&1 systemctl stop supervisor-fix >/dev/null 2>&1 - apt_install_wrapper apt-get -y purge homeassistant-supervised os-agent + pkg_remove homeassistant-supervised os-agent echo -e "Removing Home Assistant containers.\n\nPlease wait few minutes! " if [[ "${container}" ]]; then echo "${container}" | xargs docker stop >/dev/null 2>&1 diff --git a/tools/modules/software/install_jellyseerr.sh b/tools/modules/software/install_jellyseerr.sh index 21609c34..8bbf020f 100644 --- a/tools/modules/software/install_jellyseerr.sh +++ b/tools/modules/software/install_jellyseerr.sh @@ -14,7 +14,7 @@ function module_jellyseerr () { local title="jellyseerr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/jellyseerr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/jellyseerr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_jellyseerr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$JELLYSEERR_BASE" ]] || mkdir -p "$JELLYSEERR_BASE" || { echo "Couldn't create storage directory: $JELLYSEERR_BASE"; exit 1; } docker run -d \ --name jellyseerr \ diff --git a/tools/modules/software/install_lidarr.sh b/tools/modules/software/install_lidarr.sh index c0c2c3a7..feeada97 100644 --- a/tools/modules/software/install_lidarr.sh +++ b/tools/modules/software/install_lidarr.sh @@ -14,7 +14,7 @@ function module_lidarr () { local title="lidarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/lidarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/lidarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_lidarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$LIDARR_BASE" ]] || mkdir -p "$LIDARR_BASE" || { echo "Couldn't create storage directory: $LIDARR_BASE"; exit 1; } docker run -d \ --name=lidarr \ diff --git a/tools/modules/software/install_mariadb.sh b/tools/modules/software/install_mariadb.sh index 5d391a07..a50f54c9 100644 --- a/tools/modules/software/install_mariadb.sh +++ b/tools/modules/software/install_mariadb.sh @@ -16,7 +16,7 @@ function module_mariadb () { local title="mariadb" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/mariadb?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/mariadb?( |$)/{print $3}') fi @@ -28,7 +28,7 @@ function module_mariadb () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$MARIADB_BASE" ]] || mkdir -p "$MARIADB_BASE" || { echo "Couldn't create storage directory: $MARIADB_BASE"; exit 1; } # get parameters diff --git a/tools/modules/software/install_medusa.sh b/tools/modules/software/install_medusa.sh index 184ff2a8..b74a6a53 100644 --- a/tools/modules/software/install_medusa.sh +++ b/tools/modules/software/install_medusa.sh @@ -15,7 +15,7 @@ function module_medusa () { local title="Medusa" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/medusa?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/medusa?( |$)/{print $3}') fi @@ -27,7 +27,7 @@ function module_medusa () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$MEDUSA_BASE" ]] || mkdir -p "$MEDUSA_BASE" || { echo "Couldn't create storage directory: $MEDUSA_BASE"; exit 1; } docker run -d \ --name=medusa \ diff --git a/tools/modules/software/install_netdata.sh b/tools/modules/software/install_netdata.sh index b845b62c..1d3292d5 100644 --- a/tools/modules/software/install_netdata.sh +++ b/tools/modules/software/install_netdata.sh @@ -14,7 +14,7 @@ function module_netdata () { local title="netdata" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/netdata?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/netdata?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_netdata () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$NETDATA_BASE" ]] || mkdir -p "$NETDATA_BASE" || { echo "Couldn't create storage directory: $NETDATA_BASE"; exit 1; } docker run -d --name=netdata \ --pid=host \ diff --git a/tools/modules/software/install_nextcloud.sh b/tools/modules/software/install_nextcloud.sh index cde430bd..a771a9ed 100644 --- a/tools/modules/software/install_nextcloud.sh +++ b/tools/modules/software/install_nextcloud.sh @@ -16,7 +16,7 @@ function module_nextcloud () { local title="nextcloud" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/nextcloud?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/nextcloud?( |$)/{print $3}') fi @@ -28,7 +28,7 @@ function module_nextcloud () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$NEXTCLOUD_BASE" ]] || mkdir -p "$NEXTCLOUD_BASE" || { echo "Couldn't create storage directory: $NEXTCLOUD_BASE"; exit 1; } docker run -d \ --name=nextcloud \ diff --git a/tools/modules/software/install_openhab.sh b/tools/modules/software/install_openhab.sh index eba73ef6..c6aa2391 100644 --- a/tools/modules/software/install_openhab.sh +++ b/tools/modules/software/install_openhab.sh @@ -22,11 +22,11 @@ openhab() { echo "deb [signed-by=/usr/share/keyrings/azul.gpg] https://repos.azul.com/zulu/deb stable main" > "/etc/apt/sources.list.d/zulu.list" echo "deb [signed-by=/usr/share/keyrings/openhab.gpg] https://openhab.jfrog.io/artifactory/openhab-linuxpkg stable main" > "/etc/apt/sources.list.d/openhab.list" - apt_install_wrapper apt-get update + pkg_update # Optional preinstall top 10 tools - apt_install_wrapper apt-get -y install zulu17-jdk - apt_install_wrapper apt-get -y install openhab openhab-addons + pkg_install zulu17-jdk + pkg_install openhab openhab-addons systemctl daemon-reload 2> /dev/null systemctl enable openhab.service 2> /dev/null systemctl start openhab.service 2> /dev/null @@ -35,7 +35,7 @@ openhab() { uninstall) - apt_install_wrapper apt-get -y remove zulu17-jdk openhab openhab-addons + pkg_remove zulu17-jdk openhab openhab-addons systemctl disable openhab.service 2> /dev/null rm -f /usr/share/keyrings/openhab.gpg /usr/share/keyrings/azul.gpg rm -f /etc/apt/sources.list.d/zulu.list /etc/apt/sources.list.d/openhab.list diff --git a/tools/modules/software/install_owncloud.sh b/tools/modules/software/install_owncloud.sh index 6a294c8e..78c55c15 100644 --- a/tools/modules/software/install_owncloud.sh +++ b/tools/modules/software/install_owncloud.sh @@ -14,7 +14,7 @@ function module_owncloud () { local title="owncloud" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/owncloud?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/owncloud/{print $3}') fi @@ -26,7 +26,7 @@ function module_owncloud () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$OWNCLOUD_BASE" ]] || mkdir -p "$OWNCLOUD_BASE" || { echo "Couldn't create storage directory: $OWNCLOUD_BASE"; exit 1; } docker run -d \ --name=owncloud \ diff --git a/tools/modules/software/install_phpmyadmin.sh b/tools/modules/software/install_phpmyadmin.sh index 1ab6e0b2..233df4bd 100644 --- a/tools/modules/software/install_phpmyadmin.sh +++ b/tools/modules/software/install_phpmyadmin.sh @@ -16,7 +16,7 @@ function module_phpmyadmin () { local title="phpmyadmin" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/phpmyadmin?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/phpmyadmin?( |$)/{print $3}') fi @@ -28,7 +28,7 @@ function module_phpmyadmin () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$PHPMYADMIN_BASE" ]] || mkdir -p "$PHPMYADMIN_BASE" || { echo "Couldn't create storage directory: $PHPMYADMIN_BASE"; exit 1; } docker run -d \ --name=phpmyadmin \ diff --git a/tools/modules/software/install_pi-hole.sh b/tools/modules/software/install_pi-hole.sh index 79d4a37a..99a66bba 100644 --- a/tools/modules/software/install_pi-hole.sh +++ b/tools/modules/software/install_pi-hole.sh @@ -12,7 +12,7 @@ module_options+=( # function pi_hole () { - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/pihole?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/pihole?( |$)/{print $3}') fi @@ -39,7 +39,7 @@ function pi_hole () { ;; install) - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker # disable dns within systemd-resolved if systemctl is-active --quiet systemd-resolved.service && ! grep -q "^DNSStubListener=no" /etc/systemd/resolved.conf; then diff --git a/tools/modules/software/install_plexmediaserver.sh b/tools/modules/software/install_plexmediaserver.sh index e96a32af..0e2f2287 100644 --- a/tools/modules/software/install_plexmediaserver.sh +++ b/tools/modules/software/install_plexmediaserver.sh @@ -18,8 +18,7 @@ install_plexmediaserver() { # 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 + pkg_install --update plexmediaserver $DIALOG --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 } diff --git a/tools/modules/software/install_portainer.sh b/tools/modules/software/install_portainer.sh index 650ce38e..20cf933a 100644 --- a/tools/modules/software/install_portainer.sh +++ b/tools/modules/software/install_portainer.sh @@ -13,7 +13,7 @@ module_options+=( # module_portainer() { - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/portainer\/portainer(-ce)?( |$)/{print $3}') fi @@ -36,7 +36,7 @@ module_portainer() { echo ;; install) - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker docker volume ls -q | grep -xq 'portainer_data' || docker volume create portainer_data docker run -d \ -p '9000:9000' \ diff --git a/tools/modules/software/install_prowlarr.sh b/tools/modules/software/install_prowlarr.sh index 3d2b72f9..5721d9bf 100644 --- a/tools/modules/software/install_prowlarr.sh +++ b/tools/modules/software/install_prowlarr.sh @@ -14,7 +14,7 @@ function module_prowlarr () { local title="prowlarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/prowlarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/prowlarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_prowlarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$PROWLARR_BASE" ]] || mkdir -p "$PROWLARR_BASE" || { echo "Couldn't create storage directory: $PROWLARR_BASE"; exit 1; } docker run -d \ --name=prowlarr \ diff --git a/tools/modules/software/install_qbittorrent.sh b/tools/modules/software/install_qbittorrent.sh index c331660d..3cce262d 100644 --- a/tools/modules/software/install_qbittorrent.sh +++ b/tools/modules/software/install_qbittorrent.sh @@ -13,7 +13,7 @@ module_options+=( # function module_qbittorrent () { - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/qbittorrent?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/qbittorrent?( |$)/{print $3}') fi @@ -25,7 +25,7 @@ function module_qbittorrent () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$QBITTORRENT_BASE" ]] || mkdir -p "$QBITTORRENT_BASE" || { echo "Couldn't create storage directory: $QBITTORRENT_BASE"; exit 1; } docker run -d \ --name=qbittorrent \ diff --git a/tools/modules/software/install_radarr.sh b/tools/modules/software/install_radarr.sh index 37ff9c09..537fc40d 100644 --- a/tools/modules/software/install_radarr.sh +++ b/tools/modules/software/install_radarr.sh @@ -14,7 +14,7 @@ function module_radarr () { local title="radarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/radarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/radarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_radarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$RADARR_BASE" ]] || mkdir -p "$RADARR_BASE" || { echo "Couldn't create storage directory: $RADARR_BASE"; exit 1; } docker run -d \ --name=radarr \ diff --git a/tools/modules/software/install_readarr.sh b/tools/modules/software/install_readarr.sh index b81b0bdf..b32ba5ab 100644 --- a/tools/modules/software/install_readarr.sh +++ b/tools/modules/software/install_readarr.sh @@ -14,7 +14,7 @@ function module_readarr () { local title="readarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/readarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/readarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_readarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$READARR_BASE" ]] || mkdir -p "$READARR_BASE" || { echo "Couldn't create storage directory: $READARR_BASE"; exit 1; } docker run -d \ --name=readarr \ diff --git a/tools/modules/software/install_sabnzbd.sh b/tools/modules/software/install_sabnzbd.sh index 418de54d..31acc168 100644 --- a/tools/modules/software/install_sabnzbd.sh +++ b/tools/modules/software/install_sabnzbd.sh @@ -14,7 +14,7 @@ function module_sabnzbd () { local title="Sabnzbd" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/sabnzbd?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/sabnzbd?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_sabnzbd () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$SABNZBD_BASE" ]] || mkdir -p "$SABNZBD_BASE" || { echo "Couldn't create storage directory: $SABNZBD_BASE"; exit 1; } docker run -d \ --name=sabnzbd \ diff --git a/tools/modules/software/install_sonarr.sh b/tools/modules/software/install_sonarr.sh index 5cda6f22..33a2ef6e 100644 --- a/tools/modules/software/install_sonarr.sh +++ b/tools/modules/software/install_sonarr.sh @@ -14,7 +14,7 @@ function module_sonarr () { local title="sonarr" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/sonarr?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/sonarr?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_sonarr () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$SONARR_BASE" ]] || mkdir -p "$SONARR_BASE" || { echo "Couldn't create storage directory: $SONARR_BASE"; exit 1; } docker run -d \ --name=sonarr \ diff --git a/tools/modules/software/install_stirling.sh b/tools/modules/software/install_stirling.sh index a058d31f..5bc1323f 100644 --- a/tools/modules/software/install_stirling.sh +++ b/tools/modules/software/install_stirling.sh @@ -16,7 +16,7 @@ function module_stirling () { local title="stirling" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/stirling-pdf?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/stirling-pdf?( |$)/{print $3}') fi @@ -28,7 +28,7 @@ function module_stirling () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$STIRLING_BASE" ]] || mkdir -p "$STIRLING_BASE" || { echo "Couldn't create storage directory: $STIRLING_BASE"; exit 1; } docker run -d \ -p 8077:8080 \ diff --git a/tools/modules/software/install_syncthing.sh b/tools/modules/software/install_syncthing.sh index 10d16823..8999a375 100644 --- a/tools/modules/software/install_syncthing.sh +++ b/tools/modules/software/install_syncthing.sh @@ -16,7 +16,7 @@ function module_syncthing () { local title="syncthing" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/syncthing?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/syncthing?( |$)/{print $3}') fi @@ -28,7 +28,7 @@ function module_syncthing () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$SYNCTHING_BASE" ]] || mkdir -p "$SYNCTHING_BASE" || { echo "Couldn't create storage directory: $SYNCTHING_BASE"; exit 1; } docker run -d \ --name=syncthing \ diff --git a/tools/modules/software/install_transmission.sh b/tools/modules/software/install_transmission.sh index cdd24cc0..3c982845 100644 --- a/tools/modules/software/install_transmission.sh +++ b/tools/modules/software/install_transmission.sh @@ -14,7 +14,7 @@ function module_transmission () { local title="transmission" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/transmission?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/transmission?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_transmission () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$TRANSMISSION_BASE" ]] || mkdir -p "$TRANSMISSION_BASE" || { echo "Couldn't create storage directory: $TRANSMISSION_BASE"; exit 1; } docker run -d \ --name=transmission \ diff --git a/tools/modules/software/install_uptime-kuma.sh b/tools/modules/software/install_uptime-kuma.sh index d0605efa..bb7972b5 100644 --- a/tools/modules/software/install_uptime-kuma.sh +++ b/tools/modules/software/install_uptime-kuma.sh @@ -14,7 +14,7 @@ function module_uptimekuma () { local title="uptimekuma" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/uptime-kuma?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/uptime-kuma?( |$)/{print $3}') fi @@ -26,7 +26,7 @@ function module_uptimekuma () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker [[ -d "$UPTIMEKUMA_BASE" ]] || mkdir -p "$UPTIMEKUMA_BASE" || { echo "Couldn't create storage directory: $UPTIMEKUMA_BASE"; exit 1; } docker run -d --name uptime-kuma \ --restart=always \ diff --git a/tools/modules/software/install_watchtower.sh b/tools/modules/software/install_watchtower.sh index 933d0071..8931712e 100644 --- a/tools/modules/software/install_watchtower.sh +++ b/tools/modules/software/install_watchtower.sh @@ -14,7 +14,7 @@ function module_watchtower () { local title="watchtower" local condition=$(which "$title" 2>/dev/null) - if check_if_installed docker-ce; then + if pkg_installed docker-ce; then local container=$(docker container ls -a | mawk '/watchtower?( |$)/{print $1}') local image=$(docker image ls -a | mawk '/watchtower?( |$)/{print $3}') fi @@ -24,7 +24,7 @@ function module_watchtower () { case "$1" in "${commands[0]}") - check_if_installed docker-ce || install_docker + pkg_installed docker-ce || install_docker docker run -d \ --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ diff --git a/tools/modules/software/install_webmin.sh b/tools/modules/software/install_webmin.sh index 58bfdf8a..801c765b 100644 --- a/tools/modules/software/install_webmin.sh +++ b/tools/modules/software/install_webmin.sh @@ -41,22 +41,19 @@ function module_webmin() { ;; "${commands[1]}") ## install webmin - apt update - apt install -y wget apt-transport-https + pkg_install --update wget apt-transport-https echo "deb [signed-by=/usr/share/keyrings/webmin-archive-keyring.gpg] http://download.webmin.com/download/repository sarge contrib" | sudo tee /etc/apt/sources.list.d/webmin.list wget -qO- http://www.webmin.com/jcameron-key.asc | gpg --dearmor | tee /usr/share/keyrings/webmin-archive-keyring.gpg > /dev/null - apt update - apt install -y webmin --install-recommends + pkg_install --update --install-recommends webmin echo "Webmin installed successfully." ;; "${commands[2]}") ## remove webmin systemctl disable webmin - apt purge -y webmin - apt autoremove --purge -y + pkg_remove webmin rm /etc/apt/sources.list.d/webmin.list rm /usr/share/keyrings/webmin-archive-keyring.gpg - apt update + pkg_update echo "Webmin removed successfully." ;; diff --git a/tools/modules/system/apt_install_wrapper.sh b/tools/modules/system/apt_install_wrapper.sh deleted file mode 100644 index ec17db7b..00000000 --- a/tools/modules/system/apt_install_wrapper.sh +++ /dev/null @@ -1,22 +0,0 @@ - -module_options+=( - ["apt_install_wrapper,author"]="@igorpecovnik" - ["apt_install_wrapper,ref_link"]="" - ["apt_install_wrapper,feature"]="apt_install_wrapper" - ["apt_install_wrapper,desc"]="Install wrapper" - ["apt_install_wrapper,example"]="apt_install_wrapper apt-get -y purge armbian-zsh" - ["apt_install_wrapper,status"]="Active" -) -# -# @description Use TUI / GUI for apt install if exists -# -function apt_install_wrapper() { - - if [ -t 0 ]; then - debconf-apt-progress -- "$@" - else - # Terminal not defined - proceed without TUI - "$@" - fi -} - diff --git a/tools/modules/system/install_headers.sh b/tools/modules/system/install_headers.sh index 872c4806..c3129884 100644 --- a/tools/modules/system/install_headers.sh +++ b/tools/modules/system/install_headers.sh @@ -35,18 +35,14 @@ function module_headers () { case "$1" in "${commands[0]}") - apt_install_wrapper apt-get -y install ${install_pkg} build-essential git || exit 1 + pkg_install ${install_pkg} build-essential git || exit 1 ;; "${commands[1]}") - apt_install_wrapper apt-get -y autopurge ${install_pkg} build-essential || exit 1 + pkg_remove ${install_pkg} build-essential || exit 1 rm -rf /usr/src/linux-headers* ;; "${commands[2]}") - if check_if_installed ${install_pkg}; then - return 0 - else - return 1 - fi + pkg_installed ${install_pkg} ;; "${commands[3]}") echo -e "\nUsage: ${module_options["module_headers,feature"]} " @@ -58,7 +54,7 @@ function module_headers () { echo ;; *) - ${module_options["module_headers,feature"]} ${commands[3]} + ${module_options["module_headers,feature"]} ${commands[3]} ;; esac } diff --git a/tools/modules/system/manage_desktops.sh b/tools/modules/system/manage_desktops.sh index 5f2b0aa6..2a5dca3a 100644 --- a/tools/modules/system/manage_desktops.sh +++ b/tools/modules/system/manage_desktops.sh @@ -24,24 +24,23 @@ function manage_desktops() { case "$desktop" in gnome) echo "/usr/sbin/gdm3" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install gdm3 + #pkg_install gdm3 ;; kde-neon) echo "/usr/sbin/sddm" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install sddm + #pkg_install sddm ;; *) echo "/usr/sbin/lightdm" > /etc/X11/default-display-manager - #apt_install_wrapper DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt-get -y install lightdm + #pkg_install lightdm ;; esac # just make sure we have everything in order - apt_install_wrapper dpkg --configure -a + pkg_configure -a # install desktop - export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true - apt_install_wrapper apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends install armbian-${DISTROID}-desktop-${desktop} + pkg_install -o Dpkg::Options::="--force-confold" --install-recommends armbian-${DISTROID}-desktop-${desktop} # add user to groups for additionalgroup in sudo netdev audio video dialout plugdev input bluetooth systemd-journal ssh; do @@ -71,9 +70,8 @@ function manage_desktops() { uninstall) # we are uninstalling all variants until build time packages are fixed to prevent installing one over another service display-manager stop - apt_install_wrapper apt-get -o Dpkg::Options::="--force-confold" -y --install-recommends purge armbian-${DISTROID}-desktop-$1 \ - xfce4-session gnome-session slick-greeter lightdm gdm3 sddm cinnamon-session i3-wm - apt_install_wrapper apt-get -y autoremove + pkg_remove -o Dpkg::Options::="--force-confold" armbian-${DISTROID}-desktop-$1 \ + xfce4-session gnome-session slick-greeter lightdm gdm3 sddm cinnamon-session i3-wm # disable autologins rm -f /etc/gdm3/custom.conf rm -f /etc/sddm.conf.d/autologin.conf diff --git a/tools/modules/system/manage_overlayfs.sh b/tools/modules/system/manage_overlayfs.sh index bf9d8f05..5a735b4d 100644 --- a/tools/modules/system/manage_overlayfs.sh +++ b/tools/modules/system/manage_overlayfs.sh @@ -12,13 +12,13 @@ module_options+=( function manage_overlayfs() { if [[ "$1" == "enable" ]]; then - debconf-apt-progress -- apt-get -o Dpkg::Options::="--force-confold" -y install overlayroot cryptsetup cryptsetup-bin + pkg_install -o Dpkg::Options::="--force-confold" overlayroot cryptsetup cryptsetup-bin [[ ! -f /etc/overlayroot.conf ]] && cp /etc/overlayroot.conf.dpkg-new /etc/overlayroot.conf sed -i "s/^overlayroot=.*/overlayroot=\"tmpfs\"/" /etc/overlayroot.conf sed -i "s/^overlayroot_cfgdisk=.*/overlayroot_cfgdisk=\"enabled\"/" /etc/overlayroot.conf else overlayroot-chroot rm /etc/overlayroot.conf > /dev/null 2>&1 - debconf-apt-progress -- apt-get -y purge overlayroot cryptsetup cryptsetup-bin + pkg_remove overlayroot cryptsetup cryptsetup-bin fi # reboot is mandatory reboot diff --git a/tools/modules/system/manage_zsh.sh b/tools/modules/system/manage_zsh.sh index 97876ef8..5c9e9cae 100644 --- a/tools/modules/system/manage_zsh.sh +++ b/tools/modules/system/manage_zsh.sh @@ -20,7 +20,7 @@ function manage_zsh() { sed -i -E "s|(^\|#)DSHELL=.*|DSHELL=/bin/zsh|" /etc/adduser.conf # install - apt_install_wrapper apt-get -y install armbian-zsh zsh-common zsh tmux + pkg_install armbian-zsh zsh-common zsh tmux update_skel @@ -35,7 +35,7 @@ function manage_zsh() { sed -i -E "s|(^\|#)DSHELL=.*|DSHELL=/bin/bash|" /etc/adduser.conf # remove - apt_install_wrapper apt-get -y remove armbian-zsh zsh-common zsh tmux + pkg_remove armbian-zsh zsh-common zsh tmux # change shell for root usermod --shell "/bin/bash" root diff --git a/tools/modules/system/module_armbian_firmware.sh b/tools/modules/system/module_armbian_firmware.sh index a1ef3c6f..f97baf52 100644 --- a/tools/modules/system/module_armbian_firmware.sh +++ b/tools/modules/system/module_armbian_firmware.sh @@ -18,7 +18,7 @@ function module_armbian_firmware() { "${commands[0]}") # choose kernel from the list # We are updating beta packages repository quite often. In order to make sure, update won't break, always update package list - apt_install_wrapper apt-get update + pkg_update # make sure to proceed if this variable is not defined. This can surface on some old builds [[ -z "${KERNEL_TEST_TARGET}" ]] && KERNEL_TEST_TARGET="legacy,vendor,current,edge" @@ -103,10 +103,10 @@ function module_armbian_firmware() { for pkg in ${packages[@]}; do purge_pkg=$(echo $pkg | sed -e 's/linux-image.*/linux-image*/;s/linux-dtb.*/linux-dtb*/;s/linux-headers.*/linux-headers*/;s/armbian-firmware.*/armbian-firmware*/') # if test install is succesfull, proceed - apt_install_wrapper apt-get -y --simulate --download-only --allow-downgrades install "${pkg}" + pkg_install --simulate --download-only --allow-downgrades install "${pkg}" if [[ $? == 0 ]]; then - apt_install_wrapper apt-get -y purge "${purge_pkg}" - apt_install_wrapper apt-get --allow-downgrades -y install "${pkg}" + pkg_remove "${purge_pkg}" + pkg_install --allow-downgrades "${pkg}" fi done if [[ -z "${headers}" ]]; then @@ -238,7 +238,7 @@ function module_armbian_firmware() { # performs list change & update if this is needed if [[ "$repository" == "rolling" ]]; then sed -i "s/http:\/\/[^ ]*/http:\/\/beta.armbian.com/" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get update + pkg_update fi else if [[ "$repository" == "stable" && "$status" == "status" ]]; then @@ -249,7 +249,7 @@ function module_armbian_firmware() { # performs list change & update if this is needed if [[ "$repository" == "stable" ]]; then sed -i "s/http:\/\/[^ ]*/http:\/\/apt.armbian.com/" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get update + pkg_update fi fi @@ -270,14 +270,14 @@ function module_armbian_firmware() { ${module_options["module_armbian_firmware,feature"]} ${commands[1]} "" "${version}" "" "true" else # for non armbian builds - apt_install_wrapper apt-get install "linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" + pkg_install "linux-headers-$(uname -r | sed 's/'-$(dpkg --print-architecture)'//')" fi elif [[ "${command}" == "remove" ]]; then ${module_options["module_armbian_firmware,feature"]} ${commands[2]} "" "${version}" "hide" "" "true" - apt_install_wrapper apt-get -y autopurge ${packages[@]} + pkg_remove ${packages[@]} else ${module_options["module_armbian_firmware,feature"]} ${commands[2]} "" "${version}" "hide" "" "true" - if check_if_installed ${packages[@]}; then + if pkg_installed ${packages[@]}; then return 0 else return 1 diff --git a/tools/modules/system/module_zfs.sh b/tools/modules/system/module_zfs.sh index 239622af..1d7c26e9 100644 --- a/tools/modules/system/module_zfs.sh +++ b/tools/modules/system/module_zfs.sh @@ -23,18 +23,14 @@ function module_zfs () { if ! module_armbian_firmware headers status; then module_armbian_firmware headers install fi - DEBIAN_FRONTEND=noninteractive apt-get -y install zfsutils-linux zfs-dkms + pkg_install zfsutils-linux zfs-dkms ;; "${commands[1]}") module_armbian_firmware headers remove - apt_install_wrapper apt-get -y autopurge zfsutils-linux zfs-dkms + pkg_remove zfsutils-linux zfs-dkms ;; "${commands[2]}") - if check_if_installed zfsutils-linux; then - return 0 - else - return 1 - fi + pkg_installed zfsutils-linux ;; "${commands[3]}") echo "${ZFS_KERNEL_MAX}" @@ -43,7 +39,7 @@ function module_zfs () { echo "v${ZFS_DKMS_VERSION}" ;; "${commands[5]}") - if check_if_installed zfsutils-linux; then + if pkg_installed zfsutils-linux; then zfs --version 2>/dev/null| head -1 | cut -d"-" -f2 fi ;; @@ -60,7 +56,7 @@ function module_zfs () { echo ;; *) - ${module_options["module_zfs,feature"]} ${commands[6]} + ${module_options["module_zfs,feature"]} ${commands[6]} ;; esac } diff --git a/tools/modules/system/release_upgrade.sh b/tools/modules/system/release_upgrade.sh index db524cc9..7faa408e 100644 --- a/tools/modules/system/release_upgrade.sh +++ b/tools/modules/system/release_upgrade.sh @@ -41,9 +41,9 @@ release_upgrade(){ [[ -f /etc/apt/sources.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list [[ "${upgrade}" == "testing" ]] && upgrade="sid" # our repo and everything is tied to sid [[ -f /etc/apt/sources.list.d/armbian.list ]] && sed -i "s/$distroid/$upgrade/g" /etc/apt/sources.list.d/armbian.list - apt_install_wrapper apt-get -y update - apt_install_wrapper DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get -y -o Dpkg::Options::="--force-confold" upgrade --without-new-pkgs - apt_install_wrapper DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a apt-get -y -o Dpkg::Options::="--force-confold" full-upgrade - apt_install_wrapper apt-get -y --purge autoremove + pkg_update + apt_upgrade -o Dpkg::Options::="--force-confold" --without-new-pkgs + apt_full_upgrade -o Dpkg::Options::="--force-confold" + pkg_remove # remove all auto-installed packages fi }