-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·55 lines (51 loc) · 1.94 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
#!/bin/sh
##########################################
# #
# Configure installation parameters: #
# #
##########################################
PREFIX="${PREFIX:=/usr/local}"
EXECUTABLE_PATH="$PREFIX/bin/stonenetd"
CONFIG_PATH="$PREFIX/etc/stonenet"
DATA_FILES_PATH="$PREFIX/share/stonenet"
LOGFILE="$PREFIX/var/log/stonenet.log"
# Build & install the desktop app as well.
#USE_DESKTOP_APP=1
# If your system is using Systemd, just uncomment the following line to enable
# the Systemd service:
#SYSTEMD_PATH=/lib/systemd/system
##########################################
# #
# DO NOT CHANGE ANYTHING BELOW THIS! #
# #
##########################################
set -e
cargo build --release
if -n "$USE_DESKTOP_APP"; then
cargo build -p stonenet-desktop --release
fi
install target/release/stonenetd "$EXECUTABLE_PATH"
if -n "$USE_DESKTOP_APP"; then
install target/release/stonenet-desktop "$EXECUTABLE_PATH"
fi
install conf/base.toml "$CONFIG_PATH/config.toml"
install -t static "$DATA_FILES_PATH"
install -t templates "$DATA_FILES_PATH"
# Install systemd service by default
if -n "$SYSTEMD_PATH"; then
install assets/generic/systemd/stonenetd.service "$SYSTEMD_PATH"
systemctl enable --now stonenetd
systemctl daemon-reload
echo Installed systemd service.
# If $SYSTEMD_PATH is empty, try the XDG autostart folder
else
if -n "$XDG_CONFIG_DIRS"; then
install assets/generic/xdg/org.stonenet.stonenetd.desktop "$XDG_CONFIG_DIRS/autostart"
echo Installed XDG autostart desktop entry.
elif -d /etc/xdg/autostart; then
install assets/generic/xdg/org.stonenet.stonenetd.desktop /etc/xdg/autostart"
echo Installed XDG autostart desktop entry.
else
echo "Stonenet is not configured to run on system startup. You'll need to do this manually!"
fi
fi