diff options
author | Vlad Glagolev | 2015-03-26 10:33:35 +0300 |
---|---|---|
committer | Vlad Glagolev | 2015-03-26 10:33:35 +0300 |
commit | fdc090a104659fbbe649b7536f77209d818dc404 (patch) | |
tree | 4613d49bc682aa43285634a02756cdc1f20f82dd /FUNCTIONS | |
parent | 00cedc07ba502edff0651cdf98f97f3b73a759ad (diff) |
added check_tmp_noexec() to check secured /tmp partitions
Diffstat (limited to 'FUNCTIONS')
-rwxr-xr-x | FUNCTIONS | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -712,6 +712,27 @@ function is_version_less() { } #--- +## Check sanity of a temporary partition +## @param $1 - the partition to check for +#--- +function check_tmp_noexec() { + if [[ -z $1 ]]; then + message "${PROBLEM_COLOR}Partition name cannot be empty${DEFAULT_COLOR}" && + return 1 + fi && + + if awk -v tmp=$1 '{ if ($2 == tmp) print $4 }' < /proc/mounts | grep -q noexec; then + message -n "${MESSAGE_COLOR}Remounting $1 with exec option (required for build)... " && + mount -o exec,remount $1 && + message "done${DEFAULT_COLOR}" + else + message -n "${MESSAGE_COLOR}Restoring $1 mount options..." && + mount -o noexec,remount $1 && + message "done${DEFAULT_COLOR}" + fi +} + +#--- ## Simple version check with force depends ## @params $1 - the spell to check the version of ## @params $2 - the simple version to check against |