-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
33 lines (25 loc) · 827 Bytes
/
Copy pathupdate.sh
File metadata and controls
33 lines (25 loc) · 827 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
#!/bin/bash
# Update script for runners
APP_NAME="runners"
INSTALL_PATH="/usr/local/bin/$APP_NAME"
echo "Updating $APP_NAME..."
# Step 1: Rebuild the binary
echo "Rebuilding $APP_NAME for Linux..."
GOOS=linux GOARCH=amd64 go build -o $APP_NAME main.go
if [ $? -ne 0 ]; then
echo "Build failed! Update aborted."
exit 1
fi
# Step 2: Replace the existing binary
echo "Installing new version to $INSTALL_PATH..."
sudo mv $APP_NAME $INSTALL_PATH
sudo chmod +x $INSTALL_PATH
if [ $? -eq 0 ]; then
echo "Update successful! New version is now active."
# Display help to verify installation
$APP_NAME --help | head -n 1
else
echo "Update failed. Please check your sudo permissions."
exit 1
fi
echo "If you want to apply new resource management logic to existing runners, run: $APP_NAME update --all"