Circlean/fs/home/kitten/kitten_mount_dst

21 lines
601 B
Bash
Executable File

#!/bin/bash
set -e
#set -x
if [ $# -eq 3 ]; then
if ! [ "${1}" -ge "1000" ] ; then
# avoid the risk of passing other options to mount, and enforce uid >= 1000
echo "$1 is not a valid uid (>= 1000)"
exit 1
fi
# uid= only works on a vfat FS. What should we do if we get an ext* FS ?
# the main problem is that we need the rw rights on the dest key.
# It is not possible to ensure it on a non-vfat USB key.
mount -t vfat -o user,noexec,nosuid,nodev,rw,uid="${1}",utf8=1 "${2}" "${3}"
exit 0
else
echo 'Invalid number of arguments.'
exit 1
fi