From 8bd7dc942b195302d7c69ea25bfdbade2d4f967a Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:38:32 +0200 Subject: [PATCH 1/5] add install.sh add install.sh for simple install routine --- install.sh | 179 ++++++++++++++++++++++++++--------------------------- 1 file changed, 89 insertions(+), 90 deletions(-) diff --git a/install.sh b/install.sh index 9ed1732..0d0d024 100644 --- a/install.sh +++ b/install.sh @@ -1,90 +1,89 @@ -#!/usr/bin/env bash -# ------------------------------------------------------------------------------ -# Installer for PVESciptslocal -# Author: Canbiz -# ------------------------------------------------------------------------------ - -set -euo pipefail - -# Colors -RD=$(echo -e "\033[01;31m") -GN=$(echo -e "\033[1;92m") -YW=$(echo -e "\033[33m") -CL=$(echo -e "\033[m") - -# Status functions -msg_info() { echo -e "⏳ $YW$1$CL"; } -msg_ok() { echo -e "✔️ $GN$1$CL"; } -msg_err() { echo -e "❌ $RD$1$CL"; } - -# --- Check Proxmox VE environment --- -if ! command -v pveversion >/dev/null 2>&1; then - msg_err "This script must be executed on a Proxmox VE host." - exit 1 -fi -msg_ok "Proxmox VE detected: $(pveversion)" - -# --- Check git --- -if ! command -v git >/dev/null 2>&1; then - msg_info "Git not found, installing..." - apt-get update - apt-get install -y git - msg_ok "Git installed: $(git --version)" -else - msg_ok "Git already available: $(git --version)" -fi - -# --- Check Node.js --- -if ! command -v node >/dev/null 2>&1; then - msg_info "Node.js not found, installing Node.js 24.x..." - curl -fsSL https://deb.nodesource.com/setup_24.x | bash - - apt-get install -y nodejs - msg_ok "Node.js installed: $(node -v)" -else - msg_ok "Node.js already available: $(node -v)" -fi - -# --- Ask for installation path --- -read -rp "Installation directory [default: /opt/PVESciptslocal]: " INSTALL_DIR -INSTALL_DIR=${INSTALL_DIR:-/opt/PVESciptslocal} - -# --- Clone or update repository --- -if [ ! -d "$INSTALL_DIR/.git" ]; then - msg_info "Cloning repository into $INSTALL_DIR..." - git clone https://github.com/michelroegl-brunner/PVESciptslocal.git "$INSTALL_DIR" - msg_ok "Repository cloned." -else - msg_info "Directory already exists. Pulling latest changes..." - git -C "$INSTALL_DIR" pull - msg_ok "Repository updated." -fi - -cd "$INSTALL_DIR" - -# --- Install dependencies --- -msg_info "Installing dependencies..." -npm install -msg_ok "Dependencies installed." - -# --- Environment file --- -if [ ! -f .env ]; then - msg_info "Creating environment file from example..." - cp .env.example .env - msg_ok ".env file created." -else - msg_ok ".env file already exists, keeping it." -fi - -# --- Build the application --- -msg_info "Building application..." -npm run build -msg_ok "Build completed." - -# --- Start the application --- -read -rp "Do you want to start the application now? (y/N): " START_APP -if [[ "$START_APP" =~ ^[Yy]$ ]]; then - msg_info "Starting application..." - npm start -else - msg_info "You can start the app anytime by running: cd $INSTALL_DIR && npm start" -fi +#!/usr/bin/env bash +# ------------------------------------------------------------------------------ +# Installer for PVESciptslocal +# ------------------------------------------------------------------------------ + +set -euo pipefail + +# Colors +RD=$(echo -e "\033[01;31m") +GN=$(echo -e "\033[1;92m") +YW=$(echo -e "\033[33m") +CL=$(echo -e "\033[m") + +# Status functions +msg_info() { echo -e "⏳ $YW$1$CL"; } +msg_ok() { echo -e "✔️ $GN$1$CL"; } +msg_err() { echo -e "❌ $RD$1$CL"; } + +# --- Check Proxmox VE environment --- +if ! command -v pveversion >/dev/null 2>&1; then + msg_err "This script must be executed on a Proxmox VE host." + exit 1 +fi +msg_ok "Proxmox VE detected: $(pveversion)" + +# --- Check git --- +if ! command -v git >/dev/null 2>&1; then + msg_info "Git not found, installing..." + apt-get update + apt-get install -y git + msg_ok "Git installed: $(git --version)" +else + msg_ok "Git already available: $(git --version)" +fi + +# --- Check Node.js --- +if ! command -v node >/dev/null 2>&1; then + msg_info "Node.js not found, installing Node.js 24.x..." + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt-get install -y nodejs + msg_ok "Node.js installed: $(node -v)" +else + msg_ok "Node.js already available: $(node -v)" +fi + +# --- Ask for installation path --- +read -rp "Installation directory [default: /opt/PVESciptslocal]: " INSTALL_DIR +INSTALL_DIR=${INSTALL_DIR:-/opt/PVESciptslocal} + +# --- Clone or update repository --- +if [ ! -d "$INSTALL_DIR/.git" ]; then + msg_info "Cloning repository into $INSTALL_DIR..." + git clone https://github.com/michelroegl-brunner/PVESciptslocal.git "$INSTALL_DIR" + msg_ok "Repository cloned." +else + msg_info "Directory already exists. Pulling latest changes..." + git -C "$INSTALL_DIR" pull + msg_ok "Repository updated." +fi + +cd "$INSTALL_DIR" + +# --- Install dependencies --- +msg_info "Installing dependencies..." +npm install +msg_ok "Dependencies installed." + +# --- Environment file --- +if [ ! -f .env ]; then + msg_info "Creating environment file from example..." + cp .env.example .env + msg_ok ".env file created." +else + msg_ok ".env file already exists, keeping it." +fi + +# --- Build the application --- +msg_info "Building application..." +npm run build +msg_ok "Build completed." + +# --- Start the application --- +read -rp "Do you want to start the application now? (y/N): " START_APP +if [[ "$START_APP" =~ ^[Yy]$ ]]; then + msg_info "Starting application..." + npm start +else + msg_info "You can start the app anytime by running: cd $INSTALL_DIR && npm start" +fi From c626abf284addd7c0132ef00806fc9f636449662 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:40:22 +0200 Subject: [PATCH 2/5] Integrate systemd service for PVESciptslocal Added systemd service integration for PVESciptslocal. --- install.sh | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 0d0d024..bf375b3 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # ------------------------------------------------------------------------------ -# Installer for PVESciptslocal +# Installer for PVESciptslocal with systemd integration # ------------------------------------------------------------------------------ set -euo pipefail @@ -79,11 +79,46 @@ msg_info "Building application..." npm run build msg_ok "Build completed." -# --- Start the application --- -read -rp "Do you want to start the application now? (y/N): " START_APP -if [[ "$START_APP" =~ ^[Yy]$ ]]; then - msg_info "Starting application..." - npm start +# --- Create systemd service --- +SERVICE_NAME="pvescriptslocal" +SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service" + +msg_info "Creating systemd service at $SERVICE_FILE..." +cat > "$SERVICE_FILE" <:3000" +echo "---------------------------------------------" From de7dbbaef8ec891b3d1dde744c250093a898fb4f Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:43:50 +0200 Subject: [PATCH 3/5] Revise installation section in README.md --- README.md | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 51b323a..6a59600 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,36 @@ A modern web-based management interface for Proxmox VE (PVE) helper scripts. Thi ## 🚀 Installation -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. +You can either install automatically via the provided installer script or do a manual setup. + +### Option 1: Install via Bash (Recommended) + +Run this command directly on your Proxmox VE host: + +```bash +bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/installer.sh)" +``` + +## The script will: +- Verify that you are running on Proxmox VE +- Check and install git and Node.js 24.x if missing +- Clone the repository into /opt/PVESciptslocal (or your chosen path) +- Run npm install and build the project +- Set up .env from .env.example if missing +- Create a systemd service (pvescriptslocal.service) for easy start/stop management + +After installation, the app will be accessible at: +👉 http://:3000 + +You can manage the service with: +```bash +systemctl start pvescriptslocal +systemctl stop pvescriptslocal +systemctl status pvescriptslocal +``` + + +### Option 2: Manual Installation ### 1. Clone the Repository From df542c38b0dae678ce14be66a62f1ab688dc200e Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:45:32 +0200 Subject: [PATCH 4/5] Refactor install.sh for improved structure and clarity --- install.sh | 172 +++++++++++++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 79 deletions(-) diff --git a/install.sh b/install.sh index bf375b3..63e946a 100644 --- a/install.sh +++ b/install.sh @@ -5,86 +5,88 @@ set -euo pipefail -# Colors +# --- Core --------------------------------------------------------------------- RD=$(echo -e "\033[01;31m") GN=$(echo -e "\033[1;92m") YW=$(echo -e "\033[33m") CL=$(echo -e "\033[m") -# Status functions msg_info() { echo -e "⏳ $YW$1$CL"; } msg_ok() { echo -e "✔️ $GN$1$CL"; } msg_err() { echo -e "❌ $RD$1$CL"; } -# --- Check Proxmox VE environment --- -if ! command -v pveversion >/dev/null 2>&1; then - msg_err "This script must be executed on a Proxmox VE host." - exit 1 -fi -msg_ok "Proxmox VE detected: $(pveversion)" +# --- PVE Check ---------------------------------------------------------------- +check_pve() { + if ! command -v pveversion >/dev/null 2>&1; then + msg_err "This script must be executed on a Proxmox VE host." + exit 1 + fi + msg_ok "Proxmox VE detected: $(pveversion)" +} -# --- Check git --- -if ! command -v git >/dev/null 2>&1; then - msg_info "Git not found, installing..." +# --- Dependency Check & Install ----------------------------------------------- +check_dependencies() { + msg_info "Checking required packages (build-essential, git)..." apt-get update - apt-get install -y git - msg_ok "Git installed: $(git --version)" -else - msg_ok "Git already available: $(git --version)" -fi + apt-get install -y build-essential git + msg_ok "Dependencies installed." +} -# --- Check Node.js --- -if ! command -v node >/dev/null 2>&1; then - msg_info "Node.js not found, installing Node.js 24.x..." - curl -fsSL https://deb.nodesource.com/setup_24.x | bash - - apt-get install -y nodejs - msg_ok "Node.js installed: $(node -v)" -else - msg_ok "Node.js already available: $(node -v)" -fi +check_nodejs() { + if ! command -v node >/dev/null 2>&1; then + msg_info "Node.js not found, installing Node.js 24.x..." + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt-get install -y nodejs + msg_ok "Node.js installed: $(node -v)" + else + msg_ok "Node.js already available: $(node -v)" + fi +} -# --- Ask for installation path --- -read -rp "Installation directory [default: /opt/PVESciptslocal]: " INSTALL_DIR -INSTALL_DIR=${INSTALL_DIR:-/opt/PVESciptslocal} +# --- Repository Handling ------------------------------------------------------ +clone_or_update_repo() { + read -rp "Installation directory [default: /opt/PVESciptslocal]: " INSTALL_DIR + INSTALL_DIR=${INSTALL_DIR:-/opt/PVESciptslocal} -# --- Clone or update repository --- -if [ ! -d "$INSTALL_DIR/.git" ]; then - msg_info "Cloning repository into $INSTALL_DIR..." - git clone https://github.com/michelroegl-brunner/PVESciptslocal.git "$INSTALL_DIR" - msg_ok "Repository cloned." -else - msg_info "Directory already exists. Pulling latest changes..." - git -C "$INSTALL_DIR" pull - msg_ok "Repository updated." -fi + if [ ! -d "$INSTALL_DIR/.git" ]; then + msg_info "Cloning repository into $INSTALL_DIR..." + git clone https://github.com/michelroegl-brunner/PVESciptslocal.git "$INSTALL_DIR" + msg_ok "Repository cloned." + else + msg_info "Directory already exists. Pulling latest changes..." + git -C "$INSTALL_DIR" pull + msg_ok "Repository updated." + fi -cd "$INSTALL_DIR" + cd "$INSTALL_DIR" +} -# --- Install dependencies --- -msg_info "Installing dependencies..." -npm install -msg_ok "Dependencies installed." +# --- Application Setup -------------------------------------------------------- +setup_app() { + msg_info "Installing npm dependencies..." + npm install + msg_ok "Dependencies installed." -# --- Environment file --- -if [ ! -f .env ]; then - msg_info "Creating environment file from example..." - cp .env.example .env - msg_ok ".env file created." -else - msg_ok ".env file already exists, keeping it." -fi + if [ ! -f .env ]; then + msg_info "Creating environment file from example..." + cp .env.example .env + msg_ok ".env file created." + else + msg_ok ".env file already exists, keeping it." + fi -# --- Build the application --- -msg_info "Building application..." -npm run build -msg_ok "Build completed." + msg_info "Building application..." + npm run build + msg_ok "Build completed." +} -# --- Create systemd service --- -SERVICE_NAME="pvescriptslocal" -SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service" +# --- Systemd Service ---------------------------------------------------------- +setup_systemd_service() { + SERVICE_NAME="pvescriptslocal" + SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service" -msg_info "Creating systemd service at $SERVICE_FILE..." -cat > "$SERVICE_FILE" < "$SERVICE_FILE" <:3000" -echo "---------------------------------------------" + echo + echo "---------------------------------------------" + echo " Service installed: $SERVICE_NAME" + echo " Manage it with:" + echo " systemctl start $SERVICE_NAME" + echo " systemctl stop $SERVICE_NAME" + echo " systemctl status $SERVICE_NAME" + echo " App will be available at: http://:3000" + echo "---------------------------------------------" +} + +# --- Main --------------------------------------------------------------------- +main() { + check_pve + check_dependencies + check_nodejs + clone_or_update_repo + setup_app + setup_systemd_service +} + +main "$@" From e3f2e379f2667a6230810b632b7867a06b7204c5 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 16 Sep 2025 09:45:48 +0200 Subject: [PATCH 5/5] Fix script URL in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a59600..c04633a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ You can either install automatically via the provided installer script or do a m Run this command directly on your Proxmox VE host: ```bash -bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/installer.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/michelroegl-brunner/PVESciptslocal/main/install.sh)" ``` ## The script will: