-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_file_caps.sh
executable file
·71 lines (59 loc) · 1.88 KB
/
set_file_caps.sh
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
#!/usr/bin/env bash
echo " "
echo "+----------------------------------------+"
echo "| Try to set file capabilities |"
echo "| --> need sudo for some parts |"
echo "+----------------------------------------+"
echo " "
sudo -v
# keep-alive
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ttenv_gpio
if [ -f ./ttenv_gpio/ttenv_gpio ]; then
sudo setcap "cap_sys_nice=pe" ./ttenv_gpio/ttenv_gpio
else
echo "./ttenv_gpio/ttenv_gpio does not exist"
fi
if [ -f ${HOME}/bin/ttenv_gpio ]; then
sudo setcap "cap_sys_nice=pe" ${HOME}/bin/ttenv_gpio
else
echo "${HOME}/bin/ttenv_gpio does not exist"
fi
# ttenv_gpio_simple
if [ -f ./ttenv_gpio_simple/ttenv_gpio_simple ]; then
sudo setcap "cap_sys_nice=pe" ./ttenv_gpio_simple/ttenv_gpio_simple
else
echo "./ttenv_gpio_simple/ttenv_gpio_simple does not exist"
fi
if [ -f ${HOME}/bin/ttenv_gpio_simple ]; then
sudo setcap "cap_sys_nice=pe" ${HOME}/bin/ttenv_gpio_simple
else
echo "${HOME}/bin/ttenv_gpio_simple does not exist"
fi
# ttenv_simple
if [ -f ./ttenv_simple/ttenv_simple ]; then
sudo setcap "cap_sys_nice=pe" ./ttenv_simple/ttenv_simple
else
echo "./ttenv_simple/ttenv_simple does not exist"
fi
if [ -f ${HOME}/bin/ttenv_simple ]; then
sudo setcap "cap_sys_nice=pe" ${HOME}/bin/ttenv_simple
else
echo "${HOME}/bin/ttenv_simple does not exist"
fi
# ttenv_swt_led
if [ -f ./ttenv_swt_led/ttenv_swt_led ]; then
sudo setcap "cap_sys_nice=pe" ./ttenv_swt_led/ttenv_swt_led
else
echo "./ttenv_swt_led/ttenv_swt_led does not exist"
fi
if [ -f ${HOME}/bin/ttenv_swt_led ]; then
sudo setcap "cap_sys_nice=pe" ${HOME}/bin/ttenv_swt_led
else
echo "${HOME}/bin/ttenv_swt_led does not exist"
fi
echo " "
echo "+----------------------------------------+"
echo "| Cheers $USER |"
echo "+----------------------------------------+"
echo " "