Explorar o código

stripping ./ from executable

UltimateByte %!s(int64=9) %!d(string=hai) anos
pai
achega
f0306dbcc4
Modificáronse 1 ficheiros con 11 adicións e 9 borrados
  1. 11 9
      lgsm/functions/check_permissions.sh

+ 11 - 9
lgsm/functions/check_permissions.sh

@@ -82,9 +82,11 @@ fn_check_permissions(){
 		fi
 		fi
 	fi
 	fi
 	# Check if executable is executable and attempt to fix it
 	# Check if executable is executable and attempt to fix it
-	if [ -f "${executabledir}/${executable}" ]; then
+	# First get executable name
+	execname="$(echo "${executable}" | awk -F "/" '{ print $2 }')"
+	if [ -f "${executabledir}/${execname}" ]; then
 		# Get permission numbers on file under the form 775
 		# Get permission numbers on file under the form 775
-		execperm="$(stat -c %a "${executabledir}/${executable}")"
+		execperm="$(stat -c %a "${executabledir}/${execname}")"
 		# Grab the first and second digit for user and group permission
 		# Grab the first and second digit for user and group permission
 		userexecperm="${execperm:0:1}"
 		userexecperm="${execperm:0:1}"
 		groupexecperm="${execperm:1:1}"
 		groupexecperm="${execperm:1:1}"
@@ -93,24 +95,24 @@ fn_check_permissions(){
 			# If user permission is invalid, then check for invalid group permissions
 			# If user permission is invalid, then check for invalid group permissions
 			if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ]  || [ "${groupexecperm}" == "6" ]; then
 			if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ]  || [ "${groupexecperm}" == "6" ]; then
 				# If permission issues are found
 				# If permission issues are found
-				fn_print_warning "Permissions issue found"
+				fn_print_warn "Permissions issue found"
 				fn_script_log_warn "Permissions issue found"
 				fn_script_log_warn "Permissions issue found"
 				fn_print_information_nl "The following file is not executable:"
 				fn_print_information_nl "The following file is not executable:"
-				ls -l "${executabledir}/${executable}"
+				ls -l "${executabledir}/${execname}"
 				fn_script_log_info "The following file is not executable:"
 				fn_script_log_info "The following file is not executable:"
-				fn_script_log_info "${executabledir}/${executable}"
-				fn_print_information_nl "Applying chmod u+x,g+x ${executabledir}/${executable}"
+				fn_script_log_info "${executabledir}/${execname}"
+				fn_print_information_nl "Applying chmod u+x,g+x ${executabledir}/${execname}"
 				fn_script_log_info "Applying chmod u+x,g+x ${execperm}"
 				fn_script_log_info "Applying chmod u+x,g+x ${execperm}"
 				# Make the executable executable
 				# Make the executable executable
-				chmod u+x,g+x "${executabledir}/${executable}"
+				chmod u+x,g+x "${executabledir}/${execname}"
 				# Second check to see if it's been successfully applied
 				# Second check to see if it's been successfully applied
 				if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ]  || [ "${userexecperm}" == "6" ]; then
 				if [ "${userexecperm}" == "0" ] || [ "${userexecperm}" == "2" ] || [ "${userexecperm}" == "4" ]  || [ "${userexecperm}" == "6" ]; then
 					if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ]  || [ "${groupexecperm}" == "6" ]; then
 					if [ "${groupexecperm}" == "0" ] || [ "${groupexecperm}" == "2" ] || [ "${groupexecperm}" == "4" ]  || [ "${groupexecperm}" == "6" ]; then
 					# If errors are still found
 					# If errors are still found
 					fn_print_fail_nl "The following file could not be set executable:"
 					fn_print_fail_nl "The following file could not be set executable:"
-					ls -l "${executabledir}/${executable}"
+					ls -l "${executabledir}/${execname}"
 					fn_script_log_warn "The following file could not be set executable:"
 					fn_script_log_warn "The following file could not be set executable:"
-					fn_script_log_info "${executabledir}/${executable}"
+					fn_script_log_info "${executabledir}/${execname}"
 					core_exit.sh
 					core_exit.sh
 					fi
 					fi
 				fi
 				fi