-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
50 lines (43 loc) · 1.22 KB
/
bootstrap.sh
File metadata and controls
50 lines (43 loc) · 1.22 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
#!/usr/bin/env bash
set -e
# Bootstrap script for prox_scripts
# This script will be downloaded and run directly, so it needs to be self-contained initially
REPO_URL="https://github.com/dbir0/prox_scripts"
TARGET_DIR="/opt/prox_scripts"
update_repo() {
if [ -f /etc/debian_version ]; then
echo "Updating system repos..."
apt-get update || echo "Warning: Some repositories failed to update."
else
echo "Unsupported OS. Please update your system manually."
exit 1
fi
}
check_or_install_git() {
if ! command -v git &> /dev/null; then
echo "Git is not installed. Installing git..."
if [ -f /etc/debian_version ]; then
apt-get update
apt-get install -y git
else
echo "Unsupported OS. Please install git manually."
exit 1
fi
fi
}
clone_or_update_repo() {
if [ -d "$TARGET_DIR/.git" ]; then
echo "Repository already exists. Pulling latest changes..."
git -C "$TARGET_DIR" pull --ff-only
else
echo "Cloning repository..."
git clone "$REPO_URL" "$TARGET_DIR"
fi
}
run_setup() {
bash "$TARGET_DIR/setup.sh"
}
update_repo
check_or_install_git
clone_or_update_repo
run_setup