-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·80 lines (59 loc) · 1.78 KB
/
install.sh
File metadata and controls
executable file
·80 lines (59 loc) · 1.78 KB
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
#!/bin/bash
SERVICE_NAME=com.github.peerchemist.Bukara1
SERVICE_PATH=~/.config/systemd/user
EXECUTABLE_NAME=bukara-rs
EXECUTABLE_SRC=target/release/$EXECUTABLE_NAME
EXECUTABLE_DEST=$HOME/bin/$EXECUTABLE_NAME
install() {
echo "Installing $SERVICE_NAME systemd user service..."
# Build the Rust project
echo "Building the Rust project..."
cargo build --release
# Create $HOME/bin if it doesn't exist
mkdir -p "$HOME/bin"
# Move the executable to $HOME/bin
echo "Moving $EXECUTABLE_SRC to $EXECUTABLE_DEST"
cp "$EXECUTABLE_SRC" "$EXECUTABLE_DEST"
chmod +x "$EXECUTABLE_DEST"
# Create the systemd service file
mkdir -p "$SERVICE_PATH"
cat > "$SERVICE_PATH/bukara.service" <<EOL
[Unit]
Description=Bukara Service
After=default.target
[Service]
ExecStart=$EXECUTABLE_DEST
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
EOL
echo "Reloading systemd daemon..."
systemctl --user daemon-reload
echo "Enabling bukara service..."
systemctl --user enable bukara
echo "Starting bukara service..."
systemctl --user start bukara
echo "Bukara service installed and started."
}
uninstall() {
echo "Uninstalling Bukara systemd user service..."
echo "Stopping bukara service..."
systemctl --user stop bukara
echo "Disabling bukara service..."
systemctl --user disable bukara
echo "Removing service file: bukara.service..."
rm -f "$SERVICE_PATH/bukara.service"
echo "Reloading systemd daemon..."
systemctl --user daemon-reload
echo "Removing executable from $EXECUTABLE_DEST"
rm -f "$EXECUTABLE_DEST"
echo "Bukara service uninstalled."
}
if [ "$1" == "install" ]; then
install
elif [ "$1" == "uninstall" ]; then
uninstall
else
echo "Usage: $0 [install|uninstall]"
fi