-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
install_linux.sh
executable file
·88 lines (74 loc) · 2.49 KB
/
install_linux.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
# NymphCast installer for the Linux platform.
if [ "$(uname -s)" = "Linux" ]; then
echo "Detected Linux system. Proceeding with installation..."
else
echo "This installer requires a Linux system. Exiting..."
exit
fi
# Requires that the binaries have been compiled with the 'setup.sh' script first.
PLATFORM=`g++ -dumpmachine`
if [ -f "src/server/bin/${PLATFORM}/nymphcast_server" ]; then
echo "NymphCast Server binary found, skipping compilation..."
else
echo "Compiling NymphCast server..."
./setup.sh
fi
# Copy files to the target folders.
sudo make -C src/server/ install
# Set the requested configuration file.
read -p "Desired NymphCast receiver configuration? [audio/video/screensaver/gui] " choice
DESKTOP_INSTALL=true
case $choice in
audio)
echo "Setting Audio configuration..."
sudo cp src/server/nymphcast_audio_config.ini /usr/local/etc/nymphcast/nymphcast_config.ini
DESKTOP_INSTALL=false
;;
video)
echo "Setting video configuration..."
sudo cp src/server/nymphcast_video_config.ini /usr/local/etc/nymphcast/nymphcast_config.ini
;;
screensaver)
echo "Setting screensaver configuration..."
sudo cp src/server/nymphcast_screensaver_config.ini /usr/local/etc/nymphcast/nymphcast_config.ini
;;
gui)
echo "Setting GUI configuration..."
sudo cp src/server/nymphcast_gui_config.ini /usr/local/etc/nymphcast/nymphcast_config.ini
;;
*)
echo "Unrecognised choice. Please set configuration manually."
;;
esac
# Confirm installation of autostart/service.
read -p "Install autostart file/system service? (Y/N)" install_auto
case $install_auto in
Y)
echo "Installing..."
;;
*)
echo "Installation finished."
exit
;;
esac
# If GUI, screensaver or video mode, install Desktop file for auto-start.
if [ "${DESKTOP_INSTALL}" = "true" ]; then
# TODO: Install desktop file into $XDG_CONFIG_DIRS/autostart (/etc/xdg/autostart).
#sudo cp src/server/autostart/nymphcast_server.desktop $XDG_CONFIG_DIRS/autostart
echo "Installing .desktop file to /etc/xdg/autostart..."
sudo cp src/server/autostart/nymphcast_server.desktop /etc/xdg/autostart
else
# Install systemd or openrc service.
if [ -d "/run/systemd/system" ]; then
echo "Installing systemd service..."
sudo make -C src/server/ install-systemd
sudo chmod 644 /etc/systemd/user/nymphcast.service
#sudo systemctl enable nymphcast.service
systemctl --user enable nymphcast.service
else
echo "Installing OpenRC service..."
sudo make -C src/server/ install-openrc
fi
fi
echo "Installation finished."