Ver código fonte

Merge pull request #2181 from Bourne-ID/bug/aisudofix

Change autoinstall sudo check to resolve #2177
Daniel Gibbs 7 anos atrás
pai
commit
ff6634511c
2 arquivos alterados com 16 adições e 4 exclusões
  1. 15 3
      lgsm/functions/check_deps.sh
  2. 1 1
      lgsm/functions/check_permissions.sh

+ 15 - 3
lgsm/functions/check_deps.sh

@@ -10,7 +10,11 @@ fn_install_mono_repo(){
 	if [ "${monostatus}" != "0" ]; then
 	if [ "${monostatus}" != "0" ]; then
 		fn_print_dots "Adding Mono repository"
 		fn_print_dots "Adding Mono repository"
 		sleep 0.5
 		sleep 0.5
-		sudo -v > /dev/null 2>&1
+		if [ "${autoinstall}" == "1" ]; then
+			sudo -n true > /dev/null 2>&1
+		else
+			sudo -v > /dev/null 2>&1
+		fi
 		if [ $? -eq 0 ]; then
 		if [ $? -eq 0 ]; then
 			fn_print_info_nl "Automatically adding Mono repository."
 			fn_print_info_nl "Automatically adding Mono repository."
 			fn_script_log_info "Automatically adding Mono repository."
 			fn_script_log_info "Automatically adding Mono repository."
@@ -101,7 +105,11 @@ fn_install_universe_repo(){
 		fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
 		fn_print_warning_nl "Ubuntu 18.04.1 contains a bug which means the sources.list file does not populate with the Ubuntu universe repository."
 		fn_print_information_nl "Attempting to add Universe Repo"
 		fn_print_information_nl "Attempting to add Universe Repo"
 		sleep 0.5
 		sleep 0.5
-		sudo -v > /dev/null 2>&1
+		if [ "${autoinstall}" == "1" ]; then
+			sudo -n true > /dev/null 2>&1
+		else
+			sudo -v > /dev/null 2>&1
+		fi
 		if [ $? -eq 0 ]; then
 		if [ $? -eq 0 ]; then
 			echo -en ".\r"
 			echo -en ".\r"
 			sleep 1
 			sleep 1
@@ -228,7 +236,11 @@ fn_found_missing_deps(){
 			fn_print_warning_nl "jq is not available in the ${distroname} repository"
 			fn_print_warning_nl "jq is not available in the ${distroname} repository"
 			echo "	* https://docs.linuxgsm.com/requirements/jq"
 			echo "	* https://docs.linuxgsm.com/requirements/jq"
 		fi
 		fi
-		sudo -v > /dev/null 2>&1
+		if [ "${autoinstall}" == "1" ]; then
+			sudo -n true > /dev/null 2>&1
+		else
+			sudo -v > /dev/null 2>&1
+		fi
 		if [ $? -eq 0 ]; then
 		if [ $? -eq 0 ]; then
 			fn_print_information_nl "Automatically installing missing dependencies."
 			fn_print_information_nl "Automatically installing missing dependencies."
 			fn_script_log_info "Automatically installing missing dependencies."
 			fn_script_log_info "Automatically installing missing dependencies."

+ 1 - 1
lgsm/functions/check_permissions.sh

@@ -181,7 +181,7 @@ fn_sys_perm_fix_manually_msg(){
 
 
 # Attempt to fix /sys related permission errors if sudo is available, exits otherwise
 # Attempt to fix /sys related permission errors if sudo is available, exits otherwise
 fn_sys_perm_errors_fix(){
 fn_sys_perm_errors_fix(){
-	sudo -v > /dev/null 2>&1
+	sudo -n true > /dev/null 2>&1
 	if [ $? -eq 0 ]; then
 	if [ $? -eq 0 ]; then
 		fn_print_dots "Automatically fixing /sys permissions"
 		fn_print_dots "Automatically fixing /sys permissions"
 		sleep 0.5
 		sleep 0.5