Skip to content

Commit

Permalink
chore: add startup delay to service for SpeederPad
Browse files Browse the repository at this point in the history
  • Loading branch information
mryel00 committed Nov 11, 2023
1 parent 549f7d4 commit c1dcf70
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ main() {
status_msg "Install service file ..." "1"
fi

if [[ "$(is_speederpad)" = "1" ]]; then
msg "\nSpeederpad detected!"
msg "Add startup delay to service file ...\n"
add_sleep_to_service_file
fi

if install_env_file; then
status_msg "Install environment file ..." "0"
else
Expand Down
19 changes: 19 additions & 0 deletions tools/libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ is_ubuntu_arm() {
fi
}

is_speederpad() {
if [[ "$(is_ubuntu_arm)" = "1" ]] &&
[[ "$(uname -rm)" = "4.9.191 aarch64" ]] &&
grep -q "Ubuntu 20.04." /etc/os-release; then
echo "1"
else
echo "0"
fi
}

test_load_module() {
if modprobe -n "${1}" &> /dev/null; then
echo 1
Expand Down Expand Up @@ -189,6 +199,15 @@ install_service_file() {
grep -q "${BASE_USER}" "${target_dir}/crowsnest.service" || return 1
}

add_sleep_to_service_file() {
local service_file
service_file="/etc/systemd/system/crowsnest.service"

if [[ -f "${service_file}" ]]; then
echo "ExecStartPre=/bin/sleep 5" >> "${service_file}"
fi
}

install_env_file() {
local env_file env_target
env_file="${PWD}/resources/crowsnest.env"
Expand Down

0 comments on commit c1dcf70

Please sign in to comment.