Skip to content

Commit d9d82a1

Browse files
committed
feat(permissions): Attempt to fix non executable files issue
1 parent 02223a5 commit d9d82a1

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

lgsm/modules/check_permissions.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,27 @@ fn_check_permissions() {
7171
echo -en "File:"
7272
echo -en "${findnotexecutable}"
7373
} | column -s $'\t' -t | tee -a "${lgsmlog}"
74-
if [ "${monitorflag}" == 1 ]; then
75-
alert="permissions"
76-
alert.sh
74+
75+
# Attempt to make the files executable
76+
fn_print_information_nl "Attempting to fix permissions issues"
77+
fn_script_log_info "Attempting to fix permissions issues"
78+
echo "${findnotexecutable}" | xargs chmod +x
79+
80+
# Re-check if there are still non-executable files
81+
findnotexecutable="$(find "${modulesdir}" -type f -not -executable)"
82+
findnotexecutablewc="$(find "${modulesdir}" -type f -not -executable | wc -l)"
83+
if [ "${findnotexecutablewc}" -ne "0" ]; then
84+
fn_print_fail_nl "Failed to resolve permissions issues"
85+
fn_script_log_fail "Failed to resolve permissions issues"
86+
if [ "${monitorflag}" == 1 ]; then
87+
alert="permissions"
88+
alert.sh
89+
fi
90+
core_exit.sh
91+
else
92+
fn_print_ok_nl "Permissions issues resolved"
93+
fn_script_log_pass "Permissions issues resolved"
7794
fi
78-
core_exit.sh
7995
fi
8096
fi
8197

0 commit comments

Comments
 (0)