35 lines
968 B
Bash
35 lines
968 B
Bash
#!/bin/bash
|
|
|
|
# INSTALL SCRIPT
|
|
# The install script is required for all templates.
|
|
# It is used to install the service on the server.
|
|
# It is called with the path to the server specific env file as an argument.
|
|
|
|
|
|
install_prerequisites() {
|
|
# this script works on debian, ubuntu and Raspberry Pi OS
|
|
# it checks the following prerequisites, and installs them if missing.
|
|
# if the user is root it proceeds, otherwise it checks for sudo privileges.
|
|
# if neither exists, and a prerequisite is missing, the script exits with failure.
|
|
|
|
# prerequisites:
|
|
# - bash
|
|
# - curl
|
|
# - wget
|
|
# - docker
|
|
|
|
PREREQUISITES=("bash" "curl" "wget" "docker")
|
|
|
|
# check if all prerequisites are installed
|
|
for prerequisite in "${PREREQUISITES[@]}"; do
|
|
if ! command -v "${prerequisite}" &> /dev/null; then
|
|
echo "Prerequisite: ${prerequisite} is not installed."
|
|
exit 1
|
|
fi
|
|
done
|
|
}
|
|
|
|
install_prerequisites
|
|
exit 0
|
|
|