Commit 2d53cc4 1 parent 549f7d4 commit 2d53cc4 Copy full SHA for 2d53cc4
File tree 4 files changed +36
-2
lines changed
4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ if [ "$#" -eq 0 ]; then
41
41
fi
42
42
43
43
# # Parse Args
44
- while getopts " :vhc:d" arg; do
44
+ while getopts " :vhc:s: d" arg; do
45
45
case " ${arg} " in
46
46
v )
47
47
echo -e " \ncrowsnest Version: $( self_version) \n"
@@ -55,6 +55,15 @@ while getopts ":vhc:d" arg; do
55
55
check_cfg " ${OPTARG} "
56
56
export CROWSNEST_CFG=" ${OPTARG} "
57
57
;;
58
+ s )
59
+ if [[ " $( awk ' {print $1}' /proc/uptime | cut -d ' .' -f 1) " -lt " 120" ]]; then
60
+ if [[ " ${OPTARG} " ]]; then
61
+ sleep " ${OPTARG} "
62
+ else
63
+ sleep 5
64
+ fi
65
+ fi
66
+ ;;
58
67
d )
59
68
set -x
60
69
;;
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ function help_msg {
34
34
echo -e " \t crowsnest [Options]"
35
35
echo -e " \n\t\t-h Prints this help."
36
36
echo -e " \n\t\t-v Prints Version of crowsnest."
37
- echo -e " \n\t\t-c </path/to/configfile>\n\t\t\tPath to your webcam.conf\n"
37
+ echo -e " \n\t\t-c </path/to/configfile>\n\t\t\tPath to your webcam.conf"
38
+ echo -e " \n\t\t-s <sleep_seconds>\n\t\t\tDelay start \(in seconds\) after boot\n"
38
39
}
39
40
40
41
function deprecated_msg_1 {
Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ main() {
123
123
status_msg " Install environment file ..." " 1"
124
124
fi
125
125
126
+ if [[ " $( is_speederpad) " = " 1" ]]; then
127
+ msg " \nSpeederpad detected!"
128
+ msg " Add startup delay to environment file ...\n"
129
+ add_sleep_to_crowsnest_env
130
+ fi
131
+
126
132
if install_logrotate_conf; then
127
133
status_msg " Install logrotate configuration ..." " 0"
128
134
else
Original file line number Diff line number Diff line change @@ -66,6 +66,15 @@ is_ubuntu_arm() {
66
66
fi
67
67
}
68
68
69
+ is_speederpad () {
70
+ if grep -q " Ubuntu 20.04." /etc/os-release &&
71
+ [[ " $( uname -rm) " = " 4.9.191 aarch64" ]]; then
72
+ echo " 1"
73
+ else
74
+ echo " 0"
75
+ fi
76
+ }
77
+
69
78
test_load_module () {
70
79
if modprobe -n " ${1} " & > /dev/null; then
71
80
echo 1
@@ -189,6 +198,15 @@ install_service_file() {
189
198
grep -q " ${BASE_USER} " " ${target_dir} /crowsnest.service" || return 1
190
199
}
191
200
201
+ add_sleep_to_crowsnest_env () {
202
+ local service_file
203
+ env_file=" ${CROWSNEST_ENV_PATH} /crowsnest.env"
204
+
205
+ if [[ -f " ${env_file} " ]]; then
206
+ sed -i ' s/\(CROWSNEST_ARGS="[^"]*\)"/\1 -s"/' " ${env_file} "
207
+ fi
208
+ }
209
+
192
210
install_env_file () {
193
211
local env_file env_target
194
212
env_file=" ${PWD} /resources/crowsnest.env"
You can’t perform that action at this time.
0 commit comments