Skip to content

Commit

Permalink
add existMount function
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Nov 15, 2015
1 parent 96977d2 commit ed1a5ce
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,20 @@ function existModule()
fi
}

function existMount()
{
local -r mountOn="$(escapeGrepSearchPattern "${1}")"

local -r foundMount="$(df | grep -E ".*\s+${mountOn}$")"

if [[ "$(isEmptyString "${foundMount}")" = 'true' ]]
then
echo 'false'
else
echo 'true'
fi
}

function existUserLogin()
{
local -r user="${1}"
Expand Down Expand Up @@ -1342,7 +1356,12 @@ function remountTMP()
{
header 'RE-MOUNTING TMP'

mount -o 'remount,rw,exec,nosuid' -v '/tmp'
if [[ "$(existMount '/tmp')" = 'true' ]]
then
mount -o 'remount,rw,exec,nosuid' -v '/tmp'
else
warn 'Mount /tmp not found'
fi
}

function resetLogs()
Expand Down

0 comments on commit ed1a5ce

Please sign in to comment.