-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·42 lines (32 loc) · 960 Bytes
/
install.sh
File metadata and controls
executable file
·42 lines (32 loc) · 960 Bytes
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
#!/bin/bash
APP_NAME="sourcebox"
JAR_FILE="sourcebox-fat.jar"
INSTALL_DIR="$HOME/.local/share/$APP_NAME"
SERVICE_DIR="$HOME/.config/systemd/user"
SERVICE_FILE="$SERVICE_DIR/${APP_NAME}.service"
TARGET_JAR="$INSTALL_DIR/lib/$JAR_FILE"
if [ -f "$TARGET_JAR" ]; then
echo "🔄 $APP_NAME existed,updating JAR ..."
else
echo "⬇️ installing $APP_NAME..."
mkdir -p "$INSTALL_DIR"
fi
cp -r ./* $INSTALL_DIR/
mkdir -p "$SERVICE_DIR"
echo "📄 creating systemd file..."
cat > "$SERVICE_FILE" <<EOF
[Unit]
Description=The SourceBox Web Service
After=network.target
[Service]
Type=simple
ExecStart=java -Dlogging.type=net.cofcool.sourcebox.logging.JULLogger -jar $TARGET_JAR --mode=WEB
Restart=on-failure
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reexec
systemctl --user daemon-reload
systemctl --user enable "${APP_NAME}.service"
systemctl --user restart "${APP_NAME}.service"
echo "✅ $APP_NAME installed and started"