forked from matt2005/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpi.sh
executable file
·88 lines (82 loc) · 2.23 KB
/
rpi.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
#location of OS details for linux
OS_RELEASE_FILE="/etc/os-release"
#check if Raspian OS is active, otherwise kill script
if grep -q "Raspbian" ${OS_RELEASE_FILE};
then
echo "Great this script works for RaspberryPI OS"
else
echo "This script works only for an RaspberryPI OS"
exit 1;
fi
display_version(){
echo "Version 0.2 RaspberryPI Dash additional install helpers"
}
#########################
# The command line help #
#########################
display_help() {
echo "Usage: $0 [option...]" >&2
echo
echo " -arb, --addrulebrightness Add udev rules for brightness"
echo " -adi, --adddesktopicon Add desktop icon"
echo " -asd, --autostartdaemon Add autostart daemon"
echo " -v, --version Show version of script"
echo " -h, --help Show help of script"
echo
echo
echo "Example: Setup udev rule for controlling brightness of an official 7inch Touch screen"
echo " rpi -arb"
echo
echo "Example: Add an desktop icon on your RPI."
echo " rpi -adi"
echo
echo "Example: Add autostart daemon on your RPI."
echo " rpi -asd"
echo
exit 1
}
################################
# Check if parameters options #
# are given on the commandline #
################################
while :
do
#echo "$1"
case "$1" in
-arb | --addrulebrightness)
/bin/bash src/bash/brightness.sh
exit 0
;;
-adi | --adddesktopicon)
/bin/bash src/bash/desktop.sh
exit 0
;;
-asd | --autostartdaemon)
if [ $# -ne 0 ]; then
/bin/bash src/bash/autostartdaemon.sh $2
exit 0
fi
;;
-h | --help)
display_help # Call your function
exit 0
;;
-v | --version)
display_version # Call your function
exit 0
;;
--) # End of all options
shift
break
;;
-*)
echo "Error: Unknown option: $1" >&2
## or call function display_help
exit 1
;;
*) # No more options
break
;;
esac
done