-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
54 lines (45 loc) · 1.68 KB
/
install.sh
File metadata and controls
54 lines (45 loc) · 1.68 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
#!/bin/bash
# Install dependencies
apt update && apt install -y python3 python3-pip python3-rich libguestfs-tools wget jq unzip curl git ovmf
# Installation directories
INSTALL_DIR="/opt/cloudbuilder"
DATA_DIR="/var/lib/cloudbuilder"
LOG_DIR="/var/log/cloudbuilder"
# Create directories
mkdir -p "$DATA_DIR/templates"
mkdir -p "$DATA_DIR/tmp"
mkdir -p "$LOG_DIR"
# Set permissions
chown -R root:root "$DATA_DIR" "$LOG_DIR"
chmod -R 755 "$DATA_DIR" "$LOG_DIR"
# Install cloudbuilder
if [ -d "$INSTALL_DIR" ]; then
echo "Updating existing cloudbuilder installation..."
cd "$INSTALL_DIR"
git pull
else
echo "Installing cloudbuilder..."
git clone https://github.com/iandk/cloudbuilder.git "$INSTALL_DIR"
fi
# Create symlink to make cloudbuilder executable
ln -sf "$INSTALL_DIR/cloudbuilder.py" /usr/local/bin/cloudbuilder
chmod +x "$INSTALL_DIR/cloudbuilder.py"
# Set up shell completions
echo "Setting up shell completions..."
cloudbuilder --setup-completions
# Set up automatic nightly self-update timer
echo "Setting up automatic self-update timer..."
cp "$INSTALL_DIR/cloudbuilder-update.service" /etc/systemd/system/
cp "$INSTALL_DIR/cloudbuilder-update.timer" /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now cloudbuilder-update.timer
echo ""
echo "Cloudbuilder installed successfully."
echo "Configuration file: $INSTALL_DIR/templates.json"
echo "Template directory: $DATA_DIR/templates"
echo "Log directory: $LOG_DIR"
echo ""
echo "Automatic updates: Enabled (runs nightly at 3am)"
echo " Check timer: systemctl status cloudbuilder-update.timer"
echo " Check logs: journalctl -u cloudbuilder-update"
echo " Disable: systemctl disable cloudbuilder-update.timer"