|
@@ -10,11 +10,11 @@ lgsm_version="150316"
|
|
|
# Initializing useful variables
|
|
# Initializing useful variables
|
|
|
currentuser="$(whoami)"
|
|
currentuser="$(whoami)"
|
|
|
scriptfullpath="${rootdir}/${selfname}"
|
|
scriptfullpath="${rootdir}/${selfname}"
|
|
|
-permissionerror="0"
|
|
|
|
|
|
|
+conclusionpermissionerror="0"
|
|
|
|
|
|
|
|
fn_check_ownership(){
|
|
fn_check_ownership(){
|
|
|
if [ "${currentuser}" != "$(stat -c %U "${scriptfullpath}")" ] && [ "${currentuser}" != "$(stat -c %G "${scriptfullpath}")" ]; then
|
|
if [ "${currentuser}" != "$(stat -c %U "${scriptfullpath}")" ] && [ "${currentuser}" != "$(stat -c %G "${scriptfullpath}")" ]; then
|
|
|
- permissionerror="1"
|
|
|
|
|
|
|
+ conclusionpermissionerror="1"
|
|
|
fn_print_fail_nl "Permission denied"
|
|
fn_print_fail_nl "Permission denied"
|
|
|
echo " * To check allowed user and group run ls -l ${selfname}"
|
|
echo " * To check allowed user and group run ls -l ${selfname}"
|
|
|
fi
|
|
fi
|
|
@@ -24,23 +24,24 @@ fn_check_permissions(){
|
|
|
permissionfailure="0"
|
|
permissionfailure="0"
|
|
|
if [ -n "${functionsdir}" ]; then
|
|
if [ -n "${functionsdir}" ]; then
|
|
|
while read -r filename
|
|
while read -r filename
|
|
|
- do
|
|
|
|
|
- perm="$(stat -c %a "${filename}")"
|
|
|
|
|
- shortperm="${perm:0:1}"
|
|
|
|
|
- if [ "${shortperm}" != "7" ]; then
|
|
|
|
|
- permissionfailure="1"
|
|
|
|
|
- fi
|
|
|
|
|
|
|
+ do
|
|
|
|
|
+ perm="$(stat -c %a "${filename}")"
|
|
|
|
|
+ shortperm="${perm:0:1}"
|
|
|
|
|
+ if [ "${shortperm}" != "7" ]; then
|
|
|
|
|
+ permissionfailure="1"
|
|
|
|
|
+ conclusionpermissionerror="1"
|
|
|
|
|
+ fi
|
|
|
done <<< "$(find "${functionsdir}" -name "*.sh")"
|
|
done <<< "$(find "${functionsdir}" -name "*.sh")"
|
|
|
|
|
|
|
|
if [ "${permissionfailure}" == "1" ]; then
|
|
if [ "${permissionfailure}" == "1" ]; then
|
|
|
- fn_print_warn_nl "Warning, permission issues found in ${functionsdir}"
|
|
|
|
|
|
|
+ fn_print_warn_nl "Warning, permission issues found in functions."
|
|
|
echo " * Easy fix : chmod -R 755 ${functionsdir}"
|
|
echo " * Easy fix : chmod -R 755 ${functionsdir}"
|
|
|
fi
|
|
fi
|
|
|
fi
|
|
fi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fn_check_permissions_conclusion(){
|
|
fn_check_permissions_conclusion(){
|
|
|
-if [ "${permissionerror}" == "1" ]; then
|
|
|
|
|
|
|
+if [ "${conclusionpermissionerror}" == "1" ]; then
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
}
|
|
}
|