Skip to content

Commit e31da33

Browse files
Add install.sh and ammend readme
1 parent 33c6804 commit e31da33

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ A modern web-based management interface for Proxmox VE (PVE) helper scripts. Thi
4242

4343
## 🚀 Installation
4444

45+
You can use the provided ```install.sh``` file in the root directory of this repository or follow the steps below to install manually. The install script takes care of all prerequisits.
46+
4547
### 1. Clone the Repository
4648

4749
```bash

install.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/usr/bin/env bash
2+
# ------------------------------------------------------------------------------
3+
# Installer for PVESciptslocal
4+
# Author: Canbiz
5+
# ------------------------------------------------------------------------------
6+
7+
set -euo pipefail
8+
9+
# Colors
10+
RD=$(echo -e "\033[01;31m")
11+
GN=$(echo -e "\033[1;92m")
12+
YW=$(echo -e "\033[33m")
13+
CL=$(echo -e "\033[m")
14+
15+
# Status functions
16+
msg_info() { echo -e "$YW$1$CL"; }
17+
msg_ok() { echo -e "✔️ $GN$1$CL"; }
18+
msg_err() { echo -e "$RD$1$CL"; }
19+
20+
# --- Check Proxmox VE environment ---
21+
if ! command -v pveversion >/dev/null 2>&1; then
22+
msg_err "This script must be executed on a Proxmox VE host."
23+
exit 1
24+
fi
25+
msg_ok "Proxmox VE detected: $(pveversion)"
26+
27+
# --- Check git ---
28+
if ! command -v git >/dev/null 2>&1; then
29+
msg_info "Git not found, installing..."
30+
apt-get update
31+
apt-get install -y git
32+
msg_ok "Git installed: $(git --version)"
33+
else
34+
msg_ok "Git already available: $(git --version)"
35+
fi
36+
37+
# --- Check Node.js ---
38+
if ! command -v node >/dev/null 2>&1; then
39+
msg_info "Node.js not found, installing Node.js 24.x..."
40+
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
41+
apt-get install -y nodejs
42+
msg_ok "Node.js installed: $(node -v)"
43+
else
44+
msg_ok "Node.js already available: $(node -v)"
45+
fi
46+
47+
# --- Ask for installation path ---
48+
read -rp "Installation directory [default: /opt/PVESciptslocal]: " INSTALL_DIR
49+
INSTALL_DIR=${INSTALL_DIR:-/opt/PVESciptslocal}
50+
51+
# --- Clone or update repository ---
52+
if [ ! -d "$INSTALL_DIR/.git" ]; then
53+
msg_info "Cloning repository into $INSTALL_DIR..."
54+
git clone https://github.com/michelroegl-brunner/PVESciptslocal.git "$INSTALL_DIR"
55+
msg_ok "Repository cloned."
56+
else
57+
msg_info "Directory already exists. Pulling latest changes..."
58+
git -C "$INSTALL_DIR" pull
59+
msg_ok "Repository updated."
60+
fi
61+
62+
cd "$INSTALL_DIR"
63+
64+
# --- Install dependencies ---
65+
msg_info "Installing dependencies..."
66+
npm install
67+
msg_ok "Dependencies installed."
68+
69+
# --- Environment file ---
70+
if [ ! -f .env ]; then
71+
msg_info "Creating environment file from example..."
72+
cp .env.example .env
73+
msg_ok ".env file created."
74+
else
75+
msg_ok ".env file already exists, keeping it."
76+
fi
77+
78+
# --- Build the application ---
79+
msg_info "Building application..."
80+
npm run build
81+
msg_ok "Build completed."
82+
83+
# --- Start the application ---
84+
read -rp "Do you want to start the application now? (y/N): " START_APP
85+
if [[ "$START_APP" =~ ^[Yy]$ ]]; then
86+
msg_info "Starting application..."
87+
npm start
88+
else
89+
msg_info "You can start the app anytime by running: cd $INSTALL_DIR && npm start"
90+
fi

0 commit comments

Comments
 (0)