ovdashboard/deploy/install.sh

99 lines
2.7 KiB
Bash
Raw Permalink Normal View History

2023-11-15 12:55:10 +00:00
#!/bin/sh
#########
# start #
#########
# env setup
2024-04-24 13:57:01 +00:00
ovd_version="0.2.1"
2023-11-15 12:55:10 +00:00
export DEBIAN_FRONTEND="noninteractive"
set -e
# banner
echo "Installer for OVDashboard ${ovd_version}"
echo "Waiting 10 seconds, press Ctrl+C to cancel installation ..."
sleep 10
#################
# prerequisites #
#################
# 134: docker with compose
# 113: chromium browser
/boot/dietpi/dietpi-software install 134 113
# htpdate (timesync in restricted networks)
# unclutter (hides mouse cursor)
apt-get update && apt-get install --yes --no-install-recommends \
htpdate unclutter
# activate unclutter
echo '/usr/bin/unclutter -idle 0.1 &' > /etc/chromium.d/dietpi-unclutter
# chromium window size
echo "Please enter your screen resolution!"
screen_x="$( cut -d ',' -f 1 '/sys/class/graphics/fb0/virtual_size' )"
printf "Width [default: %d]: " "${screen_x}"
read -r screen_x_in
screen_x="${screen_x_in:-$screen_x}"
sed -ri "s/^(SOFTWARE_CHROMIUM_RES_X=)[0-9]+$/\1${screen_x}/" '/boot/dietpi.txt'
screen_y="$( cut -d ',' -f 2 '/sys/class/graphics/fb0/virtual_size' )"
printf "Height [default: %d]: " "${screen_y}"
read -r screen_y_in
screen_y="${screen_y_in:-$screen_y}"
sed -ri "s/^(SOFTWARE_CHROMIUM_RES_Y=)[0-9]+$/\1${screen_y}/" '/boot/dietpi.txt'
# chromium autostart
sed -ri "s/^(AUTO_SETUP_AUTOSTART_LOGIN_USER=).+$/\1dietpi/" '/boot/dietpi.txt' # run as "dietpi"
sed -ri "s/^(SOFTWARE_CHROMIUM_AUTOSTART_URL=).+$/\1http:\/\/localhost\//" '/boot/dietpi.txt' # open "localhost"
2023-11-15 22:17:56 +00:00
/boot/dietpi/dietpi-autostart 11 # 11: magic number for chromium autostart
2023-11-15 12:55:10 +00:00
# chromium language
display_lang="en-US,en"
printf "Enter display language(s) [default: %s]: " "${display_lang}"
read -r display_lang_in
display_lang="${display_lang_in:-${display_lang}}"
sudo -u dietpi mkdir -p '/home/dietpi/.config/chromium/Default'
echo '{"intl":{"selected_languages":"'"${display_lang}"'"}}' \
| sudo -u dietpi tee '/home/dietpi/.config/chromium/Default/Preferences' \
> /dev/null
#######
# app #
#######
mkdir -p /opt/ovdashboard
2023-11-16 14:32:02 +00:00
# prepare compose project
2023-11-15 12:55:10 +00:00
curl \
--proto "=https" --tlsv1.2 -sSf \
--output "/opt/ovdashboard/docker-compose.yml" \
2023-11-15 14:15:31 +00:00
"https://code.yavook.de/OEKZident.de/ovdashboard/raw/tag/v${ovd_version}/deploy/docker-compose.yml"
2023-11-16 14:32:02 +00:00
docker compose \
--project-directory "/opt/ovdashboard" \
pull
# review compose file
echo "Please review the Docker Compose file before continuing! [hit Return]"
read -r _RETURN
2023-11-15 12:55:10 +00:00
nano "/opt/ovdashboard/docker-compose.yml"
# start server
docker compose \
--project-directory "/opt/ovdashboard" \
up --detach
############
# finalize #
############
echo ""
echo "#########################"
echo "# OVDashboard Installed #"
echo "#########################"
echo ""
echo "You can now reboot your device."