summaryrefslogtreecommitdiffstats
path: root/FUNCTIONS
diff options
context:
space:
mode:
authorVlad Glagolev2015-03-26 10:33:35 +0300
committerVlad Glagolev2015-03-26 10:33:35 +0300
commitfdc090a104659fbbe649b7536f77209d818dc404 (patch)
tree4613d49bc682aa43285634a02756cdc1f20f82dd /FUNCTIONS
parent00cedc07ba502edff0651cdf98f97f3b73a759ad (diff)
added check_tmp_noexec() to check secured /tmp partitions
Diffstat (limited to 'FUNCTIONS')
-rwxr-xr-xFUNCTIONS21
1 files changed, 21 insertions, 0 deletions
diff --git a/FUNCTIONS b/FUNCTIONS
index b991bae1d7..d328f523f5 100755
--- a/FUNCTIONS
+++ b/FUNCTIONS
@@ -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