2018-12-27 20:42:38 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-12-28 12:20:31 +00:00
|
|
|
#
|
|
|
|
# {{@@ env['dotdrop_warning'] @@}}
|
|
|
|
#
|
|
|
|
|
2018-12-27 20:42:38 +00:00
|
|
|
if [[ $UID -ne 0 ]]; then
|
|
|
|
echo "You have to run this script as root!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-02-06 02:32:54 +00:00
|
|
|
options=( storage aws umount )
|
2018-12-28 12:25:21 +00:00
|
|
|
|
2018-12-28 11:27:15 +00:00
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
echo "Usage: $0 <project>"
|
|
|
|
echo "e.g.: $0 c3"
|
|
|
|
echo " "
|
|
|
|
echo "Valid options:"
|
|
|
|
for i in "${options[@]}"; do
|
|
|
|
echo " - $i"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
fuse="/video/fuse"
|
|
|
|
video="/video/video"
|
2019-02-06 02:32:54 +00:00
|
|
|
tmp="/video/tmp"
|
2018-12-28 11:27:15 +00:00
|
|
|
|
|
|
|
if mount | grep $fuse > /dev/null; then
|
|
|
|
umount $fuse
|
|
|
|
fi
|
|
|
|
|
|
|
|
if mount | grep $video > /dev/null; then
|
|
|
|
umount $video
|
|
|
|
fi
|
|
|
|
|
2019-02-06 02:32:54 +00:00
|
|
|
if mount | grep $tmp > /dev/null; then
|
|
|
|
umount $tmp
|
|
|
|
fi
|
|
|
|
|
2018-12-28 11:27:15 +00:00
|
|
|
case $1 in
|
2018-12-28 12:18:11 +00:00
|
|
|
storage)
|
2018-12-28 11:27:15 +00:00
|
|
|
mount.cifs //storage.lan.c3voc.de/fuse $fuse -o rw,guest -o uid=phg
|
|
|
|
mount.cifs //storage.lan.c3voc.de/video $video -o rw,guest -o uid=phg
|
2019-02-06 02:32:54 +00:00
|
|
|
mount.cifs //storage.lan.c3voc.de/tmp $tmp -o rw,guest -o uid=phg
|
2018-12-28 11:27:15 +00:00
|
|
|
;;
|
2018-12-28 12:18:11 +00:00
|
|
|
aws)
|
2018-12-28 11:27:15 +00:00
|
|
|
mount.cifs //aws.lan.c3voc.de/fuse $fuse -o rw,guest -o uid=phg
|
|
|
|
mount.cifs //aws.lan.c3voc.de/video $video -o rw,guest -o uid=phg
|
2019-02-06 02:32:54 +00:00
|
|
|
mount.cifs //aws.lan.c3voc.de/tmp $tmp -o rw,guest -o uid=phg
|
|
|
|
;;
|
|
|
|
umount)
|
2018-12-28 11:27:15 +00:00
|
|
|
;;
|
2018-12-28 12:25:21 +00:00
|
|
|
*)
|
|
|
|
echo "Mountpoint does not exist."
|
|
|
|
echo "Please use one of the following:"
|
|
|
|
for i in "${options[@]}"; do
|
|
|
|
echo " - $i"
|
|
|
|
done
|
2018-12-28 11:27:15 +00:00
|
|
|
esac
|