Skip to content

Commit

Permalink
Update installUpgradeFunctions.sh: Fix is_tmp_mounted()
Browse files Browse the repository at this point in the history
It didn't check if ${ALLSKY_TMP} was actually mounted - it checked if it was mount-able.  Fix by checking using the "mount" command.

Also, rename it so it can be used for other filesystems.
  • Loading branch information
EricClaeys authored Jul 16, 2024
1 parent f400083 commit 79e131c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/installUpgradeFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,12 @@ function check_swap()

INITIAL_FSTAB_STRING="tmpfs ${ALLSKY_TMP} tmpfs"

function is_tmp_mounted()
# Is the tmp directory mounted?
function is_mounted()
{
grep --quiet "^${INITIAL_FSTAB_STRING}" /etc/fstab
local TMP="${1}"

mount | grep --quiet "${TMP}"
}
function umount_tmp()
{
Expand Down Expand Up @@ -649,8 +652,9 @@ function check_tmp()
[[ -z ${WT_WIDTH} ]] && WT_WIDTH="$( calc_wt_size )"
local STRING SIZE D MSG

# Check if currently a memory filesystem.
if is_tmp_mounted; then
# If the prior ${ALLSKY_TMP} was a memory filesystem it will have an entry
# in /etc/fstab with ${ALLSKY_TMP} in it, even if it's not currently mounted.
if grep --quiet "^${INITIAL_FSTAB_STRING}" /etc/fstab ; then
MSG="${ALLSKY_TMP} is currently a memory filesystem; no change needed."
display_msg --logonly info "${MSG}"

Expand Down

0 comments on commit 79e131c

Please sign in to comment.