From d2b611950241bf0175971476de53b287dca89d57 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 10 May 2021 13:38:30 -0400 Subject: [PATCH] Added -P flag to show a list of packages required by audiogame-manager. --- audiogame-manager.sh | 51 ++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index a842551..06c52ba 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -148,71 +148,92 @@ EOF checklist() { declare -a errorList - echo "Checking your system..." - echo + declare -a packageList + if [[ $# -eq 0 ]]; then + echo "Checking your system..." + echo + fi if command -v wine &> /dev/null ; then - echo "Wine is installed." + [[ $# -eq 0 ]] && echo "Wine is installed." else errorList+=("Critical: Wine is not installed. You will not be able to play any games.") fi + packageList+=("wine") if command -v winetricks &> /dev/null ; then - echo "Winetricks is installed." + [[ $# -eq 0 ]] && echo "Winetricks is installed." else errorList+=("Critical: Winetricks is not installed. This means wine cannot be configured, dependancies cannot be installed, and only self-voicing games have any chance of working.") fi + packageList+=("winetricks") if command -v wget &> /dev/null ; then - echo "Wget is installed." + [[ $# -eq 0 ]] && echo "Wget is installed." else errorList+=("Critical: Wget is not installed. You will not be able to install any games.") fi + packageList+=("wget") if command -v dialog &> /dev/null ; then - echo "Dialog is installed." + [[ $# -eq 0 ]] && echo "Dialog is installed." else errorList+=("Critical: Dialog is not installed. You will not be able to install, launch, or remove any games.") fi + packageList+=("dialog") for i in 7z cabextract unzip xz ; do if command -v $i &> /dev/null ; then - echo "${i^} is installed." + [[ $# -eq 0 ]] && echo "${i^} is installed." else errorList+=("Critical: ${i^} is not installed. You will not be able to install some games or their components.") fi + packageList+=("$i") done if command -v gawk &> /dev/null ; then - echo "Gawk is installed." + [[ $# -eq 0 ]] && echo "Gawk is installed." else errorList+=("Warning: gawk is not installed. Game removal with -r will not work.") fi + packageList+=("gawk") if command -v ocrdesktop &> /dev/null ; then - echo "Ocrdesktop is installed." + [[ $# -eq 0 ]] && echo "Ocrdesktop is installed." else errorList+=("Warning: ocrdesktop is not installed. It can help if the installer gets stuck to figure out what is happening.") fi + packageList+=("ocrdesktop") if command -v qjoypad &> /dev/null ; then - echo "Qjoypad is installed." + [[ $# -eq 0 ]] && echo "Qjoypad is installed." else errorList+=("Warning: qjoypad is not installed. Qjoypad allows you to play keyboard only games with a gamepad.") fi + packageList+=("qjoypad") if command -v unix2dos &> /dev/null ; then - echo "Dos2unix is installed." + [[ $# -eq 0 ]] && echo "Dos2unix is installed." else errorList+=("Warning: unix2dos is not installed. Some games need a configuration file in dos format before they will run.") fi + packageList+=("unix2dos") if command -v w3m &> /dev/null ; then - echo "W3m is installed." + [[ $# -eq 0 ]] && echo "W3m is installed." else errorList+=("Warning: w3m is not installed. W3m is used to view game documentation.") fi + packageList+=("w3m") if command -v xclip &> /dev/null ; then - echo "Xclip is installed." + [[ $# -eq 0 ]] && echo "Xclip is installed." else errorList+=("Warning: Xclip is not installed. Some games may not speak or register properly.") fi + packageList+=("xclip") if command -v xdotool &> /dev/null ; then - echo "Xdotool is installed." + [[ $# -eq 0 ]] && echo "Xdotool is installed." else errorList+=("Warning: Xdotool is not installed. Some installers may not work or may need manual intervention.") fi + packageList+=("xdotool") # Show the results + if [[ $# -ne 0 ]]; then + for i in "${packageList[@]}" ; do + echo "$i" + done | sort + exit 0 + fi if [[ ${#errorList[@]} -eq 0 ]]; then echo "No problems found, you are good to go." exit 0 @@ -695,6 +716,7 @@ declare -A command=( [L]="Display license information." [l:]="Launch given game without interactive audiogame-manager menu specified by its wine bottle." [N]="No cache, delete the installer after it has been extracted." + [P]="Print a list of packages required by audiogame-manager." [r]="Remove a game. This will delete all game data." ) @@ -718,6 +740,7 @@ while getopts "${args}" i ; do L) license;; l) game_launcher "${OPTARG}";; N) noCache="true";; + P) checklist quiet;; r) game_removal;; esac done