From 7a72edc0697cb81d94b7f20d44397c81e459bfd5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 10 Aug 2020 06:46:16 -0400 Subject: [PATCH 1/2] Change "apt install" to "apt-get install" Use of apt-get in scripts is preferred because the interface is less likely to change. --- desktopify | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/desktopify b/desktopify index b6d5f7b..11687de 100755 --- a/desktopify +++ b/desktopify @@ -72,7 +72,7 @@ EOM function enable_oem() { if [ "${ENABLE_OEM}" -eq 1 ] && [ "${DESKTOP_ENVIRONMENT}" != "lubuntu" ]; then - apt -y install whois + apt-get -y install whois local DATE="" DATE=$(date +%m%H%M%S) local PASSWD="" @@ -234,7 +234,7 @@ if [ "$(apt list --installed ${DESKTOP_PACKAGES} 2>/dev/null | grep installed)" echo "[*] WARNING: ${DESKTOP_PACKAGES} already installed. To force install use the --force option." else echo "[+] Will now install ${DESKTOP_PACKAGES}" - apt install -y ${DESKTOP_PACKAGES}^ + apt-get -y install ${DESKTOP_PACKAGES}^ fi for CLASSIC_SNAP in "${CLASSIC_SNAPS[@]}"; do @@ -246,7 +246,7 @@ for CONFINED_SNAP in "${CONFINED_SNAPS[@]}"; do done echo "[+] Will now install ${HARDWARE_PACKAGES[*]}" -apt install -y "${HARDWARE_PACKAGES[@]}" +apt-get -y install "${HARDWARE_PACKAGES[@]}" configure_network apply_tweaks From 89c689fbe0b3f57f1a0300d457351693f665cbc0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 10 Aug 2020 07:01:05 -0400 Subject: [PATCH 2/2] Use dpkg instead of apt to determine if packages are installed Use of apt in scripts is discouraged and using dpkg removes the need to grep the output since the exit code indicates whether the package is installed. Also reversed the order of the conditions so the package check is skipped if force is enabled. --- desktopify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktopify b/desktopify index 11687de..44d7cc4 100755 --- a/desktopify +++ b/desktopify @@ -230,7 +230,7 @@ fi HARDWARE_PACKAGES=(libgles1 libopengl0 libxvmc1 pi-bluetooth libgpiod-dev python3-libgpiod python3-gpiozero) #Check if system already has a desktop installed -if [ "$(apt list --installed ${DESKTOP_PACKAGES} 2>/dev/null | grep installed)" ] && [ "${FORCE}" -eq 0 ]; then +if [[ ${FORCE} -eq 0 ]] && { dpkg -l "${DESKTOP_PACKAGES}" &>/dev/null; }; then echo "[*] WARNING: ${DESKTOP_PACKAGES} already installed. To force install use the --force option." else echo "[+] Will now install ${DESKTOP_PACKAGES}"