#!/bin/bash
# mount - mounting support
# $1 - mount point
is_mounted() {
has_args 1 "$@"
mount | grep " $1 " >/dev/null
}
# $1 - thing to mount
# $2 - mount point
run_mount() {
min_args 2 "$@"
local mnt="${@[-1]}"
[ -d "$mnt" ] || run_sudo mkdir -p "$mnt"
run_sudo mount "$@"
}
# $1 - mount point
run_umount() {
has_args 1 "$@"
local mnt=$1
if is_mounted "$mnt"; then
run_sudo umount "$mnt"
else
warn "$mnt: not mounted"
fi
}