diff --git a/assets/config/deps/dependencies b/assets/config/deps/dependencies index c57ebea..6b4a6d8 100644 --- a/assets/config/deps/dependencies +++ b/assets/config/deps/dependencies @@ -1,2 +1,2 @@ -pkgs_check="openssl nginx meshtastic flask" -pkgs_apt="openssl nginx nginx-common python3-meshtastic python3-flask python3-requests" \ No newline at end of file +deps="openssl nginx meshtastic flask" +pkgs="openssl nginx nginx-common python3-meshtastic python3-flask python3-requests" \ No newline at end of file diff --git a/assets/test/test.sh b/assets/test/test.sh index 223532e..634bb94 100755 --- a/assets/test/test.sh +++ b/assets/test/test.sh @@ -19,12 +19,25 @@ fi ### DEPENDENCIES -if command -v "$pkgs_check" >/dev/null 2>&1; then - echo -e " ${GRN}Dependency check passed...${CRS}\n" - -else - echo -e " ${RED}Dependencies not met.${CRS}\n" - echo "$pkgs_check" +check_for_package() { + if dpkg-query -s "$1" 1>/dev/null 2>&1; then + return 0 + elif apt-cache show "$1" 1>/dev/null 2>&1; then + return 1 + else + return 2 + fi +} + +for package in $deps; do + if check_for_package "$package"; then + printf "%-20s - %s\n" "$package" "package is installed" + elif [ $? -eq 1 ]; then + printf "%-20s - %s\n" "$package" "package is not installed, it is available in package repository" + else + printf "%-20s - %s\n" "$package" "package is not installed, it is not available in package repository" + fi +done while true; do echo -e " ${YEL}Do you wish to install via APT?"