-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfuse
More file actions
executable file
·76 lines (71 loc) · 2.08 KB
/
fuse
File metadata and controls
executable file
·76 lines (71 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#! /bin/bash
echo
echo "COMMAND : fire/$0 $@ # FireFUSE start/stop utility"
function help() {
echo "SYNOPSIS: fire/$0 [-ksh]"
echo "EXAMPLE : Shut down firefuse:"
echo " : fire/fuse -k"
echo "EXAMPLE : Start firefuse"
echo " : fire/fuse -s"
echo "EXAMPLE : Print this documentation:"
echo " : fire/config -h"
}
if [ "$1" == "" ] || [ "$1" == "-h" ]; then help; exit 0; fi
sudo -k
ls /dev | grep firefuse > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR : FireFUSE is not installed and cannot be configured"
echo "TRY : git clone https://github.com/firepick1/FireFUSE"
echo "TRY : cd FireFUSE"
echo "TRY : ./build"
exit -1;
fi
if [ "$1" == "-k" ]; then
if [ -e /dev/firefuse/status ]; then
echo "STATUS : stopping firefuse"
echo "COMMAND : sudo fusermount -u /dev/firefuse"
sudo fusermount -u /dev/firefuse
if [ $? -ne 0 ]; then
echo "ERROR : /dev/firefuse could not be unmounted"
exit -1
fi
fi
echo "STATUS : FireFUSE is not running"
echo "STATUS : checking for raspistill..."
ps -ef | grep raspistill | grep -v grep
rc=$?
if [ $rc -eq 0 ]; then
PID=`ps -ef | grep raspistill | grep -v grep | grep -o -E "[0-9]+" | head -1`
echo "STATUS : sudo kill -9 $PID"
sudo kill -9 $PID
rc=$?
if [ $rc -ne 0 ]; then echo "ERROR : FAILED rc=${rc}"; exit -1; fi
fi
echo "SUCCESS : FireFUSE and raspistill stopped"
elif [ "$1" == "-s" ]; then
if [ -e /dev/firefuse/status ]; then
echo "STATUS : FireFUSE is already running"
exit 0
fi
pushd FireFUSE > /dev/null
rc=$?
if [ $rc -ne 0 ]; then echo "ERROR : FAILED rc=${rc}"; exit -1; fi
echo "STATUS : starting FireFUSE..."
echo "COMMAND : sudo target/firefuse -o allow_other /dev/firefuse"
sudo target/firefuse -o allow_other /dev/firefuse
rc=$?
if [ $rc -ne 0 ]; then
echo "ERROR : FAILED rc=${rc}"
echo "TRY : build FireFUSE and try again after rebooting"
exit -1;
fi
popd > /dev/null
echo "SUCCESS : FireFUSE started"
else
help
exit 0;
fi
echo "FYI : To monitor FireFUSE activity, see /var/log/firefuse.log"
echo "------------------------------"
echo
tail /var/log/firefuse.log