32 lines
809 B
Bash
Executable File
32 lines
809 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Check if running as root
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo -e "${RED}This script must be run as root${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if git is installed
|
|
if ! command -v git >/dev/null 2>&1; then
|
|
echo "Git not found. Installing git..."
|
|
apt-get update && apt-get install -y git
|
|
fi
|
|
|
|
# Install mode
|
|
INSTALL_DIR="/usr/local/bin"
|
|
REPO_DIR="/root/.nixos-utils"
|
|
|
|
# Clone/update repository
|
|
if [ -d "$REPO_DIR" ]; then
|
|
cd "$REPO_DIR"
|
|
git pull
|
|
else
|
|
git clone https://git.jeirslab.xyz/jeirmeister/NixOS-PVE-Deployment-Util.git "$REPO_DIR"
|
|
fi
|
|
|
|
# Install the configuration script
|
|
ln -sf "$REPO_DIR/scripts/nixos-pve-config" "${INSTALL_DIR}/nixos-pve-config"
|
|
chmod +x "${INSTALL_DIR}/nixos-pve-config"
|
|
|
|
echo "Installation complete. Run 'nixos-pve-config' to configure containers." |