This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·74 lines (60 loc) · 1.74 KB
/
install.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
#!/bin/bash
CURRENT_USER=$(whoami)
function usage () {
echo "Invalid arguments"
if [ "$1" = "username" ]; then
echo "Username missing."
fi
if [ "$1" = "password" ]; then
echo "Password missing."
fi
if [ "$1" = "furnaces"]; then
echo "Furnaces missing"
fi
echo "\nusage: $0 <foundry_cloud-username> <foundry_cloud-password> <foundry_cloud-furnaces>"
exit 2
}
function prompt_for() {
local prompt=$1
local default=$2
local output_variable=$3
echo $prompt
read -p "[$default]: " answer
case $answer in
"") eval $output_variable=\"$default\" ;;
*) eval $output_variable=\"$answer\" ;;
esac
}
prompt_for "FoundryCloud Username" "" FC_USERNAME
prompt_for "FoundryCould Password" "" FC_PASSWORD
prompt_for "Furnaces to be displayed" "" FC_FURNACES
[[ -z "$FC_USERNAME" ]] && usage 'username'
[[ -z "$FC_PASSWORD" ]] && usage 'password'
[[ -z "$FC_FURNACES" ]] && usage 'furnaces'
wget -O /home/$CURRENT_USER/kiosk.sh https://raw.githubusercontent.com/marcfreiheit/zorc-foundry-displays/master/startup.sh
chmod u+x /home/$CURRENT_USER/kiosk.sh
sudo tee /lib/systemd/system/kiosk.service > /dev/null <<EOF
[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target
[Service]
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/$CURRENT_USER/.Xauthority
Type=simple
ExecStart=/bin/bash /home/$CURRENT_USER/kiosk.sh $FC_USERNAME $FC_PASSWORD $FC_FURNACES
Restart=on-abort
User=$CURRENT_USER
Group=$CURRENT_USER
[Install]
WantedBy=graphical.target
EOF
sudo systemctl enable kiosk.service
sudo systemctl start kiosk.service
echo "Do you want to restart in order to boot into kiosk mode?"
select yn in "Yes" "No"; do
case $yn in
Yes ) sudo reboot; break;;
No ) exit 0;;
esac
done