<commit_before>#!/bin/bash
# LGSM check_permissions.sh
# Author: <NAME>
# Contributor: UltimateByte
# Website: http://gameservermanagers.com
lgsm_version="150316"

# Description: Checks script, files and folders ownership and permissions.

# Initializing useful variables
currentuser="$(whoami)"
scriptfullpath="${rootdir}/${selfname}"
permissionerror="0"

fn_check_ownership(){
if [ "${currentuser}" != "$(stat -c %U "${scriptfullpath}")" ] && [ "${currentuser}" != "$(stat -c %G "${scriptfullpath}")" ]; then
  permissionerror="1"
  fn_print_fail_nl "Permission denied"
  echo "	* To check allowed user and group run ls -l ${selfname}"
fi
}

fn_check_permissions(){
if [ -n "${functionsdir}" ]; then
  find "${functionsdir}" -name "*.sh" | while read -r filename; do perm="$(stat -c %a "${filename}")"; shortperm="$(echo "${perm:0:1}")";
    if [ "${shortperm}" != "7" ]; then
      permissionerror="1"
      fn_print_warn_nl "Warning, permission issues found in ${functionsdir}"
      echo "  * Easy fix : chmod -R 755 ${functionsdir}"
    fi
  done
fi
}

fn_check_permissions_summary(){
if [ "${permissionerror}" == "1" ]; then
  exit 1
fi
}

fn_check_ownership
fn_check_permissions
fn_check_permissions_summary<commit_msg>Update check_permissions.sh<commit_after>#!/bin/bash
# LGSM check_permissions.sh
# Author: <NAME>
# Contributor: UltimateByte
# Website: http://gameservermanagers.com
lgsm_version="150316"

# Description: Checks script, files and folders ownership and permissions.

# Initializing useful variables
currentuser="$(whoami)"
scriptfullpath="${rootdir}/${selfname}"
permissionerror="0"

fn_check_ownership(){
if [ "${currentuser}" != "$(stat -c %U "${scriptfullpath}")" ] && [ "${currentuser}" != "$(stat -c %G "${scriptfullpath}")" ]; then
  permissionerror="1"
  fn_print_fail_nl "Permission denied"
  echo "	* To check allowed user and group run ls -l ${selfname}"
fi
}

fn_check_permissions(){
if [ -n "${functionsdir}" ]; then
  find "${functionsdir}" -name "*.sh" | while read -r filename; do perm="$(stat -c %a "${filename}")"; shortperm="$(echo "${perm:0:1}")";
    if [ "${shortperm}" != "7" ]; then
      fn_print_warn_nl "Warning, permission issues found in ${functionsdir}"
      echo "  * Easy fix : chmod -R 755 ${functionsdir}"
    fi
  done
fi
}

fn_check_permissions_summary(){
if [ "${permissionerror}" == "1" ]; then
  exit 1
fi
}

fn_check_ownership
fn_check_permissions
fn_check_permissions_summary
{'fraction_non_alphanumeric': 0.16953316953316952, 'fraction_numerical': 0.013513513513513514, 'mean_word_length': 5.232142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6941721', 'n_tokens_mistral': 824, 'n_tokens_neox': 791, 'n_words': 213}