mirror of
				https://github.com/the-sane/lug-helper.git
				synced 2025-10-31 21:12:49 +00:00 
			
		
		
		
	More robust dependency notifications
Not all systems have notify-send by default. Try zenity first.
This commit is contained in:
		| @@ -35,30 +35,46 @@ fi | ||||
|  | ||||
| # Check for dependencies | ||||
| if [ ! -x "$(command -v curl)" ]; then | ||||
| # Print to stderr and also try warning the user through notify-send | ||||
| # Print to stderr and also try warning the user through zenity or notify-send | ||||
|     printf "lug-helper.sh: The required package 'curl' was not found on this system.\n" 1>&2 | ||||
|     notify-send "lug-helper" "The required package 'curl' was not found on this system.\n" --icon=dialog-warning | ||||
|     if [ -x "$(command -v zenity)" ]; then | ||||
|         zenity --error --width="400" --title="Star Citizen LUG Helper" --text="The required package 'curl' was not found on this system." | ||||
|     elif [ -x "$(command -v notify-send)" ]; then | ||||
|         notify-send "lug-helper" "The required package 'curl' was not found on this system.\n" --icon=dialog-warning | ||||
|     fi | ||||
|     exit 1 | ||||
| fi | ||||
| if [ ! -x "$(command -v mktemp)" ] || [ ! -x "$(command -v chmod)" ] || [ ! -x "$(command -v sort)" ] || [ ! -x "$(command -v basename)" ] || [ ! -x "$(command -v realpath)" ] || [ ! -x "$(command -v dirname)" ] || [ ! -x "$(command -v cut)" ] || [ ! -x "$(command -v numfmt)" ] || [ ! -x "$(command -v tr)" ] || [ ! -x "$(command -v od)" ] || [ ! -x "$(command -v readlink)" ]; then | ||||
|     # coreutils | ||||
|     # Print to stderr and also try warning the user through notify-send | ||||
|     printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that coreutils is installed!\n" 1>&2 | ||||
|     notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that coreutils is installed!\n" --icon=dialog-warning | ||||
|     # Print to stderr and also try warning the user through zenity or notify-send | ||||
|     printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that 'coreutils' is installed!\n" 1>&2 | ||||
|     if [ -x "$(command -v zenity)" ]; then | ||||
|         zenity --error --width="400" --title="Star Citizen LUG Helper" --text="One or more required packages were not found on this system.\n\nPlease check that 'coreutils' is installed!" | ||||
|     elif [ -x "$(command -v notify-send)" ]; then | ||||
|         notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that 'coreutils' is installed!\n" --icon=dialog-warning | ||||
|     fi | ||||
|     exit 1 | ||||
| fi | ||||
| if [ ! -x "$(command -v xargs)" ]; then | ||||
|     # findutils | ||||
|     # Print to stderr and also try warning the user through notify-send | ||||
|     printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following findutils packages are installed:\n- xargs\n" 1>&2 | ||||
|     notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that the following findutils packages are installed:\n- xargs\n" --icon=dialog-warning | ||||
|     # Print to stderr and also try warning the user through zenity or notify-send | ||||
|     printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that 'findutils' or the following packages are installed:\n- xargs\n" 1>&2 | ||||
|     if [ -x "$(command -v zenity)" ]; then | ||||
|         zenity --error --width="400" --title="Star Citizen LUG Helper" --text="One or more required packages were not found on this system.\n\nPlease check that 'findutils' or the following packages are installed:\n- xargs" | ||||
|     elif [ -x "$(command -v notify-send)" ]; then | ||||
|         notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that 'findutils' or the following packages are installed:\n- xargs\n" --icon=dialog-warning | ||||
|     fi | ||||
|     exit 1 | ||||
| fi | ||||
| if [ ! -x "$(command -v cabextract)" ] || [ ! -x "$(command -v unzip)" ]; then | ||||
|     # winetricks dependencies | ||||
|     # Print to stderr and also try warning the user through notify-send | ||||
|     # Print to stderr and also try warning the user through zenity or notify-send | ||||
|     printf "lug-helper.sh: One or more required packages were not found on this system.\nPlease check that the following winetricks dependencies (or winetricks itself) are installed:\n- cabextract\n- unzip\n" 1>&2 | ||||
|     notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that the following winetricks dependencies (or winetricks itself) are installed:\n- cabextract\n- unzip\n" --icon=dialog-warning | ||||
|     if [ -x "$(command -v zenity)" ]; then | ||||
|         zenity --error --width="400" --title="Star Citizen LUG Helper" --text="One or more required packages were not found on this system.\n\nPlease check that the following winetricks dependencies (or winetricks itself) are installed:\n- cabextract\n- unzip" | ||||
|     elif [ -x "$(command -v notify-send)" ]; then | ||||
|         notify-send "lug-helper" "One or more required packages were not found on this system.\nPlease check that the following winetricks dependencies (or winetricks itself) are installed:\n- cabextract\n- unzip\n" --icon=dialog-warning | ||||
|     fi | ||||
|     exit 1 | ||||
| fi | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user