2024-12-10 04:13:10 -08:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2024-12-10 05:08:06 -08:00
|
|
|
# Check if running as root
|
2024-12-10 04:13:10 -08:00
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
|
|
echo -e "${RED}This script must be run as root${NC}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-12-10 05:08:06 -08:00
|
|
|
# Install mode
|
|
|
|
INSTALL_DIR="/usr/local/bin"
|
2024-12-10 04:13:10 -08:00
|
|
|
REPO_DIR="/root/.nixos-utils"
|
2024-12-10 05:08:06 -08:00
|
|
|
|
|
|
|
# Clone/update repository
|
2024-12-10 04:13:10 -08:00
|
|
|
if [ -d "$REPO_DIR" ]; then
|
|
|
|
cd "$REPO_DIR"
|
|
|
|
git pull
|
|
|
|
else
|
|
|
|
git clone https://git.jeirslab.xyz/jeirmeister/NixOS-PVE-LXC.git "$REPO_DIR"
|
|
|
|
fi
|
|
|
|
|
2024-12-10 05:08:06 -08:00
|
|
|
# Install the configuration script
|
|
|
|
ln -sf "$REPO_DIR/scripts/nixos-pve-config" "${INSTALL_DIR}/nixos-pve-config"
|
|
|
|
chmod +x "${INSTALL_DIR}/nixos-pve-config"
|
2024-12-10 04:13:10 -08:00
|
|
|
|
2024-12-10 05:08:06 -08:00
|
|
|
echo "Installation complete. Run 'nixos-pve-config' to configure containers."
|