mirror of
				https://github.com/the-sane/lug-helper.git
				synced 2025-10-31 08:02:51 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			0de4032a41
			...
			2dd9b51ab1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 2dd9b51ab1 | ||
|  | dd9bfc3351 | ||
|  | b009265951 | ||
|  | 394cfa9392 | ||
|  | 5b2e202b4f | 
| @@ -233,7 +233,7 @@ debug_print() { | ||||
| # Try to execute a supplied command as root | ||||
| # Expects one string argument | ||||
| try_exec() { | ||||
|     # This function expects one string arguments | ||||
|     # This function expects one string argument | ||||
|     if [ "$#" -lt 1 ]; then | ||||
|         printf "\nScript error:  The try_exec() function expects an argument. Aborting.\n" | ||||
|         read -n 1 -s -p "Press any key..." | ||||
| @@ -245,19 +245,25 @@ try_exec() { | ||||
|     if [ -x "$(command -v pkexec)" ]; then | ||||
|         pkexec sh -c "$1" | ||||
|  | ||||
|         # Check the return value | ||||
|         if [ "$?" -eq 126 ] || [ "$?" -eq 127 ]; then | ||||
|         # Check the exit status | ||||
|         statuscode="$?" | ||||
|         if [ "$statuscode" -eq 126 ] || [ "$statuscode" -eq 127 ]; then | ||||
|             # User cancel or error | ||||
|             retval=1 | ||||
|         fi | ||||
|     else | ||||
|     elif [ -x "$(command -v sudo)" ]; then | ||||
|         sudo sh -c "$1" | ||||
|  | ||||
|         # Check the return value | ||||
|         if [ "$?" -eq 1 ]; then | ||||
|         # Check the exit status | ||||
|         statuscode="$?" | ||||
|         if [ "$statuscode" -eq 1 ]; then | ||||
|             # Error | ||||
|             retval=1 | ||||
|         fi | ||||
|     else | ||||
|         # We don't know how to perform this operation with elevated privileges | ||||
|         printf "\nNeither Polkit nor sudo appear to be installed. Unable to execute the command with the required privileges.\n" | ||||
|         retval=1 | ||||
|     fi | ||||
|  | ||||
|     return "$retval" | ||||
| @@ -2074,7 +2080,7 @@ eac_workaround() { | ||||
|         # Try to modify /etc/hosts as root | ||||
|         try_exec "printf '\n$eac_hosts #Star Citizen EAC workaround\n' >> /etc/hosts" | ||||
|         if [ "$?" -eq 1 ]; then | ||||
|             message info "Something went wrong. Unable to modify /etc/hosts.\n\nReturning to main menu." | ||||
|             message info "Authentication failed or there was an error modifying /etc/hosts.\nSee terminal for more information.\n\nReturning to main menu." | ||||
|             return 0 | ||||
|         fi | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user