-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
51 lines (41 loc) · 1.39 KB
/
install.sh
File metadata and controls
51 lines (41 loc) · 1.39 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
#!/bin/bash
set -e
if [ "$EUID" -ne 0 ]; then
echo "This installer must be run as root."
echo "Re-running installer with sudo..."
exec sudo "$0" "$@"
fi
REPO_OWNER="Addy010"
REPO_NAME="server-orchestrator"
BRANCH="main"
INSTALL_DIR="/opt/srv-orchestrator"
TMP_DIR="$(mktemp -d)"
echo "Creating temporary directory: ${TMP_DIR}"
unzip_installed=false
if [ "$(command -v unzip)" ]; then
unzip_installed=true
printf "Command unzip : \x1b[32mFOUND\x1b[0m\n"
else
printf "Command unzip : \x1b[31mNOT FOUND\x1b[0m\n"
fi
if [[ "$unzip_installed" == false ]]; then
echo "Installing unzip..."
sudo apt install unzip
fi
echo "Fetching https://github.com/${REPO_OWNER}/${REPO_NAME}/archive/refs/heads/${BRANCH}.zip"
curl -fsSL "https://github.com/${REPO_OWNER}/${REPO_NAME}/archive/refs/heads/${BRANCH}.zip" -o "${TMP_DIR}/repo.zip"
echo "Extracting files"
unzip -oq "${TMP_DIR}/repo.zip" -d "${TMP_DIR}"
SRC_DIR="$TMP_DIR/${REPO_NAME}-${BRANCH}"
echo "Installing files"
mkdir -p "$INSTALL_DIR"
cp -a "$SRC_DIR/." "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/srv-orchestrator"
chmod +x "$INSTALL_DIR/srv-compose"
echo "Installing command line utility..."
ln -sf /opt/srv-orchestrator/srv-orchestrator /usr/local/bin/srv-orchestrator
ln -sf /opt/srv-orchestrator/srv-compose /usr/local/bin/srv-compose
echo "Cleaning up"
rm -rf "$TMP_DIR"
echo "Installation complete!"
echo "Run 'srv-orchestrator setup' to start setup"