From e8f0047b2225257119dc546eca1634a6455b870b Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 11:53:04 +0100
Subject: [PATCH 01/28] First Design: CONTRIBUTING
---
.github/CONTRIBUTING.md | 14 --
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 169 ++++++++++++++++++
.github/CONTRIBUTOR_GUIDE/ct/AppName.sh | 85 +++++++++
.../install/AppName-install.sh | 86 +++++++++
4 files changed, 340 insertions(+), 14 deletions(-)
delete mode 100644 .github/CONTRIBUTING.md
create mode 100644 .github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
create mode 100644 .github/CONTRIBUTOR_GUIDE/ct/AppName.sh
create mode 100644 .github/CONTRIBUTOR_GUIDE/install/AppName-install.sh
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
deleted file mode 100644
index b000bd25..00000000
--- a/.github/CONTRIBUTING.md
+++ /dev/null
@@ -1,14 +0,0 @@
-
-Contributing to Proxmox VE Helper Scripts
-
-Everybody is invited and welcome to contribute to Proxmox VE Helper Scripts.
-
-- Pull requests submitted against [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main) are meticulously scrutinized, so please do not take it personally if the project maintainer rejects your request. By adhering to the established patterns and conventions throughout the codebase, you greatly increase the likelihood that your changes will get merged into [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main).
-
-- It is important to stress that complaining about a decision after it has been made is not productive behavior for the pull request submitter. It is crucial for all contributors to respect the decision-making process and collaborate effectively towards achieving the best possible outcome for the project.
-
-- The repository will only accept Alpine applications that make use of the Alpine Package Keeper.
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
new file mode 100644
index 00000000..b151f9dc
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -0,0 +1,169 @@
+
+Contributing to Proxmox VE Helper Scripts
+
+Everybody is invited and welcome to contribute to Proxmox VE Helper Scripts.
+
+- Pull requests submitted against [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main) are meticulously scrutinized, so please do not take it personally if the project maintainer rejects your request. By adhering to the established patterns and conventions throughout the codebase, you greatly increase the likelihood that your changes will get merged into [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main).
+
+- It is important to stress that complaining about a decision after it has been made is not productive behavior for the pull request submitter. It is crucial for all contributors to respect the decision-making process and collaborate effectively towards achieving the best possible outcome for the project.
+
+- The repository will only accept Alpine applications that make use of the Alpine Package Keeper.
+
+## Table of Contents
+- [Getting Started](#getting-started)
+- [Script Flow Overview](#script-flow-overview)
+- [Important Files and Functions](#important-files-and-functions)
+ - [`AppName.sh`](#appnamesh)
+ - [`AppName-install.sh`](#appname-installsh)
+ - [`build.func`](#buildfunc)
+ - [`install.func`](#installfunc)
+ - [`create_lxc`](#create_lxc)
+- [How to Contribute](#how-to-contribute)
+ - [Forking the Repository](#forking-the-repository)
+ - [Creating a Branch](#creating-a-branch)
+ - [Writing Clear Commit Messages](#writing-clear-commit-messages)
+ - [Submitting a Pull Request](#submitting-a-pull-request)
+- [Good Practices for Issues and Pull Requests](#good-practices-for-issues-and-pull-requests)
+- [Issue and Pull Request Templates](#issue-and-pull-request-templates)
+- [Additional Resources](#additional-resources)
+
+## Getting Started
+
+Before contributing to this project, ensure you have the following prerequisites:
+1. **A Proxmox VE server or testing environment** for verifying your changes.
+2. **Familiarity with LXC containers**, Proxmox, and **Bash scripting**.
+3. **A GitHub account** and appropriate access to the repository.
+
+## Script Flow Overview
+
+The Proxmox VE Helper Scripts follow a defined sequence when setting up an LXC container or performing other tasks. Here's an overview of the flow:
+
+## Script Flow Overview
+
+The Proxmox VE Helper Scripts follow a defined sequence when setting up an LXC container or performing other tasks. Here's an overview of the flow:
+
+1. **Main Command Execution**
+ The process begins when you execute the following command:
+ ```bash
+ bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/AppName.sh)"
+ ```
+
+2. **Calling `build.func`**
+ The **`AppName.sh`** script invokes **`build.func`**, which prepares the environment for installation and configuration.
+
+3. **Executing `install.func`**
+ After the environment is set up, **`build.func`** calls **`install.func`**, which handles the installation of necessary software and configuration.
+
+4. **Creating the LXC Container (`create_lxc`)**
+ Finally, **`install.func`** triggers **`create_lxc`** to create an LXC container with default values (disk size, CPU, RAM, etc.).
+
+5. **Container Creation Completion**
+ The LXC container is created, and the process concludes by reporting the success or failure of the container setup.
+
+## Important Files and Functions
+
+### `AppName.sh`
+
+This is the main entry script for initiating the process. It is responsible for:
+- Starting the installation by calling **`build.func`**.
+- Calling **`install.func`** after system setup.
+- Managing the flow to ensure the container is correctly created.
+
+### `AppName-install.sh`
+
+This script typically manages specific installation tasks, such as setting up software inside the container. It is invoked within **`install.func`**.
+
+### `build.func`
+
+The **`build.func`** function:
+- Prepares the system environment.
+- Installs necessary packages or tools.
+- Verifies storage availability and prepares LXC templates.
+
+### `install.func`
+
+The **`install.func`** function:
+- Handles the installation and configuration of software packages inside the container.
+- Sets up user permissions, network interfaces, and other container settings.
+
+### `create_lxc`
+
+The **`create_lxc`** function:
+- Creates the LXC container using Proxmox commands.
+- Applies default configurations like disk size, CPU, RAM, and network settings.
+- Reports on the success or failure of the creation process.
+
+## How to Contribute
+
+We welcome contributions to the project! Please follow the steps below to ensure a smooth contribution process.
+
+### Forking the Repository
+
+Start by forking the repository to your own GitHub account:
+1. Navigate to the [repository page](https://github.com/community-scripts/ProxmoxVE).
+2. Click the **Fork** button in the upper-right corner.
+
+### Creating a Branch
+
+Always create a new branch for your changes to avoid conflicts:
+
+git checkout -b feature/your-feature
+
+### Writing Clear Commit Messages
+
+Ensure your commit messages are clear and descriptive:
+- **Good example:** `Added support for custom disk sizes in create_lxc`
+- **Bad example:** `Fixed stuff`
+
+### Submitting a Pull Request
+
+After pushing your changes to your fork, create a pull request (PR):
+1. Go to the **Pull Requests** tab on GitHub.
+2. Click **New Pull Request** and select the branch with your changes.
+3. Provide a detailed description of your changes, why you made them, and what problem they solve.
+
+## Good Practices for Issues and Pull Requests
+
+To help ensure your pull request is accepted and that issues are useful, please follow these best practices:
+
+### For Pull Requests:
+- Ensure your code is **well-documented**.
+- **Test** your changes on a Proxmox environment before submitting.
+- Follow the **project’s coding style** and conventions.
+- Link to any relevant **issues** if applicable.
+
+### For Issues:
+- Always provide a **clear description** of the problem.
+- If reporting a bug, include steps to **reproduce** it.
+- If suggesting a new feature, explain its **use case**.
+
+## Issue and Pull Request Templates
+
+We’ve set up templates to make reporting issues and submitting pull requests easier. These templates will guide you in providing the required information for issues and PRs.
+
+### Issue Template
+
+The issue template will ask for the following:
+- Steps to reproduce the issue.
+- Expected behavior.
+- Actual behavior.
+- Any error logs or relevant system information.
+
+### Pull Request Template
+
+The pull request template will ask for:
+- A summary of the changes made.
+- Any relevant issues the PR addresses.
+- A description of how to test the changes.
+
+These templates are automatically populated when you create a new issue or PR.
+
+## Additional Resources
+
+- [Proxmox Documentation](https://pve.proxmox.com/pve-docs/)
+- [GitHub Documentation on Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)
+- [Open Source Guides: Starting an Open Source Project](https://opensource.guide/)
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
new file mode 100644
index 00000000..b721387a
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: [SOURCE_URL]
+
+# App Default Values
+APP="[APP_NAME]"
+TAGS="[TAGS]"
+var_cpu="[CPU]"
+var_ram="[RAM]"
+var_disk="[DISK]"
+var_os="[OS]"
+var_version="[VERSION]"
+var_unprivileged="[UNPRIVILEGED]"
+
+# App Output & Base Settings
+header_info "$APP"
+base_settings
+
+# Core
+variables
+color
+catch_errors
+
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+
+ # Check if installation is present | -f for file, -d for folder
+ if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+
+ # Crawling the new version and checking whether an update is required
+ RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
+ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
+ msg_info "Updating $APP"
+
+ # Stopping Services
+ msg_info "Stopping $APP"
+ systemctl stop [SERVICE_NAME]
+ msg_ok "Stopped $APP"
+
+ # Creating Backup
+ msg_info "Creating Backup"
+ tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
+ msg_ok "Backup Created"
+
+ # Execute Update
+ msg_info "Updating $APP to v${RELEASE}"
+ [UPDATE_COMMANDS]
+ msg_ok "Updated $APP to v${RELEASE}"
+
+ # Starting Services
+ msg_info "Starting $APP"
+ systemctl start [SERVICE_NAME]
+ sleep 2
+ msg_ok "Started $APP"
+
+ # Cleaning up
+ msg_info "Cleaning Up"
+ rm -rf [TEMP_FILES]
+ msg_ok "Cleanup Completed"
+
+ # Last Action
+ echo "${RELEASE}" >/opt/${APP}_version.txt
+ msg_ok "Update Successful"
+ else
+ msg_ok "No update required. ${APP} is already at v${RELEASE}"
+ fi
+ exit
+}
+
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
+echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
+echo -e "${INFO}${YW} Access it using the following URL:${CL}"
+echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh
new file mode 100644
index 00000000..a1d0f8a2
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT
+# Source: [SOURCE_URL]
+
+# Import Functions und Setup
+source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+
+# Installing Dependencies with the 3 core dependencies (curl;sudo;mc)
+msg_info "Installing Dependencies"
+$STD apt-get install -y \
+ curl \
+ sudo \
+ mc \
+ [PACKAGE_1] \
+ [PACKAGE_2] \
+ [PACKAGE_3]
+msg_ok "Installed Dependencies"
+
+# Template: MySQL Database
+msg_info "Setting up Database"
+DB_NAME=[DB_NAME]
+DB_USER=[DB_USER]
+DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+$STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
+$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
+$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
+{
+ echo "${APPLICATION} Credentials"
+ echo "Database User: $DB_USER"
+ echo "Database Password: $DB_PASS"
+ echo "Database Name: $DB_NAME"
+} >> ~/$APP_NAME.creds
+msg_ok "Set up Database"
+
+# Temp
+
+# Setup App
+msg_info "Setup ${APPLICATION}"
+RELEASE=$(curl -s https://api.github.com/repos/[REPO]/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
+wget -q "https://github.com/[REPO]/archive/refs/tags/${RELEASE}.zip"
+unzip -q ${RELEASE}.zip
+mv ${APPLICATION}-${RELEASE}/ /opt/${APPLICATION}
+#
+#
+#
+echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
+msg_ok "Setup ${APPLICATION}"
+
+# Creating Service (if needed)
+msg_info "Creating Service"
+cat </etc/systemd/system/${APPLICATION}.service
+[Unit]
+Description=${APPLICATION} Service
+After=network.target
+
+[Service]
+ExecStart=[START_COMMAND]
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+EOF
+systemctl enable -q --now ${APPLICATION}.service
+msg_ok "Created Service"
+
+motd_ssh
+customize
+
+# Cleanup
+msg_info "Cleaning up"
+rm -f ${RELEASE}.zip
+$STD apt-get -y autoremove
+$STD apt-get -y autoclean
+msg_ok "Cleaned"
+
+motd_ssh
+customize
From 7a7b0facc1faa68c8665f52b4353e187546d7c8c Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 13:16:25 +0100
Subject: [PATCH 02/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 41 +++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index b151f9dc..c700671d 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -167,3 +167,44 @@ These templates are automatically populated when you create a new issue or PR.
- [Proxmox Documentation](https://pve.proxmox.com/pve-docs/)
- [GitHub Documentation on Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)
- [Open Source Guides: Starting an Open Source Project](https://opensource.guide/)
+
+
+--
+
+## Creating New Scripts
+
+When creating new scripts for the ProxmoxVE Helper Scripts repository, we recommend using **Visual Studio Code** (VS Code) for a smooth development experience. Follow these steps and guidelines to ensure your contributions meet the project’s standards.
+
+### Template Usage
+
+Start by using the following scripts as templates for your new script:
+- **`AppName.sh`**
+ This is the main script that handles the high-level flow and calls the necessary functions. It serves as the entry point for the process.
+
+- **`AppName-install.sh`**
+ This script is typically used for the installation process within the container, handling the actual setup of software and services.
+
+These templates help ensure consistency across all scripts and make it easier for contributors to follow the project's structure.
+
+### Visual Studio Code Setup
+
+To ensure high code quality and to avoid common mistakes, it's recommended to use the following Visual Studio Code extensions:
+
+1. **Shell Syntax**
+ [Shell Syntax Extension](https://marketplace.visualstudio.com/items?itemName=bmalehorn.shell-syntax)
+ This extension adds syntax highlighting and IntelliSense for shell scripts, making it easier to write and read your Bash scripts.
+
+2. **ShellCheck**
+ [ShellCheck Extension](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
+ ShellCheck is a static analysis tool for shell scripts. It helps identify common errors, potential issues, and improvements in your scripts. It runs automatically as you write your script and provides useful suggestions.
+
+3. **Shell Format**
+ [Shell Format Extension](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
+ This extension automatically formats your shell scripts according to best practices, ensuring clean, readable code.
+
+### Script Modification
+
+When creating a new script, you’ll need to adjust the call in the **`AppName.sh`** script. Specifically, the URL used in the following command must point to your **fork** of the repository, not the main `community-scripts/ProxmoxVE` URL:
+
+```bash
+bash -c "$(wget -qLO - https://github.com/YOUR_FORK_URL/raw/main/ct/AppName.sh)"
From 9ea997f18b30f75be2f96d8a5cfc29e870bddb54 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 13:41:48 +0100
Subject: [PATCH 03/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 398 +++++++++++-----------
1 file changed, 203 insertions(+), 195 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index c700671d..f64ead99 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -1,210 +1,218 @@
-
-Contributing to Proxmox VE Helper Scripts
-Everybody is invited and welcome to contribute to Proxmox VE Helper Scripts.
+# Community Scripts Contribution Guide
-- Pull requests submitted against [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main) are meticulously scrutinized, so please do not take it personally if the project maintainer rejects your request. By adhering to the established patterns and conventions throughout the codebase, you greatly increase the likelihood that your changes will get merged into [**main**](https://github.com/community-scripts/ProxmoxVE/tree/main).
-
-- It is important to stress that complaining about a decision after it has been made is not productive behavior for the pull request submitter. It is crucial for all contributors to respect the decision-making process and collaborate effectively towards achieving the best possible outcome for the project.
-
-- The repository will only accept Alpine applications that make use of the Alpine Package Keeper.
-
-## Table of Contents
-- [Getting Started](#getting-started)
-- [Script Flow Overview](#script-flow-overview)
-- [Important Files and Functions](#important-files-and-functions)
- - [`AppName.sh`](#appnamesh)
- - [`AppName-install.sh`](#appname-installsh)
- - [`build.func`](#buildfunc)
- - [`install.func`](#installfunc)
- - [`create_lxc`](#create_lxc)
-- [How to Contribute](#how-to-contribute)
- - [Forking the Repository](#forking-the-repository)
- - [Creating a Branch](#creating-a-branch)
- - [Writing Clear Commit Messages](#writing-clear-commit-messages)
- - [Submitting a Pull Request](#submitting-a-pull-request)
-- [Good Practices for Issues and Pull Requests](#good-practices-for-issues-and-pull-requests)
-- [Issue and Pull Request Templates](#issue-and-pull-request-templates)
-- [Additional Resources](#additional-resources)
+## Overview
+Welcome to the community-scripts repository! This guide provides detailed instructions on how to contribute to the project, including code structure, best practices, and setup instructions for contributing to our repository.
## Getting Started
-Before contributing to this project, ensure you have the following prerequisites:
-1. **A Proxmox VE server or testing environment** for verifying your changes.
-2. **Familiarity with LXC containers**, Proxmox, and **Bash scripting**.
-3. **A GitHub account** and appropriate access to the repository.
+Before contributing, please ensure that you have the following setup:
-## Script Flow Overview
+1. **Visual Studio Code** (recommended for script development)
+2. **Necessary VS Code Extensions:**
+ - [Shell Syntax](https://marketplace.visualstudio.com/items?itemName=bmalehorn.shell-syntax)
+ - [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
+ - [Shell Format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
-The Proxmox VE Helper Scripts follow a defined sequence when setting up an LXC container or performing other tasks. Here's an overview of the flow:
+### Important Notes
+- Use `AppName.sh` and `AppName-install.sh` as templates when creating new scripts.
+- The call to `community-scripts/ProxmoxVE` should be adjusted to reflect the correct fork URL.
-## Script Flow Overview
+---
-The Proxmox VE Helper Scripts follow a defined sequence when setting up an LXC container or performing other tasks. Here's an overview of the flow:
+## Structure of Installation Scripts
-1. **Main Command Execution**
- The process begins when you execute the following command:
- ```bash
- bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/AppName.sh)"
- ```
-
-2. **Calling `build.func`**
- The **`AppName.sh`** script invokes **`build.func`**, which prepares the environment for installation and configuration.
+All installation scripts should follow this standard structure:
-3. **Executing `install.func`**
- After the environment is set up, **`build.func`** calls **`install.func`**, which handles the installation of necessary software and configuration.
+### 1. File Header
+```bash
+#!/usr/bin/env bash
-4. **Creating the LXC Container (`create_lxc`)**
- Finally, **`install.func`** triggers **`create_lxc`** to create an LXC container with default values (disk size, CPU, RAM, etc.).
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: tteck (tteckster)
+# License: MIT
+# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+```
-5. **Container Creation Completion**
- The LXC container is created, and the process concludes by reporting the success or failure of the container setup.
-
-## Important Files and Functions
-
-### `AppName.sh`
-
-This is the main entry script for initiating the process. It is responsible for:
-- Starting the installation by calling **`build.func`**.
-- Calling **`install.func`** after system setup.
-- Managing the flow to ensure the container is correctly created.
-
-### `AppName-install.sh`
-
-This script typically manages specific installation tasks, such as setting up software inside the container. It is invoked within **`install.func`**.
-
-### `build.func`
-
-The **`build.func`** function:
-- Prepares the system environment.
-- Installs necessary packages or tools.
-- Verifies storage availability and prepares LXC templates.
-
-### `install.func`
-
-The **`install.func`** function:
-- Handles the installation and configuration of software packages inside the container.
-- Sets up user permissions, network interfaces, and other container settings.
-
-### `create_lxc`
-
-The **`create_lxc`** function:
-- Creates the LXC container using Proxmox commands.
-- Applies default configurations like disk size, CPU, RAM, and network settings.
-- Reports on the success or failure of the creation process.
-
-## How to Contribute
-
-We welcome contributions to the project! Please follow the steps below to ensure a smooth contribution process.
-
-### Forking the Repository
-
-Start by forking the repository to your own GitHub account:
-1. Navigate to the [repository page](https://github.com/community-scripts/ProxmoxVE).
-2. Click the **Fork** button in the upper-right corner.
-
-### Creating a Branch
-
-Always create a new branch for your changes to avoid conflicts:
-
-git checkout -b feature/your-feature
-
-### Writing Clear Commit Messages
-
-Ensure your commit messages are clear and descriptive:
-- **Good example:** `Added support for custom disk sizes in create_lxc`
-- **Bad example:** `Fixed stuff`
-
-### Submitting a Pull Request
-
-After pushing your changes to your fork, create a pull request (PR):
-1. Go to the **Pull Requests** tab on GitHub.
-2. Click **New Pull Request** and select the branch with your changes.
-3. Provide a detailed description of your changes, why you made them, and what problem they solve.
-
-## Good Practices for Issues and Pull Requests
-
-To help ensure your pull request is accepted and that issues are useful, please follow these best practices:
-
-### For Pull Requests:
-- Ensure your code is **well-documented**.
-- **Test** your changes on a Proxmox environment before submitting.
-- Follow the **project’s coding style** and conventions.
-- Link to any relevant **issues** if applicable.
-
-### For Issues:
-- Always provide a **clear description** of the problem.
-- If reporting a bug, include steps to **reproduce** it.
-- If suggesting a new feature, explain its **use case**.
-
-## Issue and Pull Request Templates
-
-We’ve set up templates to make reporting issues and submitting pull requests easier. These templates will guide you in providing the required information for issues and PRs.
-
-### Issue Template
-
-The issue template will ask for the following:
-- Steps to reproduce the issue.
-- Expected behavior.
-- Actual behavior.
-- Any error logs or relevant system information.
-
-### Pull Request Template
-
-The pull request template will ask for:
-- A summary of the changes made.
-- Any relevant issues the PR addresses.
-- A description of how to test the changes.
-
-These templates are automatically populated when you create a new issue or PR.
-
-## Additional Resources
-
-- [Proxmox Documentation](https://pve.proxmox.com/pve-docs/)
-- [GitHub Documentation on Pull Requests](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request)
-- [Open Source Guides: Starting an Open Source Project](https://opensource.guide/)
-
-
---
-
-## Creating New Scripts
-
-When creating new scripts for the ProxmoxVE Helper Scripts repository, we recommend using **Visual Studio Code** (VS Code) for a smooth development experience. Follow these steps and guidelines to ensure your contributions meet the project’s standards.
-
-### Template Usage
-
-Start by using the following scripts as templates for your new script:
-- **`AppName.sh`**
- This is the main script that handles the high-level flow and calls the necessary functions. It serves as the entry point for the process.
-
-- **`AppName-install.sh`**
- This script is typically used for the installation process within the container, handling the actual setup of software and services.
-
-These templates help ensure consistency across all scripts and make it easier for contributors to follow the project's structure.
-
-### Visual Studio Code Setup
-
-To ensure high code quality and to avoid common mistakes, it's recommended to use the following Visual Studio Code extensions:
-
-1. **Shell Syntax**
- [Shell Syntax Extension](https://marketplace.visualstudio.com/items?itemName=bmalehorn.shell-syntax)
- This extension adds syntax highlighting and IntelliSense for shell scripts, making it easier to write and read your Bash scripts.
-
-2. **ShellCheck**
- [ShellCheck Extension](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
- ShellCheck is a static analysis tool for shell scripts. It helps identify common errors, potential issues, and improvements in your scripts. It runs automatically as you write your script and provides useful suggestions.
-
-3. **Shell Format**
- [Shell Format Extension](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
- This extension automatically formats your shell scripts according to best practices, ensuring clean, readable code.
-
-### Script Modification
-
-When creating a new script, you’ll need to adjust the call in the **`AppName.sh`** script. Specifically, the URL used in the following command must point to your **fork** of the repository, not the main `community-scripts/ProxmoxVE` URL:
+### 2. Initial Setup
+Every script should source the functions file and run these initial checks:
```bash
-bash -c "$(wget -qLO - https://github.com/YOUR_FORK_URL/raw/main/ct/AppName.sh)"
+source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+```
+
+### 3. Standard Dependencies
+Common base dependencies should be installed first:
+
+```bash
+msg_info "Installing Dependencies"
+$STD apt-get install -y curl sudo mc
+msg_ok "Installed Dependencies"
+```
+
+### 4. File Writing Conventions
+
+#### Writing Config Files
+Use heredoc (`cat </etc/systemd/system/service.service
+[Unit]
+Description=Service Description
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/path/to/executable
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+EOF
+```
+
+#### Writing Environment Files
+Use heredoc for environment files, with proper quoting:
+
+```bash
+cat </path/to/.env
+VARIABLE="value"
+PORT=3000
+DB_NAME="${DB_NAME}"
+EOF
+```
+
+### 5. Service Management
+Standard way to enable and start services:
+
+```bash
+systemctl enable -q --now service.service
+```
+
+### 6. Cleanup Section
+Every script should end with cleanup:
+
+```bash
+msg_info "Cleaning up"
+$STD apt-get -y autoremove
+$STD apt-get -y autoclean
+msg_ok "Cleaned"
+```
+
+### 7. Progress Messages
+Use standard message functions for consistent output:
+
+```bash
+msg_info "Starting task"
+$STD some_command
+msg_ok "Task completed"
+```
+
+### 8. Version Tracking
+When installing specific versions, store the version number:
+
+```bash
+echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
+```
+
+### 9. Credentials Management
+Store credentials in a consistent location:
+
+```bash
+{
+ echo "Application-Credentials"
+ echo "Username: $USERNAME"
+ echo "Password: $PASSWORD"
+} >> ~/application.creds
+```
+
+### 10. Directory Structure
+Use consistent paths for applications:
+- Application files: `/opt/application_name/`
+- Configuration files: `/etc/application_name/`
+- Data files: `/var/lib/application_name/`
+
+### 11. Error Handling
+Use the standard error handling function:
+
+```bash
+catch_errors
+```
+
+### 12. Final Setup
+Every script should end with:
+
+```bash
+motd_ssh
+customize
+```
+
+---
+
+## Best Practices
+
+1. Use `$STD` for commands that should have their output suppressed.
+2. Use consistent variable naming (uppercase for global variables).
+3. Always quote variables that might contain spaces.
+4. Use `-q` flag for quiet operation where available.
+5. Use consistent indentation (2 spaces).
+6. Include cleanup sections to remove temporary files and packages.
+7. Use descriptive message strings in msg_info/msg_ok functions.
+
+---
+
+## Building Your Own Scripts
+
+The best way to build your own scripts is to start with [our template script](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/templates/example-install.sh) and then modify it to your needs.
+
+---
+
+## Contribution Process
+
+### 1. Fork the Repository
+Fork the repository to your own GitHub account to start contributing.
+
+### 2. Clone the Forked Repository
+Clone your fork to your local machine using:
+
+```bash
+git clone https://github.com/YOUR_USERNAME/community-scripts.git
+```
+
+### 3. Create a New Branch
+Before making changes, create a new branch for your feature or fix:
+
+```bash
+git checkout -b your-feature-branch
+```
+
+### 4. Commit Your Changes
+Once you’ve made the necessary changes, commit them:
+
+```bash
+git commit -m "Your commit message"
+```
+
+### 5. Push to Your Fork
+Push the changes to your forked repository:
+
+```bash
+git push origin your-feature-branch
+```
+
+### 6. Create a Pull Request
+Open a pull request from your feature branch to the `main` branch of the original repository. Please ensure that your pull request follows the formatting and guidelines mentioned above.
+
+---
+
+## Wiki Pages
+
+- [Contributing](https://github.com/community-scripts/ProxmoxVE/wiki/Contributing)
+- [Installation Guide](https://github.com/community-scripts/ProxmoxVE/wiki/Installation-Guide)
+- [Script Templates](https://github.com/community-scripts/ProxmoxVE/wiki/Script-Templates)
From 482bd088add63f4b674fca9d733cd986755124c9 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:10:04 +0100
Subject: [PATCH 04/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 139 ++++++++++++++++++++--
1 file changed, 131 insertions(+), 8 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index f64ead99..d0b10237 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -20,23 +20,146 @@ Before contributing, please ensure that you have the following setup:
---
-## Structure of Installation Scripts
+## Structure of Installation Scripts (ct/AppName.sh)
All installation scripts should follow this standard structure:
### 1. File Header
```bash
#!/usr/bin/env bash
-
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
# Copyright (c) 2021-2024 community-scripts ORG
-# Author: tteck (tteckster)
-# License: MIT
-# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Author: [YourUserName]
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: [SOURCE_URL]
```
-### 2. Initial Setup
+- You only need to add here your username & the source_url (website of the AppName-Project or github)
+- if this an existing Script set after the current Author an "| Co-Author [YourUserName]"
+
+### 2. App Default Values
+```bash
+# App Default Values
+APP="[APP_NAME]"
+TAGS="[TAGS]"
+var_cpu="[CPU]"
+var_ram="[RAM]"
+var_disk="[DISKSIZE]"
+var_os="[OS]"
+var_version="[VERSION]"
+var_unprivileged="[UNPRIVILEGED]"
+```
+
+=> You need here to increase all values.
+An Special Value is missing in default, because its not needed in every script and need to remove before create an PR:
+=> var_verbose="yes|no" - that enable the verbose mode, and you can see all outputs of the Script.
+
+Declaration of values:
+- APP => Is the name of the application, must match the ct\AppName.sh
+- TAGS => These are tags that are displayed in Proxmox (colored dots). Do not use too many!
+- var_cpu => Number of used CPU-Cores
+- var_ram => Number of used RAM in MB
+- var_disk => Number of hard disk capacities used in GB
+- var_os => Operating system (alpine | debian | ubuntu)
+- var_version => Version of OS (3.20 | 11;12 | 20.04, 22.04, 24.04, 24.10)
+- var_unprivileged => 1 = UNPRIVILEGED LXC Container | 0 = PRIVILEGED LXC Container
+
+=> Following Values are default by build.func:
+- TAGS="community-script" (is default, not need to add this, only new TAGS)
+- var_cpu="1"
+- var_ram="1024"
+- var_disk="4"
+- var_unprivileged="1"
+- var_verbose="no"
+
+Example:
+```bash
+# App Default Values
+APP="Google"
+TAGS="searching;website"
+var_cpu="2"
+var_ram="4096"
+var_disk="10"
+var_os="debian"
+var_version="12"
+var_unprivileged="0"
+```
+=> That Create an privileged LXC with name "google" (ct\google.sh) with 2 CPU Cores, 4096 MB RAM, 10 GB HDD Space, in Debian 12.
+
+### 3. App Output & Base Settings
+```bash
+# App Output & Base Settings
+header_info "$APP"
+base_settings
+```
+
+- header_info is an function created in build.func and set the "APP" Value into an ASCII-Header.
+- base_settings are used to overwrite the variable values of 2. or to accept all other default values.
+
+### 4. Core
+```bash
+# Core
+variables
+color
+catch_errors
+```
+
+- variables is an build.func function that This function processes the input and prepares variables for further use in the script.
+- color is an build.func function that sets all icons, colors and formattings in the scripts.
+- catch_errors is an build.func function that enables error handling in the script by setting options and defining a trap for the ERR signal.
+
+### 5. Update-Script Part
+```bash
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+
+ # Update-Code
+}
+```
+
+- header_info called the ASCII-Generated AppName with every call of the function
+- check_container_storage check the available storage and give output if it to less
+- check_container_resources check the ressources (var_cpu / var_ram) if it to less and give user Output
+
+Then comes the whole update function of the Script himself.
+
+### 6. Script-End
+```bash
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
+echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
+echo -e "${INFO}${YW} Access it using the following URL:${CL}"
+echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
+```
+
+- "start" is an build.func function to start the Whiptail Dialogue for Update or Create LXC
+- "build_container" is an build.func function, this function collects user settings and integrates all the collected information.
+- "description" is an build.func function, sets the description of the LXC container
+
+
+## Structure of Installation Scripts (install/AppName-install.sh)
+
+All installation scripts should follow this standard structure:
+
+### 1. File Header
Every script should source the functions file and run these initial checks:
+```bash
+#!/usr/bin/env bash
+
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+```
+- You only need to add here your username
+- if this an existing Script set after the current Author an "| Co-Author [YourUserName]"
+
+### 2. Import Functions und Setup
```bash
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
@@ -62,9 +185,9 @@ msg_ok "Installed Dependencies"
Use heredoc (`cat </etc/systemd/system/service.service
+cat </etc/systemd/system/${APPLICATION}.service
[Unit]
-Description=Service Description
+Description=${APPLICATION} Service Description
After=network.target
[Service]
From cf7eb927ebe23d9b57980fc2b7f6f8f01c0bc87b Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:20:57 +0100
Subject: [PATCH 05/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 188 ++++++++++------------
1 file changed, 89 insertions(+), 99 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index d0b10237..8b815b2f 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -20,11 +20,12 @@ Before contributing, please ensure that you have the following setup:
---
-## Structure of Installation Scripts (ct/AppName.sh)
+# 🚀 Structure of Installation Scripts (ct/AppName.sh)
All installation scripts should follow this standard structure:
-### 1. File Header
+## 1. 📝 File Header
+
```bash
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
@@ -34,10 +35,12 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# Source: [SOURCE_URL]
```
-- You only need to add here your username & the source_url (website of the AppName-Project or github)
-- if this an existing Script set after the current Author an "| Co-Author [YourUserName]"
+> **Note**:
+> - Add your username and source URL
+> - For existing scripts, add "| Co-Author [YourUserName]" after the current author
+
+## 2. 🔧 App Default Values
-### 2. App Default Values
```bash
# App Default Values
APP="[APP_NAME]"
@@ -50,29 +53,30 @@ var_version="[VERSION]"
var_unprivileged="[UNPRIVILEGED]"
```
-=> You need here to increase all values.
-An Special Value is missing in default, because its not needed in every script and need to remove before create an PR:
-=> var_verbose="yes|no" - that enable the verbose mode, and you can see all outputs of the Script.
+### Value Declarations 📊
-Declaration of values:
-- APP => Is the name of the application, must match the ct\AppName.sh
-- TAGS => These are tags that are displayed in Proxmox (colored dots). Do not use too many!
-- var_cpu => Number of used CPU-Cores
-- var_ram => Number of used RAM in MB
-- var_disk => Number of hard disk capacities used in GB
-- var_os => Operating system (alpine | debian | ubuntu)
-- var_version => Version of OS (3.20 | 11;12 | 20.04, 22.04, 24.04, 24.10)
-- var_unprivileged => 1 = UNPRIVILEGED LXC Container | 0 = PRIVILEGED LXC Container
+| Variable | Description | Notes |
+|----------|-------------|-------|
+| `APP` | Application name | Must match ct\AppName.sh |
+| `TAGS` | Proxmox display tags | Limit the number |
+| `var_cpu` | CPU cores | Number of cores |
+| `var_ram` | RAM | In MB |
+| `var_disk` | Disk capacity | In GB |
+| `var_os` | Operating system | alpine, debian, ubuntu |
+| `var_version` | OS version | e.g., 3.20, 11, 12, 20.04 |
+| `var_unprivileged` | Container type | 1 = Unprivileged, 0 = Privileged |
-=> Following Values are default by build.func:
-- TAGS="community-script" (is default, not need to add this, only new TAGS)
-- var_cpu="1"
-- var_ram="1024"
-- var_disk="4"
-- var_unprivileged="1"
-- var_verbose="no"
+### Default Values 🔨
+
+- `TAGS="community-script"` (default)
+- `var_cpu="1"`
+- `var_ram="1024"`
+- `var_disk="4"`
+- `var_unprivileged="1"`
+- `var_verbose="no"`
+
+#### Example 🌟
-Example:
```bash
# App Default Values
APP="Google"
@@ -84,19 +88,22 @@ var_os="debian"
var_version="12"
var_unprivileged="0"
```
-=> That Create an privileged LXC with name "google" (ct\google.sh) with 2 CPU Cores, 4096 MB RAM, 10 GB HDD Space, in Debian 12.
-### 3. App Output & Base Settings
+> Creates a privileged LXC named "google" with 2 CPU cores, 4096 MB RAM, 10 GB disk, on Debian 12
+
+## 3. 📋 App Output & Base Settings
+
```bash
# App Output & Base Settings
header_info "$APP"
base_settings
```
-- header_info is an function created in build.func and set the "APP" Value into an ASCII-Header.
-- base_settings are used to overwrite the variable values of 2. or to accept all other default values.
+- `header_info`: Generates ASCII header for APP
+- `base_settings`: Allows overwriting variable values
+
+## 4. 🛠 Core Functions
-### 4. Core
```bash
# Core
variables
@@ -104,11 +111,12 @@ color
catch_errors
```
-- variables is an build.func function that This function processes the input and prepares variables for further use in the script.
-- color is an build.func function that sets all icons, colors and formattings in the scripts.
-- catch_errors is an build.func function that enables error handling in the script by setting options and defining a trap for the ERR signal.
+- `variables`: Processes input and prepares variables
+- `color`: Sets icons, colors, and formatting
+- `catch_errors`: Enables error handling
+
+## 5. 🔄 Update-Script Part
-### 5. Update-Script Part
```bash
function update_script() {
header_info
@@ -119,13 +127,12 @@ function update_script() {
}
```
-- header_info called the ASCII-Generated AppName with every call of the function
-- check_container_storage check the available storage and give output if it to less
-- check_container_resources check the ressources (var_cpu / var_ram) if it to less and give user Output
+- `header_info`: Regenerates ASCII AppName
+- `check_container_storage`: Checks available storage
+- `check_container_resources`: Validates CPU/RAM resources
-Then comes the whole update function of the Script himself.
+## 6. 🏁 Script-End
-### 6. Script-End
```bash
start
build_container
@@ -137,17 +144,15 @@ echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
```
-- "start" is an build.func function to start the Whiptail Dialogue for Update or Create LXC
-- "build_container" is an build.func function, this function collects user settings and integrates all the collected information.
-- "description" is an build.func function, sets the description of the LXC container
-
+- `start`: Launches Whiptail dialogue
+- `build_container`: Collects and integrates user settings
+- `description`: Sets LXC container description
-## Structure of Installation Scripts (install/AppName-install.sh)
+I'll convert the remaining document to a GitHub-flavored Markdown with emojis and improved formatting:
-All installation scripts should follow this standard structure:
+# 🛠 Structure of Installation Scripts (install/AppName-install.sh)
-### 1. File Header
-Every script should source the functions file and run these initial checks:
+## 1. 📄 File Header
```bash
#!/usr/bin/env bash
@@ -156,10 +161,13 @@ Every script should source the functions file and run these initial checks:
# Author: [YourUserName]
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
```
-- You only need to add here your username
-- if this an existing Script set after the current Author an "| Co-Author [YourUserName]"
-### 2. Import Functions und Setup
+> **Notes**:
+> - Add your username
+> - For existing scripts, add "| Co-Author [YourUserName]"
+
+## 2. 🔌 Import Functions and Setup
+
```bash
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
@@ -170,8 +178,7 @@ network_check
update_os
```
-### 3. Standard Dependencies
-Common base dependencies should be installed first:
+## 3. 📦 Standard Dependencies
```bash
msg_info "Installing Dependencies"
@@ -179,10 +186,9 @@ $STD apt-get install -y curl sudo mc
msg_ok "Installed Dependencies"
```
-### 4. File Writing Conventions
+## 4. 📝 File Writing Conventions
-#### Writing Config Files
-Use heredoc (`cat </etc/systemd/system/${APPLICATION}.service
@@ -200,8 +206,7 @@ WantedBy=multi-user.target
EOF
```
-#### Writing Environment Files
-Use heredoc for environment files, with proper quoting:
+### Writing Environment Files 🌍
```bash
cat </path/to/.env
@@ -211,15 +216,13 @@ DB_NAME="${DB_NAME}"
EOF
```
-### 5. Service Management
-Standard way to enable and start services:
+## 5. 🚦 Service Management
```bash
systemctl enable -q --now service.service
-```
+```
-### 6. Cleanup Section
-Every script should end with cleanup:
+## 6. 🧹 Cleanup Section
```bash
msg_info "Cleaning up"
@@ -228,8 +231,7 @@ $STD apt-get -y autoclean
msg_ok "Cleaned"
```
-### 7. Progress Messages
-Use standard message functions for consistent output:
+## 7. 📢 Progress Messages
```bash
msg_info "Starting task"
@@ -237,15 +239,13 @@ $STD some_command
msg_ok "Task completed"
```
-### 8. Version Tracking
-When installing specific versions, store the version number:
+## 8. 🏷️ Version Tracking
```bash
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
```
-### 9. Credentials Management
-Store credentials in a consistent location:
+## 9. 🔐 Credentials Management
```bash
{
@@ -255,21 +255,19 @@ Store credentials in a consistent location:
} >> ~/application.creds
```
-### 10. Directory Structure
-Use consistent paths for applications:
+## 10. 📂 Directory Structure
+
- Application files: `/opt/application_name/`
- Configuration files: `/etc/application_name/`
- Data files: `/var/lib/application_name/`
-### 11. Error Handling
-Use the standard error handling function:
+## 11. 🚨 Error Handling
```bash
catch_errors
```
-### 12. Final Setup
-Every script should end with:
+## 12. 🏁 Final Setup
```bash
motd_ssh
@@ -278,64 +276,56 @@ customize
---
-## Best Practices
+## 📋 Best Practices
-1. Use `$STD` for commands that should have their output suppressed.
-2. Use consistent variable naming (uppercase for global variables).
-3. Always quote variables that might contain spaces.
-4. Use `-q` flag for quiet operation where available.
-5. Use consistent indentation (2 spaces).
-6. Include cleanup sections to remove temporary files and packages.
-7. Use descriptive message strings in msg_info/msg_ok functions.
+1. Use `$STD` for suppressed command output
+2. Use uppercase for global variables
+3. Quote variables with potential spaces
+4. Use `-q` for quiet operations
+5. Use 2-space indentation
+6. Include cleanup sections
+7. Use descriptive message strings
---
-## Building Your Own Scripts
+## 🚀 Building Your Own Scripts
-The best way to build your own scripts is to start with [our template script](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/templates/example-install.sh) and then modify it to your needs.
+Start with the [template script](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/templates/example-install.sh)
---
-## Contribution Process
+## 🤝 Contribution Process
### 1. Fork the Repository
-Fork the repository to your own GitHub account to start contributing.
-
-### 2. Clone the Forked Repository
-Clone your fork to your local machine using:
+Fork to your GitHub account
+### 2. Clone Your Fork
```bash
git clone https://github.com/YOUR_USERNAME/community-scripts.git
```
### 3. Create a New Branch
-Before making changes, create a new branch for your feature or fix:
-
```bash
git checkout -b your-feature-branch
```
-### 4. Commit Your Changes
-Once you’ve made the necessary changes, commit them:
-
+### 4. Commit Changes
```bash
git commit -m "Your commit message"
```
### 5. Push to Your Fork
-Push the changes to your forked repository:
-
```bash
git push origin your-feature-branch
```
### 6. Create a Pull Request
-Open a pull request from your feature branch to the `main` branch of the original repository. Please ensure that your pull request follows the formatting and guidelines mentioned above.
+Open a PR from your feature branch to the main repository branch
---
-## Wiki Pages
+## 📚 Wiki Pages
- [Contributing](https://github.com/community-scripts/ProxmoxVE/wiki/Contributing)
- [Installation Guide](https://github.com/community-scripts/ProxmoxVE/wiki/Installation-Guide)
-- [Script Templates](https://github.com/community-scripts/ProxmoxVE/wiki/Script-Templates)
+- [Script Templates](https://github.com/community-scripts/ProxmoxVE/wiki/Script-Templates)
\ No newline at end of file
From bb3077a8c6835b595cf3be41ae8e2ed0117c1db9 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:24:38 +0100
Subject: [PATCH 06/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 8b815b2f..39efc6c3 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -148,7 +148,7 @@ echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
- `build_container`: Collects and integrates user settings
- `description`: Sets LXC container description
-I'll convert the remaining document to a GitHub-flavored Markdown with emojis and improved formatting:
+---
# 🛠 Structure of Installation Scripts (install/AppName-install.sh)
@@ -231,12 +231,14 @@ $STD apt-get -y autoclean
msg_ok "Cleaned"
```
+
+
## 7. 📢 Progress Messages
```bash
-msg_info "Starting task"
+msg_info "Setup ${APPLICATION}"
$STD some_command
-msg_ok "Task completed"
+msg_ok "Setup ${APPLICATION}"
```
## 8. 🏷️ Version Tracking
@@ -301,7 +303,7 @@ Fork to your GitHub account
### 2. Clone Your Fork
```bash
-git clone https://github.com/YOUR_USERNAME/community-scripts.git
+git clone https://github.com/community-scripts/ProxmoxVE
```
### 3. Create a New Branch
@@ -309,7 +311,10 @@ git clone https://github.com/YOUR_USERNAME/community-scripts.git
git checkout -b your-feature-branch
```
-### 4. Commit Changes
+### 4. Change Paths in build.func and install.func
+you need to switch "community-scripts/ProxmoxVE" to "yourUserName/ForkName"
+
+### 4. Commit Changes (without build.func and install.func!)
```bash
git commit -m "Your commit message"
```
From d2728d222d8bd1aed14d79cb19e4c53fbb273cc9 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:41:48 +0100
Subject: [PATCH 07/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 39efc6c3..0e90e772 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -301,9 +301,9 @@ Start with the [template script](https://github.com/community-scripts/ProxmoxVE/
### 1. Fork the Repository
Fork to your GitHub account
-### 2. Clone Your Fork
+### 2. Clone Your Fork on your Pc
```bash
-git clone https://github.com/community-scripts/ProxmoxVE
+git clone https://github.com/yourUserName/ForkName
```
### 3. Create a New Branch
From 70949207c15569e8281cd96d6c250fe0db9c558c Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:45:06 +0100
Subject: [PATCH 08/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 0e90e772..80a66df9 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -329,8 +329,8 @@ Open a PR from your feature branch to the main repository branch
---
-## 📚 Wiki Pages
+## 📚 Pages
-- [Contributing](https://github.com/community-scripts/ProxmoxVE/wiki/Contributing)
-- [Installation Guide](https://github.com/community-scripts/ProxmoxVE/wiki/Installation-Guide)
-- [Script Templates](https://github.com/community-scripts/ProxmoxVE/wiki/Script-Templates)
\ No newline at end of file
+- [Function-Overview](https://github.com/community-scripts/ProxmoxVE/wiki/Function_Overview)
+- [CT Template: AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh)
+- [Install Template: AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)
From 6a0f22c43067451de335f2f77addd06d6070e887 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:46:04 +0100
Subject: [PATCH 09/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 80a66df9..ab19e280 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -15,7 +15,7 @@ Before contributing, please ensure that you have the following setup:
- [Shell Format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
### Important Notes
-- Use `AppName.sh` and `AppName-install.sh` as templates when creating new scripts.
+- Use [AppName.sh]((https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh)) and [AppName-install.sh]((https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)) as templates when creating new scripts.
- The call to `community-scripts/ProxmoxVE` should be adjusted to reflect the correct fork URL.
---
From 483dc981f3dd6582c237a8f018dc388c214b6f66 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 6 Dec 2024 14:46:36 +0100
Subject: [PATCH 10/28] Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index ab19e280..12637fc9 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -15,7 +15,7 @@ Before contributing, please ensure that you have the following setup:
- [Shell Format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
### Important Notes
-- Use [AppName.sh]((https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh)) and [AppName-install.sh]((https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)) as templates when creating new scripts.
+- Use [AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh) and [AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh) as templates when creating new scripts.
- The call to `community-scripts/ProxmoxVE` should be adjusted to reflect the correct fork URL.
---
From 4bde4d7d1b3f6282186fd3409e91e86325eda97f Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
<73236783+michelroegl-brunner@users.noreply.github.com>
Date: Tue, 10 Dec 2024 14:34:00 +0100
Subject: [PATCH 11/28] Ideas for CONTRIBUTING.md (#768)
* Update CONTRIBUTING.md
* Update CONTRIBUTING.md
* Update CONTRIBUTING.md
* Update CONTRIBUTING.md
* Update CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 77 +++++++++++++++++++++--
1 file changed, 73 insertions(+), 4 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 12637fc9..507b085d 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -131,6 +131,71 @@ function update_script() {
- `check_container_storage`: Checks available storage
- `check_container_resources`: Validates CPU/RAM resources
+```bash
+# Check if installation is present | -f for file, -d for folder
+ if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+```
+
+> **Note**:
+> - First you need to check if the APP is installed in the LXC
+> - Replace ```INSTALLATION_CHECK_PATH``` with the path to the APP ```i.e. (/opt/app)```
+
+```bash
+ # Crawling the new version and checking whether an update is required
+ RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
+ if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
+
+ # Code to update the APP
+
+ else
+ msg_ok "No update required. ${APP} is already at v${RELEASE}"
+ fi
+ exit
+```
+
+> **Note**:
+> - Crawl for the newest version. Example for Github Releases:
+> - ```RELEASE=$(curl -s https://api.github.com/repos/USER/REPO/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')```
+> - Then check if updating is required.
+
+```bash
+ # Stopping Services
+ msg_info "Stopping $APP"
+ systemctl stop [SERVICE_NAME]
+ msg_ok "Stopped $APP"
+
+ # Creating Backup
+ msg_info "Creating Backup"
+ tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
+ msg_ok "Backup Created"
+
+ # Execute Update
+ msg_info "Updating $APP to v${RELEASE}"
+ [UPDATE_COMMANDS]
+ msg_ok "Updated $APP to v${RELEASE}"
+
+ # Starting Services
+ msg_info "Starting $APP"
+ systemctl start [SERVICE_NAME]
+ sleep 2
+ msg_ok "Started $APP"
+
+ # Cleaning up
+ msg_info "Cleaning Up"
+ rm -rf [TEMP_FILES]
+ msg_ok "Cleanup Completed"
+
+ # Last Action
+ echo "${RELEASE}" >/opt/${APP}_version.txt
+ msg_ok "Update Successful"
+```
+
+> **Note**:
+> - In the IF-Block you then write the code to update the APP, Start and Stop the Services and clean up any temporary files
+
## 6. 🏁 Script-End
```bash
@@ -182,7 +247,10 @@ update_os
```bash
msg_info "Installing Dependencies"
-$STD apt-get install -y curl sudo mc
+$STD apt-get install -y \
+ curl \
+ sudo \
+ mc
msg_ok "Installed Dependencies"
```
@@ -231,8 +299,6 @@ $STD apt-get -y autoclean
msg_ok "Cleaned"
```
-
-
## 7. 📢 Progress Messages
```bash
@@ -250,12 +316,15 @@ echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
## 9. 🔐 Credentials Management
```bash
+USERNAME=username
+PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
{
echo "Application-Credentials"
echo "Username: $USERNAME"
echo "Password: $PASSWORD"
} >> ~/application.creds
```
+- Use random generated Passwords if possible
## 10. 📂 Directory Structure
@@ -308,7 +377,7 @@ git clone https://github.com/yourUserName/ForkName
### 3. Create a New Branch
```bash
-git checkout -b your-feature-branch
+git switch -c your-feature-branch
```
### 4. Change Paths in build.func and install.func
From fdedd5511622cddeb5fde46ec12ba9491eb46729 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Thu, 19 Dec 2024 10:50:27 +0100
Subject: [PATCH 12/28] Add files via upload
---
.github/coding_standards.md | 507 ++++++++++++++++++++++++++++++++++++
1 file changed, 507 insertions(+)
create mode 100644 .github/coding_standards.md
diff --git a/.github/coding_standards.md b/.github/coding_standards.md
new file mode 100644
index 00000000..086ffd3c
--- /dev/null
+++ b/.github/coding_standards.md
@@ -0,0 +1,507 @@
+# Coding Standards for Proxmox VE Helper-Scripts
+
+**Welcome to the Coding Standards Guide!**
+📜 This document outlines the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.
+
+### Why Coding Standards Matter
+
+Coding standards are crucial for several reasons:
+
+1. **Consistency**: Consistent code is easier to read, understand, and maintain. It helps new team members quickly get up to speed and reduces the learning curve.
+2. **Readability**: Clear and well-structured code is easier to debug and extend. It allows developers to quickly identify and fix issues.
+3. **Maintainability**: Code that follows a standard structure is easier to refactor and update. It ensures that changes can be made with minimal risk of introducing new bugs.
+4. **Collaboration**: When everyone follows the same standards, it becomes easier to collaborate on code. It reduces friction and misunderstandings during code reviews and merges.
+
+### Scope of This Document
+
+This document covers the coding standards for the following types of files in our project:
+
+- **`APP-install.sh` Scripts**: These scripts are responsible for the installation of applications and are located in the `/install` directory.
+- **`APP.sh` Scripts**: These scripts handle the creation and updating of containers and are found in the `/ct` directory.
+- **JSON Files**: These files store structured data and are located in the `/json` directory.
+
+Each section provides detailed guidelines on various aspects of coding, including shebang usage, comments, variable naming, function naming, indentation, error handling, command substitution, quoting, script structure, and logging. Additionally, examples are provided to illustrate the application of these standards.
+
+By following the coding standards outlined in this document, we ensure that our scripts and JSON files are of high quality, making our project more robust and easier to manage. Please refer to this guide whenever you create or update scripts and JSON files to maintain a high standard of code quality across the project. 📚🔍
+
+Let's work together to keep our codebase clean, efficient, and maintainable! 💪🚀
+
+---
+
+# **APP-install.sh Scripts**
+ `APP-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/install/snipeit-install.sh` as example.
+
+## 1. **File Header**
+
+### 1.1 **Shebang**
+- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+
+```bash
+#!/usr/bin/env bash
+```
+
+### 1.2 **Comments**
+- Add clear comments for script metadata, including author, copyright, and license information.
+- Use meaningful inline comments to explain complex commands or logic.
+
+Example:
+```bash
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT
+# Source: [SOURCE_URL]
+```
+### 1.3 **Variables and Function import**
+- This sections adds the support for all needed functions and variables.
+```bash
+source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+```
+---
+
+## 2. **Variable Naming and Management**
+
+### 2.1 **Naming Conventions**
+- Use uppercase names for constants and environment variables.
+- Use lowercase names for local script variables.
+
+Example:
+```bash
+DB_NAME=snipeit_db # Environment-like variable (constant)
+DB_USER="snipeit" # Local variable
+```
+
+### 2.2 **Avoid Hardcoding Values**
+- Dynamically generate sensitive values, like passwords, using tools like `openssl`.
+
+Example:
+```bash
+DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+```
+
+---
+
+## 3. **Dependencies**
+
+### 3.1 **Install all at once**
+- Install all dependencies with a single command if possible
+
+Example:
+```bash
+$STD apt-get install -y \
+ curl \
+ composer \
+ git \
+ sudo \
+ mc \
+ nginx
+```
+
+### 3.2 **Collaps Dependencies**
+- Collaps dependencies to keep the Code readable.
+
+Example:
+Use
+```bash
+php8.2-{bcmath,common,ctype}
+```
+instead of
+```bash
+php8.2-bcmath php8.2-common php8.2-ctype
+```
+---
+## 4. **Paths to applications**
+- If possible install the App and all nessesery files in `/opt/`
+
+## 5. **Version Management**
+
+### 5.1 **Install the latest Release**
+- Always try and install the latest Release if possibly
+- Do not Hardcode any Version if not absolutly nessesery
+
+Example for a git Release:
+```bash
+RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
+```
+### 5.2 **Store the Version in a File for later Updates**
+- Write the installed Version into a file.
+- This is used for the Update function in app.sh to check if we need to update or not
+
+Example:
+```bash
+echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
+```
+
+## 6. **Input and Output Management**
+
+### 6.1 **User Feedback**
+- Use standard functions like `msg_info` and `msg_ok` to print status messages.
+- Display meaningful progress messages at key stages.
+
+Example:
+```bash
+msg_info "Installing Dependencies"
+$STD apt-get install ...
+msg_ok "Installed Dependencies"
+```
+### 6.2 **Verbosity**
+- Use the appropiate flag (**-q** in the examples) for a command to suppres its output
+Example:
+```bash
+wget -q
+unzip -q
+```
+- If a command dose not come with such a functionality use `$STD` (a custom standard redirection variable) for managing output verbosity.
+
+Example:
+```bash
+$STD apt-get install -y nginx
+```
+
+
+## 7. **String/File Manipulation**
+
+### 7.1 **File Manipulation**
+- Use `sed` to replace placeholder values in configuration files.
+
+Example:
+```bash
+sed -i -e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
+ -e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
+ -e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
+```
+
+---
+
+## 8. **Security Practices**
+
+### 8.1 **Password Generation**
+- Use secure tools (e.g., `openssl`) to generate random passwords.
+- Use only Alphanumeric Values to not introduce unknown behaviour.
+
+Example:
+```bash
+DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+```
+
+### 8.2 **File Permissions**
+- Explicitly set secure ownership and permissions for sensitive files.
+
+Example:
+```bash
+chown -R www-data: /opt/snipe-it
+chmod -R 755 /opt/snipe-it
+```
+
+---
+
+## 9. **Service Configuration**
+
+### 9.1 **Configuration Files**
+- Use `cat </etc/nginx/conf.d/snipeit.conf
+server {
+ listen 80;
+ root /opt/snipe-it/public;
+ index index.php;
+}
+EOF
+```
+### 9.2 **Credential Management**
+- Store the generated credentials in a file
+Example:
+```bash
+USERNAME=username
+PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+{
+ echo "Application-Credentials"
+ echo "Username: $USERNAME"
+ echo "Password: $PASSWORD"
+} >> ~/application.creds
+```
+### 9.3 **Enviromental Files**
+- Use `cat </path/to/.env
+VARIABLE="value"
+PORT=3000
+DB_NAME="${DB_NAME}"
+EOF
+```
+
+### 9.4 **Reload Services**
+- Enable affected services after configuration changes and start it right away.
+
+Example:
+```bash
+systemctl enable -q --now nginx
+```
+
+---
+
+## 10. **Cleanup**
+
+### 10.1 **Remove Temporary Files**
+- Remove temporary files or unnecessary downloads after use.
+
+Example:
+```bash
+rm -rf /opt/v${RELEASE}.zip
+```
+
+### 10.2 **Autoremove and Autoclean**
+- Clean up unused dependencies to reduce disk space usage.
+
+Example:
+```bash
+apt-get -y autoremove
+apt-get -y autoclean
+```
+
+---
+
+## 11. **Consistency and Style**
+
+### 11.1 **Indentation**
+- Use 2 spaces for indentation for better readability.
+- Use the Shell Formater Extention for VS-Code
+
+---
+
+## 11. **Best Practices Checklist**
+
+- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
+- [ ] Metadata (author, license) is included at the top.
+- [ ] Variables follow naming conventions.
+- [ ] Sensitive values are dynamically generated.
+- [ ] Files and services have proper permissions.
+- [ ] Script cleans up temporary files.
+
+---
+
+### Example: High-Level Script Flow
+
+1. **Dependencies Installation**
+2. **Database Setup**
+3. **Download and Configure Application**
+4. **Service Configuration**
+5. **Final Cleanup**
+
+---
+
+# **APP.sh Scripts**
+ `APP.sh` scripts found in the `/ct` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/ct/snipeit.sh` as example.
+
+
+## 1. **File Header**
+
+### 1.1 **Shebang**
+- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+
+```bash
+#!/usr/bin/env bash
+```
+### 1.2 **Import Functions**
+- Import the build.func File.
+- When developing your own Script, change the link to your own repository.
+
+> [!CAUTION]
+> Before opening a Pull Request change the link to point to the community-scripts repo.
+
+Example for development:
+```bash
+source <(curl -s https://raw.githubusercontent.com/[USER]/[REPO]/refs/heads/[BRANCH]/misc/build.func)
+```
+
+Example for final Script:
+```bash
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+```
+
+### 1.3 **Metadata**
+- Add clear comments for script metadata, including author, copyright, and license information.
+
+Example:
+```bash
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: [SOURCE_URL]
+```
+
+## 2 **Variables and Function import**
+> [!IMPORTANT]
+> You need to have all this set in Your Script, otherwise it will not work!
+
+### 2.1 **Default Values**
+- This sections sets the Default Values for the Container.
+- `APP` needs to be set to the Application name and must represent the filenames of your scripts.
+- `var_tags`: You can set Tags for the CT wich show up in the Proxmox UI. Don´t overdo it!
+Example:
+```bash
+APP="SnipeIT"
+var_tags="assat-management;foss"
+var_cpu="2"
+var_ram="2048"
+var_disk="4"
+var_os="debian"
+var_version="12"
+var_unprivileged="1"
+```
+### 2.2 App Output & Base Settings
+- `header_info "$APP` sets the ASCII header.
+- `base_settings` sets the values for container creation.
+- `variables`,`color`,`catch_error` are helper functions importet from `build.func`.
+
+
+## 3 **Update Function**
+
+### 3.1 **Function Header**
+- if applicable write a function wich updates the Application and the OS in the container.
+- Each update function starts with a standardised Header:
+```bash
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+```
+
+### 3.2 **Check APP**
+- Befor doing anything updatewise, check if the App is installed in the Container.
+
+Example:
+```bash
+if [[ ! -d /opt/snipe-it ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+```
+### 3.3 **Check Version**
+- The last step befor the update is to check if ther is a new version.
+- For this we use the `${APPLICATION}_version.txt` file created in `/opt` during the install.
+
+Example with a Github Release:
+```bash
+ RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
+ msg_info "Updating ${APP} to v${RELEASE}"
+ #DO UPDATE STUFF
+ else
+ msg_ok "No update required. ${APP} is already at v${RELEASE}."
+ fi
+ exit
+}
+```
+### 3.4 **Verbosity**
+- Use the appropiate flag (**-q** in the examples) for a command to suppres its output.
+Example:
+```bash
+wget -q
+unzip -q
+```
+- If a command dose not come with such a functionality use `&>/dev/null` for suppresinf output verbosity.
+
+Example:
+```bash
+php artisan migrate --force &>/dev/null
+php artisan config:clear &>/dev/null
+```
+
+### 3.5 **Backups**
+- Backup userdata if nessesary.
+- Move all userdata back in the Directory when the update is finnished.
+>[!WARNING]
+>This is not meant to be a permantent backup
+
+Example backup:
+```bash
+ mv /opt/snipe-it /opt/snipe-it-backup
+```
+Example config restore:
+```bash
+ cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
+ cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
+ cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
+```
+
+### 3.6 **Cleanup**
+- Do not forget to remove any temporary files/folders such as zip-files or temporary backups.
+Example:
+```bash
+ rm -rf /opt/v${RELEASE}.zip
+ rm -rf /opt/snipe-it-backup
+```
+
+### 3.7 **No update function**
+- In case you can not provide a update function use the following code to provide user feedback.
+```bash
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+ if [[ ! -d /opt/snipeit ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+ msg_error "Ther is currently no automatic update function for ${APP}."
+ exit
+}
+```
+
+## 4 **End of the Script**
+- The script ends with a few function calls and a success Message.
+- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the App.
+
+```bash
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
+echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
+echo -e "${INFO}${YW} Access it using the following URL:${CL}"
+echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
+```
+
+## 5. **Consistency and Style**
+
+### 5.1 **Indentation**
+- Use 2 spaces for indentation for better readability.
+- Use the Shell Formater Extention for VS-Code
+
+---
+
+## 5. **Best Practices Checklist**
+
+- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
+- [ ] Correct link to *build.func*
+- [ ] Metadata (author, license) is included at the top.
+- [ ] Variables follow naming conventions.
+- [ ] Update function exists.
+- [ ] Update functions checks if App is installed an for new Version.
+- [ ] Update function up temporary files.
+- [ ] Script ends with a helpfull message for the User to reach the App.
+
+---
+
+# **APP.json Files**
+ `APP.json` files found in the `/json` directory. These files are used to provide informations for the frontend. For this guide we take `/json/snipeit.json` as example.
+
+ ## 1 **Json Generator**
+ - To spare you some headache creating the json file, use the [Json-Editor](https://community-scripts.github.io/ProxmoxVE/json-editor)
+
+
+
+---
+
+ 🚀 By following these essential coding standards, you'll transform your shell scripts into powerful, rock-solid tools that not only stand the test of time but also operate with peak efficiency and reliability. 🌟 They'll be fortified with robust security measures 🔐, ensuring they stay resilient against vulnerabilities, and structured in a way that makes them effortless to understand, update, and maintain. ✨ Whether you're writing a quick utility or managing complex automation, these principles are your ticket to creating scripts that truly shine! 💡💻
+
From 2f095fca5eb764356d9a30bf6c4a7d10f2e5d5b4 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Thu, 19 Dec 2024 10:54:01 +0100
Subject: [PATCH 13/28] fix var_tags
---
.github/CONTRIBUTOR_GUIDE/ct/AppName.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
index b721387a..a5339379 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
@@ -7,7 +7,7 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# App Default Values
APP="[APP_NAME]"
-TAGS="[TAGS]"
+var_tags="[TAGS]"
var_cpu="[CPU]"
var_ram="[RAM]"
var_disk="[DISK]"
From 392318481be30ddc546fbf5eba6c571d69f938cf Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Thu, 19 Dec 2024 10:59:25 +0100
Subject: [PATCH 14/28] add comments to AppName.sh
---
.github/CONTRIBUTOR_GUIDE/ct/AppName.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
index a5339379..2b5d7074 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
@@ -7,13 +7,21 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# App Default Values
APP="[APP_NAME]"
-var_tags="[TAGS]"
+# Name of the App (e.g. Google, Adventurelog, Apache-Guacamole"
+TAGS="[TAGS]"
+# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp)
var_cpu="[CPU]"
+# Number of Cores (1-X) (e.g. 4) - default are 2
var_ram="[RAM]"
+# Amount of used RAM in MB (e.g. 2048 or 4096)
var_disk="[DISK]"
+# Amount of used Disk Space in GB (e.g. 4 or 10)
var_os="[OS]"
+# Default OS (e.g. debian, ubuntu, alpine)
var_version="[VERSION]"
+# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine)
var_unprivileged="[UNPRIVILEGED]"
+# 1 = unprivileged Container, 0 = privileged Container
# App Output & Base Settings
header_info "$APP"
From a4d39c4f19bc40edd84638a22cc4483c65fd63a0 Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 11:33:43 +0100
Subject: [PATCH 15/28] Rework Contributing to merge the tow existing Versions
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 368 ++----------------
.github/CONTRIBUTOR_GUIDE/ct/AppName.md | 228 +++++++++++
.../install/AppName-install.md | 272 +++++++++++++
.github/CONTRIBUTOR_GUIDE/json/AppName.json | 34 ++
.github/CONTRIBUTOR_GUIDE/json/AppName.md | 5 +
5 files changed, 574 insertions(+), 333 deletions(-)
create mode 100644 .github/CONTRIBUTOR_GUIDE/ct/AppName.md
create mode 100644 .github/CONTRIBUTOR_GUIDE/install/AppName-install.md
create mode 100644 .github/CONTRIBUTOR_GUIDE/json/AppName.json
create mode 100644 .github/CONTRIBUTOR_GUIDE/json/AppName.md
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 507b085d..41658309 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -1,8 +1,32 @@
# Community Scripts Contribution Guide
-## Overview
-Welcome to the community-scripts repository! This guide provides detailed instructions on how to contribute to the project, including code structure, best practices, and setup instructions for contributing to our repository.
+## **Welcome to the communty-scripts Repository!**
+📜 These documents outlines the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.
+
+### Why Coding Standards Matter
+
+Coding standards are crucial for several reasons:
+
+1. **Consistency**: Consistent code is easier to read, understand, and maintain. It helps new team members quickly get up to speed and reduces the learning curve.
+2. **Readability**: Clear and well-structured code is easier to debug and extend. It allows developers to quickly identify and fix issues.
+3. **Maintainability**: Code that follows a standard structure is easier to refactor and update. It ensures that changes can be made with minimal risk of introducing new bugs.
+4. **Collaboration**: When everyone follows the same standards, it becomes easier to collaborate on code. It reduces friction and misunderstandings during code reviews and merges.
+
+### Scope of These Documents
+
+These documentes covers the coding standards for the following types of files in our project:
+
+- **`APP-install.sh` Scripts**: These scripts are responsible for the installation of applications and are located in the `/install` directory.
+- **`APP.sh` Scripts**: These scripts handle the creation and updating of containers and are found in the `/ct` directory.
+- **JSON Files**: These files store structured data and are located in the `/json` directory.
+
+Each section provides detailed guidelines on various aspects of coding, including shebang usage, comments, variable naming, function naming, indentation, error handling, command substitution, quoting, script structure, and logging. Additionally, examples are provided to illustrate the application of these standards.
+
+By following the coding standards outlined in this document, we ensure that our scripts and JSON files are of high quality, making our project more robust and easier to manage. Please refer to this guide whenever you create or update scripts and JSON files to maintain a high standard of code quality across the project. 📚🔍
+
+Let's work together to keep our codebase clean, efficient, and maintainable! 💪🚀
+
## Getting Started
@@ -20,342 +44,17 @@ Before contributing, please ensure that you have the following setup:
---
-# 🚀 Structure of Installation Scripts (ct/AppName.sh)
+# 🚀 The Application Script (ct/AppName.sh)
-All installation scripts should follow this standard structure:
-
-## 1. 📝 File Header
-
-```bash
-#!/usr/bin/env bash
-source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
-# Copyright (c) 2021-2024 community-scripts ORG
-# Author: [YourUserName]
-# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
-# Source: [SOURCE_URL]
-```
-
-> **Note**:
-> - Add your username and source URL
-> - For existing scripts, add "| Co-Author [YourUserName]" after the current author
-
-## 2. 🔧 App Default Values
-
-```bash
-# App Default Values
-APP="[APP_NAME]"
-TAGS="[TAGS]"
-var_cpu="[CPU]"
-var_ram="[RAM]"
-var_disk="[DISKSIZE]"
-var_os="[OS]"
-var_version="[VERSION]"
-var_unprivileged="[UNPRIVILEGED]"
-```
-
-### Value Declarations 📊
-
-| Variable | Description | Notes |
-|----------|-------------|-------|
-| `APP` | Application name | Must match ct\AppName.sh |
-| `TAGS` | Proxmox display tags | Limit the number |
-| `var_cpu` | CPU cores | Number of cores |
-| `var_ram` | RAM | In MB |
-| `var_disk` | Disk capacity | In GB |
-| `var_os` | Operating system | alpine, debian, ubuntu |
-| `var_version` | OS version | e.g., 3.20, 11, 12, 20.04 |
-| `var_unprivileged` | Container type | 1 = Unprivileged, 0 = Privileged |
-
-### Default Values 🔨
-
-- `TAGS="community-script"` (default)
-- `var_cpu="1"`
-- `var_ram="1024"`
-- `var_disk="4"`
-- `var_unprivileged="1"`
-- `var_verbose="no"`
-
-#### Example 🌟
-
-```bash
-# App Default Values
-APP="Google"
-TAGS="searching;website"
-var_cpu="2"
-var_ram="4096"
-var_disk="10"
-var_os="debian"
-var_version="12"
-var_unprivileged="0"
-```
-
-> Creates a privileged LXC named "google" with 2 CPU cores, 4096 MB RAM, 10 GB disk, on Debian 12
-
-## 3. 📋 App Output & Base Settings
-
-```bash
-# App Output & Base Settings
-header_info "$APP"
-base_settings
-```
-
-- `header_info`: Generates ASCII header for APP
-- `base_settings`: Allows overwriting variable values
-
-## 4. 🛠 Core Functions
-
-```bash
-# Core
-variables
-color
-catch_errors
-```
-
-- `variables`: Processes input and prepares variables
-- `color`: Sets icons, colors, and formatting
-- `catch_errors`: Enables error handling
-
-## 5. 🔄 Update-Script Part
-
-```bash
-function update_script() {
- header_info
- check_container_storage
- check_container_resources
-
- # Update-Code
-}
-```
-
-- `header_info`: Regenerates ASCII AppName
-- `check_container_storage`: Checks available storage
-- `check_container_resources`: Validates CPU/RAM resources
-
-```bash
-# Check if installation is present | -f for file, -d for folder
- if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
- msg_error "No ${APP} Installation Found!"
- exit
- fi
-```
-
-> **Note**:
-> - First you need to check if the APP is installed in the LXC
-> - Replace ```INSTALLATION_CHECK_PATH``` with the path to the APP ```i.e. (/opt/app)```
-
-```bash
- # Crawling the new version and checking whether an update is required
- RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
- if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
-
- # Code to update the APP
-
- else
- msg_ok "No update required. ${APP} is already at v${RELEASE}"
- fi
- exit
-```
-
-> **Note**:
-> - Crawl for the newest version. Example for Github Releases:
-> - ```RELEASE=$(curl -s https://api.github.com/repos/USER/REPO/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')```
-> - Then check if updating is required.
-
-```bash
- # Stopping Services
- msg_info "Stopping $APP"
- systemctl stop [SERVICE_NAME]
- msg_ok "Stopped $APP"
-
- # Creating Backup
- msg_info "Creating Backup"
- tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
- msg_ok "Backup Created"
-
- # Execute Update
- msg_info "Updating $APP to v${RELEASE}"
- [UPDATE_COMMANDS]
- msg_ok "Updated $APP to v${RELEASE}"
-
- # Starting Services
- msg_info "Starting $APP"
- systemctl start [SERVICE_NAME]
- sleep 2
- msg_ok "Started $APP"
-
- # Cleaning up
- msg_info "Cleaning Up"
- rm -rf [TEMP_FILES]
- msg_ok "Cleanup Completed"
-
- # Last Action
- echo "${RELEASE}" >/opt/${APP}_version.txt
- msg_ok "Update Successful"
-```
-
-> **Note**:
-> - In the IF-Block you then write the code to update the APP, Start and Stop the Services and clean up any temporary files
-
-## 6. 🏁 Script-End
-
-```bash
-start
-build_container
-description
-
-msg_ok "Completed Successfully!\n"
-echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
-echo -e "${INFO}${YW} Access it using the following URL:${CL}"
-echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
-```
-
-- `start`: Launches Whiptail dialogue
-- `build_container`: Collects and integrates user settings
-- `description`: Sets LXC container description
+- You can find all Coding standards, as well as the structure for this files [here](.github/CONTRIBUTIR_GUIDE/ct/AppName.md).
+- These Scripts are responsible for Container creataion, setting the necessery varibles and handels the update of the Application.
---
-# 🛠 Structure of Installation Scripts (install/AppName-install.sh)
+# 🛠 The Installation Script (install/AppName-install.sh)
-## 1. 📄 File Header
-
-```bash
-#!/usr/bin/env bash
-
-# Copyright (c) 2021-2024 community-scripts ORG
-# Author: [YourUserName]
-# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
-```
-
-> **Notes**:
-> - Add your username
-> - For existing scripts, add "| Co-Author [YourUserName]"
-
-## 2. 🔌 Import Functions and Setup
-
-```bash
-source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
-color
-verb_ip6
-catch_errors
-setting_up_container
-network_check
-update_os
-```
-
-## 3. 📦 Standard Dependencies
-
-```bash
-msg_info "Installing Dependencies"
-$STD apt-get install -y \
- curl \
- sudo \
- mc
-msg_ok "Installed Dependencies"
-```
-
-## 4. 📝 File Writing Conventions
-
-### Writing Config Files 🔧
-
-```bash
-cat </etc/systemd/system/${APPLICATION}.service
-[Unit]
-Description=${APPLICATION} Service Description
-After=network.target
-
-[Service]
-Type=simple
-ExecStart=/path/to/executable
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
-EOF
-```
-
-### Writing Environment Files 🌍
-
-```bash
-cat </path/to/.env
-VARIABLE="value"
-PORT=3000
-DB_NAME="${DB_NAME}"
-EOF
-```
-
-## 5. 🚦 Service Management
-
-```bash
-systemctl enable -q --now service.service
-```
-
-## 6. 🧹 Cleanup Section
-
-```bash
-msg_info "Cleaning up"
-$STD apt-get -y autoremove
-$STD apt-get -y autoclean
-msg_ok "Cleaned"
-```
-
-## 7. 📢 Progress Messages
-
-```bash
-msg_info "Setup ${APPLICATION}"
-$STD some_command
-msg_ok "Setup ${APPLICATION}"
-```
-
-## 8. 🏷️ Version Tracking
-
-```bash
-echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
-```
-
-## 9. 🔐 Credentials Management
-
-```bash
-USERNAME=username
-PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
-{
- echo "Application-Credentials"
- echo "Username: $USERNAME"
- echo "Password: $PASSWORD"
-} >> ~/application.creds
-```
-- Use random generated Passwords if possible
-
-## 10. 📂 Directory Structure
-
-- Application files: `/opt/application_name/`
-- Configuration files: `/etc/application_name/`
-- Data files: `/var/lib/application_name/`
-
-## 11. 🚨 Error Handling
-
-```bash
-catch_errors
-```
-
-## 12. 🏁 Final Setup
-
-```bash
-motd_ssh
-customize
-```
-
----
-
-## 📋 Best Practices
-
-1. Use `$STD` for suppressed command output
-2. Use uppercase for global variables
-3. Quote variables with potential spaces
-4. Use `-q` for quiet operations
-5. Use 2-space indentation
-6. Include cleanup sections
-7. Use descriptive message strings
+- You can find all Coding standards, as well as the structure for this files [here](.github/CONTRIBUTIR_GUIDE/install/AppName-install.md).
+- These Scripts handel the installation of the Application.
---
@@ -403,3 +102,6 @@ Open a PR from your feature branch to the main repository branch
- [Function-Overview](https://github.com/community-scripts/ProxmoxVE/wiki/Function_Overview)
- [CT Template: AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh)
- [Install Template: AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)
+
+---
+
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
new file mode 100644
index 00000000..8b07143d
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
@@ -0,0 +1,228 @@
+# **AppName.sh Scripts**
+ `AppName.sh` scripts found in the `/ct` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/ct/snipeit.sh` as example.
+
+
+## 1. **File Header**
+
+### 1.1 **Shebang**
+- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+
+```bash
+#!/usr/bin/env bash
+```
+### 1.2 **Import Functions**
+- Import the build.func File.
+- When developing your own Script, change the link to your own repository.
+
+> [!CAUTION]
+> Before opening a Pull Request change the link to point to the community-scripts repo.
+
+Example for development:
+```bash
+source <(curl -s https://raw.githubusercontent.com/[USER]/[REPO]/refs/heads/[BRANCH]/misc/build.func)
+```
+
+Example for final Script:
+```bash
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+```
+
+### 1.3 **Metadata**
+- Add clear comments for script metadata, including author, copyright, and license information.
+
+Example:
+```bash
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: [SOURCE_URL]
+```
+
+> [!NOTE]:
+> - Add your username and source URL
+> - For existing scripts, add "| Co-Author [YourUserName]" after the current author
+
+---
+
+## 2 **Variables and Function import**
+> [!IMPORTANT]
+> You need to have all this set in Your Script, otherwise it will not work!
+
+### 2.1 **Default Values**
+- This sections sets the Default Values for the Container.
+- `APP` needs to be set to the Application name and must represent the filenames of your scripts.
+- `var_tags`: You can set Tags for the CT wich show up in the Proxmox UI. Don´t overdo it!
+
+>[!NOTE]
+>Description for all Default Values
+>| Variable | Description | Notes |
+>|----------|-------------|-------|
+>| `APP` | Application name | Must match ct\AppName.sh |
+>| `TAGS` | Proxmox display tags | Limit the number |
+>| `var_cpu` | CPU cores | Number of cores |
+>| `var_ram` | RAM | In MB |
+>| `var_disk` | Disk capacity | In GB |
+>| `var_os` | Operating system | alpine, debian, ubuntu |
+>| `var_version` | OS version | e.g., 3.20, 11, 12, 20.04 |
+>| `var_unprivileged` | Container type | 1 = Unprivileged, 0 = Privileged |
+
+Example:
+```bash
+APP="SnipeIT"
+var_tags="asset-management;foss"
+var_cpu="2"
+var_ram="2048"
+var_disk="4"
+var_os="debian"
+var_version="12"
+var_unprivileged="1"
+```
+
+## 2.2 **📋 App Output & Base Settings**
+
+```bash
+# App Output & Base Settings
+header_info "$APP"
+base_settings
+```
+
+- `header_info`: Generates ASCII header for APP
+- `base_settings`: Allows overwriting variable values
+
+## 2.3 **🛠 Core Functions**
+
+```bash
+# Core
+variables
+color
+catch_errors
+```
+
+- `variables`: Processes input and prepares variables
+- `color`: Sets icons, colors, and formatting
+- `catch_errors`: Enables error handling
+
+---
+
+## 3 **Update Function**
+
+### 3.1 **Function Header**
+- if applicable write a function wich updates the Application and the OS in the container.
+- Each update function starts with a standardised Header:
+```bash
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+```
+
+### 3.2 **Check APP**
+- Befor doing anything updatewise, check if the App is installed in the Container.
+
+Example:
+```bash
+if [[ ! -d /opt/snipe-it ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+```
+### 3.3 **Check Version**
+- The last step befor the update is to check if ther is a new version.
+- For this we use the `${APPLICATION}_version.txt` file created in `/opt` during the install.
+
+Example with a Github Release:
+```bash
+ RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
+ msg_info "Updating ${APP} to v${RELEASE}"
+ #DO UPDATE STUFF
+ else
+ msg_ok "No update required. ${APP} is already at v${RELEASE}."
+ fi
+ exit
+}
+```
+### 3.4 **Verbosity**
+- Use the appropiate flag (**-q** in the examples) for a command to suppres its output.
+Example:
+```bash
+wget -q
+unzip -q
+```
+- If a command dose not come with such a functionality use `&>/dev/null` for suppresinf output verbosity.
+
+Example:
+```bash
+php artisan migrate --force &>/dev/null
+php artisan config:clear &>/dev/null
+```
+
+### 3.5 **Backups**
+- Backup userdata if nessesary.
+- Move all userdata back in the Directory when the update is finnished.
+>[!WARNING]
+>This is not meant to be a permantent backup
+
+Example backup:
+```bash
+ mv /opt/snipe-it /opt/snipe-it-backup
+```
+Example config restore:
+```bash
+ cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
+ cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
+ cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
+```
+
+### 3.6 **Cleanup**
+- Do not forget to remove any temporary files/folders such as zip-files or temporary backups.
+Example:
+```bash
+ rm -rf /opt/v${RELEASE}.zip
+ rm -rf /opt/snipe-it-backup
+```
+
+### 3.7 **No update function**
+- In case you can not provide a update function use the following code to provide user feedback.
+```bash
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+ if [[ ! -d /opt/snipeit ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+ msg_error "Ther is currently no automatic update function for ${APP}."
+ exit
+}
+```
+
+## 4 **End of the Script**
+- `start`: Launches Whiptail dialogue
+- `build_container`: Collects and integrates user settings
+- `description`: Sets LXC container description
+- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the App.
+
+```bash
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
+echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
+echo -e "${INFO}${YW} Access it using the following URL:${CL}"
+echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
+```
+---
+## 5. **Best Practices Checklist**
+
+- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
+- [ ] Correct link to *build.func*
+- [ ] Metadata (author, license) is included at the top.
+- [ ] Variables follow naming conventions.
+- [ ] Update function exists.
+- [ ] Update functions checks if App is installed an for new Version.
+- [ ] Update function up temporary files.
+- [ ] Script ends with a helpfull message for the User to reach the App.
+
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
new file mode 100644
index 00000000..548fb9c0
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
@@ -0,0 +1,272 @@
+
+# **AppName-install.sh Scripts**
+ `AppName-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/install/snipeit-install.sh` as example.
+
+## 1. **File Header**
+
+### 1.1 **Shebang**
+- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+
+```bash
+#!/usr/bin/env bash
+```
+
+### 1.2 **Comments**
+- Add clear comments for script metadata, including author, copyright, and license information.
+- Use meaningful inline comments to explain complex commands or logic.
+
+Example:
+```bash
+# Copyright (c) 2021-2024 community-scripts ORG
+# Author: [YourUserName]
+# License: MIT
+# Source: [SOURCE_URL]
+```
+> [!NOTE]:
+> - Add your username
+> - For existing scripts, add "| Co-Author [YourUserName]"
+
+### 1.3 **Variables and Function import**
+- This sections adds the support for all needed functions and variables.
+```bash
+source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+```
+---
+
+## 2. **Variable Naming and Management**
+
+### 2.1 **Naming Conventions**
+- Use uppercase names for constants and environment variables.
+- Use lowercase names for local script variables.
+
+Example:
+```bash
+DB_NAME=snipeit_db # Environment-like variable (constant)
+db_user="snipeit" # Local variable
+```
+
+### 2.2 **Avoid Hardcoding Values**
+- Dynamically generate sensitive values, like passwords, using tools like `openssl`.
+
+Example:
+```bash
+DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+```
+
+---
+
+## 3. **Dependencies**
+
+### 3.1 **Install all at once**
+- Install all dependencies with a single command if possible
+
+Example:
+```bash
+$STD apt-get install -y \
+ curl \
+ composer \
+ git \
+ sudo \
+ mc \
+ nginx
+```
+
+### 3.2 **Collaps Dependencies**
+- Collaps dependencies to keep the Code readable.
+
+Example:
+Use
+```bash
+php8.2-{bcmath,common,ctype}
+```
+instead of
+```bash
+php8.2-bcmath php8.2-common php8.2-ctype
+```
+---
+## 4. **Paths to applications**
+- If possible install the App and all nessesery files in `/opt/`
+
+## 5. **Version Management**
+
+### 5.1 **Install the latest Release**
+- Always try and install the latest Release if possibly
+- Do not Hardcode any Version if not absolutly nessesery
+
+Example for a git Release:
+```bash
+RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
+```
+### 5.2 **Store the Version in a File for later Updates**
+- Write the installed Version into a file.
+- This is used for the Update function in app.sh to check if we need to update or not
+
+Example:
+```bash
+echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
+```
+
+## 6. **Input and Output Management**
+
+### 6.1 **User Feedback**
+- Use standard functions like `msg_info` and `msg_ok` to print status messages.
+- Display meaningful progress messages at key stages.
+
+Example:
+```bash
+msg_info "Installing Dependencies"
+$STD apt-get install ...
+msg_ok "Installed Dependencies"
+```
+### 6.2 **Verbosity**
+- Use the appropiate flag (**-q** in the examples) for a command to suppres its output
+Example:
+```bash
+wget -q
+unzip -q
+```
+- If a command dose not come with such a functionality use `$STD` (a custom standard redirection variable) for managing output verbosity.
+
+Example:
+```bash
+$STD apt-get install -y nginx
+```
+
+
+## 7. **String/File Manipulation**
+
+### 7.1 **File Manipulation**
+- Use `sed` to replace placeholder values in configuration files.
+
+Example:
+```bash
+sed -i -e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
+ -e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
+ -e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
+```
+
+---
+
+## 8. **Security Practices**
+
+### 8.1 **Password Generation**
+- Use secure tools (e.g., `openssl`) to generate random passwords.
+- Use only Alphanumeric Values to not introduce unknown behaviour.
+
+Example:
+```bash
+DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+```
+
+### 8.2 **File Permissions**
+- Explicitly set secure ownership and permissions for sensitive files.
+
+Example:
+```bash
+chown -R www-data: /opt/snipe-it
+chmod -R 755 /opt/snipe-it
+```
+
+---
+
+## 9. **Service Configuration**
+
+### 9.1 **Configuration Files**
+- Use `cat </etc/nginx/conf.d/snipeit.conf
+server {
+ listen 80;
+ root /opt/snipe-it/public;
+ index index.php;
+}
+EOF
+```
+### 9.2 **Credential Management**
+- Store the generated credentials in a file
+Example:
+```bash
+USERNAME=username
+PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
+{
+ echo "Application-Credentials"
+ echo "Username: $USERNAME"
+ echo "Password: $PASSWORD"
+} >> ~/application.creds
+```
+### 9.3 **Enviromental Files**
+- Use `cat </path/to/.env
+VARIABLE="value"
+PORT=3000
+DB_NAME="${DB_NAME}"
+EOF
+```
+
+### 9.4 **Reload Services**
+- Enable affected services after configuration changes and start it right away.
+
+Example:
+```bash
+systemctl enable -q --now nginx
+```
+
+---
+
+## 10. **Cleanup**
+
+### 10.1 **Remove Temporary Files**
+- Remove temporary files or unnecessary downloads after use.
+
+Example:
+```bash
+rm -rf /opt/v${RELEASE}.zip
+```
+
+### 10.2 **Autoremove and Autoclean**
+- Clean up unused dependencies to reduce disk space usage.
+
+Example:
+```bash
+apt-get -y autoremove
+apt-get -y autoclean
+```
+
+---
+
+## 11. **Consistency and Style**
+
+### 11.1 **Indentation**
+- Use 2 spaces for indentation for better readability.
+- Use the Shell Formater Extention for VS-Code
+
+---
+
+## 11. **Best Practices Checklist**
+
+- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
+- [ ] Metadata (author, license) is included at the top.
+- [ ] Variables follow naming conventions.
+- [ ] Sensitive values are dynamically generated.
+- [ ] Files and services have proper permissions.
+- [ ] Script cleans up temporary files.
+
+---
+
+### Example: High-Level Script Flow
+
+1. **Dependencies Installation**
+2. **Database Setup**
+3. **Download and Configure Application**
+4. **Service Configuration**
+5. **Final Cleanup**
diff --git a/.github/CONTRIBUTOR_GUIDE/json/AppName.json b/.github/CONTRIBUTOR_GUIDE/json/AppName.json
new file mode 100644
index 00000000..622f370a
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/json/AppName.json
@@ -0,0 +1,34 @@
+{
+ "name": "AppName",
+ "slug": "appname",
+ "categories": [
+ 0
+ ],
+ "date_created": "DATE CREATED",
+ "type": "ct",
+ "updateable": true,
+ "privileged": false,
+ "interface_port": DEFAULT-PORT,
+ "documentation": null,
+ "website": "LINK TO WEBSITE",
+ "logo": "LINK TO LOGO",
+ "description": "Deescription of the app",
+ "install_methods": [
+ {
+ "type": "default",
+ "script": "ct/AppName.sh",
+ "resources": {
+ "cpu": 2,
+ "ram": 2048,
+ "hdd": 4,
+ "os": "debian",
+ "version": "12"
+ }
+ }
+ ],
+ "default_credentials": {
+ "username": null,
+ "password": null
+ },
+ "notes": []
+}
\ No newline at end of file
diff --git a/.github/CONTRIBUTOR_GUIDE/json/AppName.md b/.github/CONTRIBUTOR_GUIDE/json/AppName.md
new file mode 100644
index 00000000..59d38aa3
--- /dev/null
+++ b/.github/CONTRIBUTOR_GUIDE/json/AppName.md
@@ -0,0 +1,5 @@
+# **AppName.json Files**
+ `AppName.json` files found in the `/json` directory. These files are used to provide informations for the frontend. For this guide we take `/json/snipeit.json` as example.
+
+ ## 1 **Json Generator**
+ - To spare you some headache creating the json file, use the [Json-Editor](https://community-scripts.github.io/ProxmoxVE/json-editor)
\ No newline at end of file
From 2ae620340e142881fbab6117fca5323add1b4bbb Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 11:35:52 +0100
Subject: [PATCH 16/28] Remove coding_standards.md
---
.github/coding_standards.md | 507 ------------------------------------
1 file changed, 507 deletions(-)
delete mode 100644 .github/coding_standards.md
diff --git a/.github/coding_standards.md b/.github/coding_standards.md
deleted file mode 100644
index 086ffd3c..00000000
--- a/.github/coding_standards.md
+++ /dev/null
@@ -1,507 +0,0 @@
-# Coding Standards for Proxmox VE Helper-Scripts
-
-**Welcome to the Coding Standards Guide!**
-📜 This document outlines the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.
-
-### Why Coding Standards Matter
-
-Coding standards are crucial for several reasons:
-
-1. **Consistency**: Consistent code is easier to read, understand, and maintain. It helps new team members quickly get up to speed and reduces the learning curve.
-2. **Readability**: Clear and well-structured code is easier to debug and extend. It allows developers to quickly identify and fix issues.
-3. **Maintainability**: Code that follows a standard structure is easier to refactor and update. It ensures that changes can be made with minimal risk of introducing new bugs.
-4. **Collaboration**: When everyone follows the same standards, it becomes easier to collaborate on code. It reduces friction and misunderstandings during code reviews and merges.
-
-### Scope of This Document
-
-This document covers the coding standards for the following types of files in our project:
-
-- **`APP-install.sh` Scripts**: These scripts are responsible for the installation of applications and are located in the `/install` directory.
-- **`APP.sh` Scripts**: These scripts handle the creation and updating of containers and are found in the `/ct` directory.
-- **JSON Files**: These files store structured data and are located in the `/json` directory.
-
-Each section provides detailed guidelines on various aspects of coding, including shebang usage, comments, variable naming, function naming, indentation, error handling, command substitution, quoting, script structure, and logging. Additionally, examples are provided to illustrate the application of these standards.
-
-By following the coding standards outlined in this document, we ensure that our scripts and JSON files are of high quality, making our project more robust and easier to manage. Please refer to this guide whenever you create or update scripts and JSON files to maintain a high standard of code quality across the project. 📚🔍
-
-Let's work together to keep our codebase clean, efficient, and maintainable! 💪🚀
-
----
-
-# **APP-install.sh Scripts**
- `APP-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/install/snipeit-install.sh` as example.
-
-## 1. **File Header**
-
-### 1.1 **Shebang**
-- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
-
-```bash
-#!/usr/bin/env bash
-```
-
-### 1.2 **Comments**
-- Add clear comments for script metadata, including author, copyright, and license information.
-- Use meaningful inline comments to explain complex commands or logic.
-
-Example:
-```bash
-# Copyright (c) 2021-2024 community-scripts ORG
-# Author: [YourUserName]
-# License: MIT
-# Source: [SOURCE_URL]
-```
-### 1.3 **Variables and Function import**
-- This sections adds the support for all needed functions and variables.
-```bash
-source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
-color
-verb_ip6
-catch_errors
-setting_up_container
-network_check
-update_os
-```
----
-
-## 2. **Variable Naming and Management**
-
-### 2.1 **Naming Conventions**
-- Use uppercase names for constants and environment variables.
-- Use lowercase names for local script variables.
-
-Example:
-```bash
-DB_NAME=snipeit_db # Environment-like variable (constant)
-DB_USER="snipeit" # Local variable
-```
-
-### 2.2 **Avoid Hardcoding Values**
-- Dynamically generate sensitive values, like passwords, using tools like `openssl`.
-
-Example:
-```bash
-DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
-```
-
----
-
-## 3. **Dependencies**
-
-### 3.1 **Install all at once**
-- Install all dependencies with a single command if possible
-
-Example:
-```bash
-$STD apt-get install -y \
- curl \
- composer \
- git \
- sudo \
- mc \
- nginx
-```
-
-### 3.2 **Collaps Dependencies**
-- Collaps dependencies to keep the Code readable.
-
-Example:
-Use
-```bash
-php8.2-{bcmath,common,ctype}
-```
-instead of
-```bash
-php8.2-bcmath php8.2-common php8.2-ctype
-```
----
-## 4. **Paths to applications**
-- If possible install the App and all nessesery files in `/opt/`
-
-## 5. **Version Management**
-
-### 5.1 **Install the latest Release**
-- Always try and install the latest Release if possibly
-- Do not Hardcode any Version if not absolutly nessesery
-
-Example for a git Release:
-```bash
-RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
-wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
-```
-### 5.2 **Store the Version in a File for later Updates**
-- Write the installed Version into a file.
-- This is used for the Update function in app.sh to check if we need to update or not
-
-Example:
-```bash
-echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
-```
-
-## 6. **Input and Output Management**
-
-### 6.1 **User Feedback**
-- Use standard functions like `msg_info` and `msg_ok` to print status messages.
-- Display meaningful progress messages at key stages.
-
-Example:
-```bash
-msg_info "Installing Dependencies"
-$STD apt-get install ...
-msg_ok "Installed Dependencies"
-```
-### 6.2 **Verbosity**
-- Use the appropiate flag (**-q** in the examples) for a command to suppres its output
-Example:
-```bash
-wget -q
-unzip -q
-```
-- If a command dose not come with such a functionality use `$STD` (a custom standard redirection variable) for managing output verbosity.
-
-Example:
-```bash
-$STD apt-get install -y nginx
-```
-
-
-## 7. **String/File Manipulation**
-
-### 7.1 **File Manipulation**
-- Use `sed` to replace placeholder values in configuration files.
-
-Example:
-```bash
-sed -i -e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
- -e "s|^DB_USERNAME=.*|DB_USERNAME=$DB_USER|" \
- -e "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASS|" .env
-```
-
----
-
-## 8. **Security Practices**
-
-### 8.1 **Password Generation**
-- Use secure tools (e.g., `openssl`) to generate random passwords.
-- Use only Alphanumeric Values to not introduce unknown behaviour.
-
-Example:
-```bash
-DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
-```
-
-### 8.2 **File Permissions**
-- Explicitly set secure ownership and permissions for sensitive files.
-
-Example:
-```bash
-chown -R www-data: /opt/snipe-it
-chmod -R 755 /opt/snipe-it
-```
-
----
-
-## 9. **Service Configuration**
-
-### 9.1 **Configuration Files**
-- Use `cat </etc/nginx/conf.d/snipeit.conf
-server {
- listen 80;
- root /opt/snipe-it/public;
- index index.php;
-}
-EOF
-```
-### 9.2 **Credential Management**
-- Store the generated credentials in a file
-Example:
-```bash
-USERNAME=username
-PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
-{
- echo "Application-Credentials"
- echo "Username: $USERNAME"
- echo "Password: $PASSWORD"
-} >> ~/application.creds
-```
-### 9.3 **Enviromental Files**
-- Use `cat </path/to/.env
-VARIABLE="value"
-PORT=3000
-DB_NAME="${DB_NAME}"
-EOF
-```
-
-### 9.4 **Reload Services**
-- Enable affected services after configuration changes and start it right away.
-
-Example:
-```bash
-systemctl enable -q --now nginx
-```
-
----
-
-## 10. **Cleanup**
-
-### 10.1 **Remove Temporary Files**
-- Remove temporary files or unnecessary downloads after use.
-
-Example:
-```bash
-rm -rf /opt/v${RELEASE}.zip
-```
-
-### 10.2 **Autoremove and Autoclean**
-- Clean up unused dependencies to reduce disk space usage.
-
-Example:
-```bash
-apt-get -y autoremove
-apt-get -y autoclean
-```
-
----
-
-## 11. **Consistency and Style**
-
-### 11.1 **Indentation**
-- Use 2 spaces for indentation for better readability.
-- Use the Shell Formater Extention for VS-Code
-
----
-
-## 11. **Best Practices Checklist**
-
-- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
-- [ ] Metadata (author, license) is included at the top.
-- [ ] Variables follow naming conventions.
-- [ ] Sensitive values are dynamically generated.
-- [ ] Files and services have proper permissions.
-- [ ] Script cleans up temporary files.
-
----
-
-### Example: High-Level Script Flow
-
-1. **Dependencies Installation**
-2. **Database Setup**
-3. **Download and Configure Application**
-4. **Service Configuration**
-5. **Final Cleanup**
-
----
-
-# **APP.sh Scripts**
- `APP.sh` scripts found in the `/ct` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/ct/snipeit.sh` as example.
-
-
-## 1. **File Header**
-
-### 1.1 **Shebang**
-- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
-
-```bash
-#!/usr/bin/env bash
-```
-### 1.2 **Import Functions**
-- Import the build.func File.
-- When developing your own Script, change the link to your own repository.
-
-> [!CAUTION]
-> Before opening a Pull Request change the link to point to the community-scripts repo.
-
-Example for development:
-```bash
-source <(curl -s https://raw.githubusercontent.com/[USER]/[REPO]/refs/heads/[BRANCH]/misc/build.func)
-```
-
-Example for final Script:
-```bash
-source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
-```
-
-### 1.3 **Metadata**
-- Add clear comments for script metadata, including author, copyright, and license information.
-
-Example:
-```bash
-# Copyright (c) 2021-2024 community-scripts ORG
-# Author: [YourUserName]
-# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
-# Source: [SOURCE_URL]
-```
-
-## 2 **Variables and Function import**
-> [!IMPORTANT]
-> You need to have all this set in Your Script, otherwise it will not work!
-
-### 2.1 **Default Values**
-- This sections sets the Default Values for the Container.
-- `APP` needs to be set to the Application name and must represent the filenames of your scripts.
-- `var_tags`: You can set Tags for the CT wich show up in the Proxmox UI. Don´t overdo it!
-Example:
-```bash
-APP="SnipeIT"
-var_tags="assat-management;foss"
-var_cpu="2"
-var_ram="2048"
-var_disk="4"
-var_os="debian"
-var_version="12"
-var_unprivileged="1"
-```
-### 2.2 App Output & Base Settings
-- `header_info "$APP` sets the ASCII header.
-- `base_settings` sets the values for container creation.
-- `variables`,`color`,`catch_error` are helper functions importet from `build.func`.
-
-
-## 3 **Update Function**
-
-### 3.1 **Function Header**
-- if applicable write a function wich updates the Application and the OS in the container.
-- Each update function starts with a standardised Header:
-```bash
-function update_script() {
- header_info
- check_container_storage
- check_container_resources
-```
-
-### 3.2 **Check APP**
-- Befor doing anything updatewise, check if the App is installed in the Container.
-
-Example:
-```bash
-if [[ ! -d /opt/snipe-it ]]; then
- msg_error "No ${APP} Installation Found!"
- exit
- fi
-```
-### 3.3 **Check Version**
-- The last step befor the update is to check if ther is a new version.
-- For this we use the `${APPLICATION}_version.txt` file created in `/opt` during the install.
-
-Example with a Github Release:
-```bash
- RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
- if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
- msg_info "Updating ${APP} to v${RELEASE}"
- #DO UPDATE STUFF
- else
- msg_ok "No update required. ${APP} is already at v${RELEASE}."
- fi
- exit
-}
-```
-### 3.4 **Verbosity**
-- Use the appropiate flag (**-q** in the examples) for a command to suppres its output.
-Example:
-```bash
-wget -q
-unzip -q
-```
-- If a command dose not come with such a functionality use `&>/dev/null` for suppresinf output verbosity.
-
-Example:
-```bash
-php artisan migrate --force &>/dev/null
-php artisan config:clear &>/dev/null
-```
-
-### 3.5 **Backups**
-- Backup userdata if nessesary.
-- Move all userdata back in the Directory when the update is finnished.
->[!WARNING]
->This is not meant to be a permantent backup
-
-Example backup:
-```bash
- mv /opt/snipe-it /opt/snipe-it-backup
-```
-Example config restore:
-```bash
- cp /opt/snipe-it-backup/.env /opt/snipe-it/.env
- cp -r /opt/snipe-it-backup/public/uploads/ /opt/snipe-it/public/uploads/
- cp -r /opt/snipe-it-backup/storage/private_uploads /opt/snipe-it/storage/private_uploads
-```
-
-### 3.6 **Cleanup**
-- Do not forget to remove any temporary files/folders such as zip-files or temporary backups.
-Example:
-```bash
- rm -rf /opt/v${RELEASE}.zip
- rm -rf /opt/snipe-it-backup
-```
-
-### 3.7 **No update function**
-- In case you can not provide a update function use the following code to provide user feedback.
-```bash
-function update_script() {
- header_info
- check_container_storage
- check_container_resources
- if [[ ! -d /opt/snipeit ]]; then
- msg_error "No ${APP} Installation Found!"
- exit
- fi
- msg_error "Ther is currently no automatic update function for ${APP}."
- exit
-}
-```
-
-## 4 **End of the Script**
-- The script ends with a few function calls and a success Message.
-- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the App.
-
-```bash
-start
-build_container
-description
-
-msg_ok "Completed Successfully!\n"
-echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
-echo -e "${INFO}${YW} Access it using the following URL:${CL}"
-echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
-```
-
-## 5. **Consistency and Style**
-
-### 5.1 **Indentation**
-- Use 2 spaces for indentation for better readability.
-- Use the Shell Formater Extention for VS-Code
-
----
-
-## 5. **Best Practices Checklist**
-
-- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
-- [ ] Correct link to *build.func*
-- [ ] Metadata (author, license) is included at the top.
-- [ ] Variables follow naming conventions.
-- [ ] Update function exists.
-- [ ] Update functions checks if App is installed an for new Version.
-- [ ] Update function up temporary files.
-- [ ] Script ends with a helpfull message for the User to reach the App.
-
----
-
-# **APP.json Files**
- `APP.json` files found in the `/json` directory. These files are used to provide informations for the frontend. For this guide we take `/json/snipeit.json` as example.
-
- ## 1 **Json Generator**
- - To spare you some headache creating the json file, use the [Json-Editor](https://community-scripts.github.io/ProxmoxVE/json-editor)
-
-
-
----
-
- 🚀 By following these essential coding standards, you'll transform your shell scripts into powerful, rock-solid tools that not only stand the test of time but also operate with peak efficiency and reliability. 🌟 They'll be fortified with robust security measures 🔐, ensuring they stay resilient against vulnerabilities, and structured in a way that makes them effortless to understand, update, and maintain. ✨ Whether you're writing a quick utility or managing complex automation, these principles are your ticket to creating scripts that truly shine! 💡💻
-
From 0aaea5c50f31d3ec0b65e14872d691b9fafd3b5b Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 11:37:21 +0100
Subject: [PATCH 17/28] Fix broken link
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 41658309..6099e6b2 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -46,14 +46,14 @@ Before contributing, please ensure that you have the following setup:
# 🚀 The Application Script (ct/AppName.sh)
-- You can find all Coding standards, as well as the structure for this files [here](.github/CONTRIBUTIR_GUIDE/ct/AppName.md).
+- You can find all Coding standards, as well as the structure for this files [here](/ct/AppName.md).
- These Scripts are responsible for Container creataion, setting the necessery varibles and handels the update of the Application.
---
# 🛠 The Installation Script (install/AppName-install.sh)
-- You can find all Coding standards, as well as the structure for this files [here](.github/CONTRIBUTIR_GUIDE/install/AppName-install.md).
+- You can find all Coding standards, as well as the structure for this files [here](/install/AppName-install.md).
- These Scripts handel the installation of the Application.
---
From 784fc81a1ee1b441d51c5879c39cdacb2b57a42b Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 11:38:50 +0100
Subject: [PATCH 18/28] Fix broken link
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 6099e6b2..ce08b428 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -46,14 +46,14 @@ Before contributing, please ensure that you have the following setup:
# 🚀 The Application Script (ct/AppName.sh)
-- You can find all Coding standards, as well as the structure for this files [here](/ct/AppName.md).
+- You can find all Coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.md).
- These Scripts are responsible for Container creataion, setting the necessery varibles and handels the update of the Application.
---
# 🛠 The Installation Script (install/AppName-install.sh)
-- You can find all Coding standards, as well as the structure for this files [here](/install/AppName-install.md).
+- You can find all Coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
- These Scripts handel the installation of the Application.
---
From 5e68a7e545f4edde82e3a8a12d8335c99f00ddc2 Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 12:03:12 +0100
Subject: [PATCH 19/28] UPDATE contributing
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 2 +-
.github/CONTRIBUTOR_GUIDE/ct/AppName.md | 21 +++++++-----
.../install/AppName-install.md | 34 +++++++------------
3 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index ce08b428..2ddc1a69 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -54,7 +54,7 @@ Before contributing, please ensure that you have the following setup:
# 🛠 The Installation Script (install/AppName-install.sh)
- You can find all Coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
-- These Scripts handel the installation of the Application.
+- These Scripts are responsible for the installation of the Application.
---
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
index 8b07143d..78f1f37f 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
@@ -5,7 +5,7 @@
## 1. **File Header**
### 1.1 **Shebang**
-- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+- Use `#!/usr/bin/env bash` as the shebang.
```bash
#!/usr/bin/env bash
@@ -15,7 +15,7 @@
- When developing your own Script, change the link to your own repository.
> [!CAUTION]
-> Before opening a Pull Request change the link to point to the community-scripts repo.
+> Before opening a Pull Request, change the link to point to the community-scripts repo.
Example for development:
```bash
@@ -45,8 +45,8 @@ Example:
---
## 2 **Variables and Function import**
-> [!IMPORTANT]
-> You need to have all this set in Your Script, otherwise it will not work!
+> [!NOTE]
+> You need to have all this set in your Script, otherwise it will not work!
### 2.1 **Default Values**
- This sections sets the Default Values for the Container.
@@ -107,7 +107,7 @@ catch_errors
## 3 **Update Function**
### 3.1 **Function Header**
-- if applicable write a function wich updates the Application and the OS in the container.
+- If applicable write a function wich updates the Application and the OS in the container.
- Each update function starts with a standardised Header:
```bash
function update_script() {
@@ -127,7 +127,7 @@ if [[ ! -d /opt/snipe-it ]]; then
fi
```
### 3.3 **Check Version**
-- The last step befor the update is to check if ther is a new version.
+- Befor updating, check if a new Version exists.
- For this we use the `${APPLICATION}_version.txt` file created in `/opt` during the install.
Example with a Github Release:
@@ -135,7 +135,7 @@ Example with a Github Release:
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}"
- #DO UPDATE STUFF
+ #DO UPDATE
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi
@@ -149,7 +149,7 @@ Example:
wget -q
unzip -q
```
-- If a command dose not come with such a functionality use `&>/dev/null` for suppresinf output verbosity.
+- If a command dose not come with such a functionality use `&>/dev/null` to suppress its output.
Example:
```bash
@@ -160,7 +160,7 @@ php artisan config:clear &>/dev/null
### 3.5 **Backups**
- Backup userdata if nessesary.
- Move all userdata back in the Directory when the update is finnished.
->[!WARNING]
+>[!NOTE]
>This is not meant to be a permantent backup
Example backup:
@@ -198,6 +198,8 @@ function update_script() {
}
```
+---
+
## 4 **End of the Script**
- `start`: Launches Whiptail dialogue
- `build_container`: Collects and integrates user settings
@@ -215,6 +217,7 @@ echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
```
---
+
## 5. **Best Practices Checklist**
- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
index 548fb9c0..0bb99789 100644
--- a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
@@ -1,11 +1,11 @@
# **AppName-install.sh Scripts**
- `AppName-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/install/snipeit-install.sh` as example.
+ `AppName-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the Application. For this guide we take `/install/snipeit-install.sh` as example.
## 1. **File Header**
### 1.1 **Shebang**
-- Use `#!/usr/bin/env bash` as the shebang for portability across systems.
+- Use `#!/usr/bin/env bash` as the shebang.
```bash
#!/usr/bin/env bash
@@ -24,7 +24,7 @@ Example:
```
> [!NOTE]:
> - Add your username
-> - For existing scripts, add "| Co-Author [YourUserName]"
+> - When updating/reworking scripts, add "| Co-Author [YourUserName]"
### 1.3 **Variables and Function import**
- This sections adds the support for all needed functions and variables.
@@ -50,15 +50,6 @@ Example:
DB_NAME=snipeit_db # Environment-like variable (constant)
db_user="snipeit" # Local variable
```
-
-### 2.2 **Avoid Hardcoding Values**
-- Dynamically generate sensitive values, like passwords, using tools like `openssl`.
-
-Example:
-```bash
-DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
-```
-
---
## 3. **Dependencies**
@@ -89,21 +80,26 @@ instead of
```bash
php8.2-bcmath php8.2-common php8.2-ctype
```
+
---
+
## 4. **Paths to applications**
- If possible install the App and all nessesery files in `/opt/`
+---
+
## 5. **Version Management**
### 5.1 **Install the latest Release**
- Always try and install the latest Release if possibly
-- Do not Hardcode any Version if not absolutly nessesery
+- Do not hardcode any version if not absolutly nessesery
Example for a git Release:
```bash
RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
```
+
### 5.2 **Store the Version in a File for later Updates**
- Write the installed Version into a file.
- This is used for the Update function in app.sh to check if we need to update or not
@@ -112,6 +108,7 @@ Example:
```bash
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
```
+---
## 6. **Input and Output Management**
@@ -139,6 +136,7 @@ Example:
$STD apt-get install -y nginx
```
+---
## 7. **String/File Manipulation**
@@ -213,7 +211,7 @@ DB_NAME="${DB_NAME}"
EOF
```
-### 9.4 **Reload Services**
+### 9.4 **Services**
- Enable affected services after configuration changes and start it right away.
Example:
@@ -244,14 +242,6 @@ apt-get -y autoclean
---
-## 11. **Consistency and Style**
-
-### 11.1 **Indentation**
-- Use 2 spaces for indentation for better readability.
-- Use the Shell Formater Extention for VS-Code
-
----
-
## 11. **Best Practices Checklist**
- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
From d0862883acb96125c91588c25f74b34e1c2cbb2d Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 12:08:11 +0100
Subject: [PATCH 20/28] UPDATE contributing
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 2ddc1a69..f2e98f7f 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -79,8 +79,8 @@ git clone https://github.com/yourUserName/ForkName
git switch -c your-feature-branch
```
-### 4. Change Paths in build.func and install.func
-you need to switch "community-scripts/ProxmoxVE" to "yourUserName/ForkName"
+### 4. Change Paths in build.func install.func and AppName.sh
+You need to switch `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main` to `https://raw.githubusercontent.com/[USER]/[REPOSITORY]/refs/head/[BRANCH]` to test your script in your repository. Befor opening a Pull Request change all this back to point to the community-scripts Repository.
### 4. Commit Changes (without build.func and install.func!)
```bash
From 2ddd79de1af8e74ca6da61e6448b514cf77182be Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 12:09:51 +0100
Subject: [PATCH 21/28] UPDATE contributing
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index f2e98f7f..6e302e4a 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -60,7 +60,7 @@ Before contributing, please ensure that you have the following setup:
## 🚀 Building Your Own Scripts
-Start with the [template script](https://github.com/community-scripts/ProxmoxVE/blob/main/docs/templates/example-install.sh)
+Start with the [template script](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)
---
@@ -102,6 +102,7 @@ Open a PR from your feature branch to the main repository branch
- [Function-Overview](https://github.com/community-scripts/ProxmoxVE/wiki/Function_Overview)
- [CT Template: AppName.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh)
- [Install Template: AppName-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.sh)
+- [JSON Template: AppName.json](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/json/AppName.json)
---
From 730abf5477efadc076d616706037013dd49f159d Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 14:15:47 +0100
Subject: [PATCH 22/28] Update
---
.github/CONTRIBUTOR_GUIDE/ct/AppName.md | 2 +-
.github/CONTRIBUTOR_GUIDE/install/AppName-install.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
index 78f1f37f..dc465779 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
@@ -132,7 +132,7 @@ if [[ ! -d /opt/snipe-it ]]; then
Example with a Github Release:
```bash
- RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+ RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to v${RELEASE}"
#DO UPDATE
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
index 0bb99789..16d568a6 100644
--- a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
@@ -96,7 +96,7 @@ php8.2-bcmath php8.2-common php8.2-ctype
Example for a git Release:
```bash
-RELEASE=$(curl -s https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
+RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
```
From b805a9eb7134227d46545f05150c33a2569b57f9 Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Thu, 19 Dec 2024 14:32:12 +0100
Subject: [PATCH 23/28] UPDATE
---
.github/CONTRIBUTOR_GUIDE/install/AppName-install.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
index 16d568a6..cd660411 100644
--- a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
@@ -106,7 +106,7 @@ wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
Example:
```bash
-echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
+echo "${RELEASE}" >"/opt/AppName_version.txt"
```
---
From b0d76cca64280e4090c5979ebc72bc3c8e0e9375 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Fri, 20 Dec 2024 09:18:32 +0100
Subject: [PATCH 24/28] Update AppName.md
---
.github/CONTRIBUTOR_GUIDE/ct/AppName.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
index dc465779..be163db9 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
@@ -58,7 +58,7 @@ Example:
>| Variable | Description | Notes |
>|----------|-------------|-------|
>| `APP` | Application name | Must match ct\AppName.sh |
->| `TAGS` | Proxmox display tags | Limit the number |
+>| `TAGS` | Proxmox display tags without Spaces, only ; | Limit the number |
>| `var_cpu` | CPU cores | Number of cores |
>| `var_ram` | RAM | In MB |
>| `var_disk` | Disk capacity | In GB |
From 0e1f46b147ff96f7998bcd23cbd2eaeff73d74ab Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Fri, 20 Dec 2024 09:35:58 +0100
Subject: [PATCH 25/28] UPDATE CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 6e302e4a..a0b62efe 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -93,7 +93,7 @@ git push origin your-feature-branch
```
### 6. Create a Pull Request
-Open a PR from your feature branch to the main repository branch
+Open a PR from your feature branch to the main repository branch. You may only include your AppName.sh, AppName-instal.sh and AppName.json files in the pull request.
---
From 4dc7a3df0d2e89692cc2cb7a6c89e282427d1ded Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
Date: Fri, 20 Dec 2024 09:49:36 +0100
Subject: [PATCH 26/28] UPDATE CONTRIBUTING.md
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index a0b62efe..ccea532f 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -93,7 +93,7 @@ git push origin your-feature-branch
```
### 6. Create a Pull Request
-Open a PR from your feature branch to the main repository branch. You may only include your AppName.sh, AppName-instal.sh and AppName.json files in the pull request.
+Open a PR from your feature branch to the main repository branch. You may only include your **AppName.sh**, **AppName-install.sh** and **AppName.json** files in the pull request.
---
From acd26c4747aa964c106fc053f806f17289601bdd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20B=C3=A9dard-Couture?=
Date: Sun, 22 Dec 2024 17:28:23 -0500
Subject: [PATCH 27/28] Fixing some typos
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index ccea532f..1eca1fb0 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -15,7 +15,7 @@ Coding standards are crucial for several reasons:
### Scope of These Documents
-These documentes covers the coding standards for the following types of files in our project:
+These documents covers the coding standards for the following types of files in our project:
- **`APP-install.sh` Scripts**: These scripts are responsible for the installation of applications and are located in the `/install` directory.
- **`APP.sh` Scripts**: These scripts handle the creation and updating of containers and are found in the `/ct` directory.
@@ -33,7 +33,7 @@ Let's work together to keep our codebase clean, efficient, and maintainable!
Before contributing, please ensure that you have the following setup:
1. **Visual Studio Code** (recommended for script development)
-2. **Necessary VS Code Extensions:**
+2. **Recommended VS Code Extensions:**
- [Shell Syntax](https://marketplace.visualstudio.com/items?itemName=bmalehorn.shell-syntax)
- [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck)
- [Shell Format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format)
@@ -46,15 +46,15 @@ Before contributing, please ensure that you have the following setup:
# 🚀 The Application Script (ct/AppName.sh)
-- You can find all Coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.md).
-- These Scripts are responsible for Container creataion, setting the necessery varibles and handels the update of the Application.
+- You can find all coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.md).
+- These Scripts are responsible for container creation, setting the necessary variables and handles the update of the application.
---
# 🛠 The Installation Script (install/AppName-install.sh)
-- You can find all Coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
-- These Scripts are responsible for the installation of the Application.
+- You can find all coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
+- These scripts are responsible for the installation of the application.
---
@@ -80,7 +80,7 @@ git switch -c your-feature-branch
```
### 4. Change Paths in build.func install.func and AppName.sh
-You need to switch `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main` to `https://raw.githubusercontent.com/[USER]/[REPOSITORY]/refs/head/[BRANCH]` to test your script in your repository. Befor opening a Pull Request change all this back to point to the community-scripts Repository.
+You need to switch `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main` to `https://raw.githubusercontent.com/[USER]/[REPOSITORY]/refs/head/[BRANCH]` to test your script in your repository. Before opening a Pull Request change all this back to point to the community-scripts Repository.
### 4. Commit Changes (without build.func and install.func!)
```bash
From d14a7d949879907375329716472e215ebb9b4f6e Mon Sep 17 00:00:00 2001
From: Michel Roegl-Brunner
<73236783+michelroegl-brunner@users.noreply.github.com>
Date: Sun, 29 Dec 2024 15:35:00 +0100
Subject: [PATCH 28/28] Update
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Sébastiaan
---
.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md | 32 +++----
.github/CONTRIBUTOR_GUIDE/ct/AppName.md | 56 ++++++------
.github/CONTRIBUTOR_GUIDE/ct/AppName.sh | 8 +-
.../install/AppName-install.md | 85 ++++++++++---------
.github/CONTRIBUTOR_GUIDE/json/AppName.md | 6 +-
5 files changed, 95 insertions(+), 92 deletions(-)
diff --git a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
index 1eca1fb0..81a216b7 100644
--- a/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
+++ b/.github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
@@ -2,7 +2,7 @@
# Community Scripts Contribution Guide
## **Welcome to the communty-scripts Repository!**
-📜 These documents outlines the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.
+📜 These documents outline the essential coding standards for all our scripts and JSON files. Adhering to these standards ensures that our codebase remains consistent, readable, and maintainable. By following these guidelines, we can improve collaboration, reduce errors, and enhance the overall quality of our project.
### Why Coding Standards Matter
@@ -15,11 +15,11 @@ Coding standards are crucial for several reasons:
### Scope of These Documents
-These documents covers the coding standards for the following types of files in our project:
+These documents cover the coding standards for the following types of files in our project:
-- **`APP-install.sh` Scripts**: These scripts are responsible for the installation of applications and are located in the `/install` directory.
-- **`APP.sh` Scripts**: These scripts handle the creation and updating of containers and are found in the `/ct` directory.
-- **JSON Files**: These files store structured data and are located in the `/json` directory.
+- **`install/$AppName-install.sh` Scripts**: These scripts are responsible for the installation of applications.
+- **`ct/$AppName.sh` Scripts**: These scripts handle the creation and updating of containers.
+- **`json/$AppName.json`**: These files store structured data and are used for the website.
Each section provides detailed guidelines on various aspects of coding, including shebang usage, comments, variable naming, function naming, indentation, error handling, command substitution, quoting, script structure, and logging. Additionally, examples are provided to illustrate the application of these standards.
@@ -46,14 +46,14 @@ Before contributing, please ensure that you have the following setup:
# 🚀 The Application Script (ct/AppName.sh)
-- You can find all coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.md).
-- These Scripts are responsible for container creation, setting the necessary variables and handles the update of the application.
+- You can find all coding standards, as well as the structure for this file [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/ct/AppName.md).
+- These scripts are responsible for container creation, setting the necessary variables and handling the update of the application once installed.
---
# 🛠 The Installation Script (install/AppName-install.sh)
-- You can find all coding standards, as well as the structure for this files [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
+- You can find all coding standards, as well as the structure for this file [here](https://github.com/community-scripts/ProxmoxVE/blob/contributor_guide/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md).
- These scripts are responsible for the installation of the application.
---
@@ -66,34 +66,34 @@ Start with the [template script](https://github.com/community-scripts/ProxmoxVE/
## 🤝 Contribution Process
-### 1. Fork the Repository
+### 1. Fork the repository
Fork to your GitHub account
-### 2. Clone Your Fork on your Pc
+### 2. Clone your fork on your local environment
```bash
git clone https://github.com/yourUserName/ForkName
```
-### 3. Create a New Branch
+### 3. Create a new branch
```bash
git switch -c your-feature-branch
```
-### 4. Change Paths in build.func install.func and AppName.sh
-You need to switch `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main` to `https://raw.githubusercontent.com/[USER]/[REPOSITORY]/refs/head/[BRANCH]` to test your script in your repository. Before opening a Pull Request change all this back to point to the community-scripts Repository.
+### 4. Change paths in build.func install.func and AppName.sh
+To be able to develop from your own branch you need to change `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main` to `https://raw.githubusercontent.com/[USER]/[REPOSITORY]/refs/head/[BRANCH]`. This change is only for testing. Before opening a Pull Request you should change this line change all this back to point to `https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main`.
-### 4. Commit Changes (without build.func and install.func!)
+### 4. Commit changes (without build.func and install.func!)
```bash
git commit -m "Your commit message"
```
-### 5. Push to Your Fork
+### 5. Push to your fork
```bash
git push origin your-feature-branch
```
### 6. Create a Pull Request
-Open a PR from your feature branch to the main repository branch. You may only include your **AppName.sh**, **AppName-install.sh** and **AppName.json** files in the pull request.
+Open a Pull Request from your feature branch to the main repository branch. You must only include your **$AppName.sh**, **$AppName-install.sh** and **$AppName.json** files in the pull request.
---
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
index be163db9..b9b2fe72 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.md
@@ -1,5 +1,5 @@
# **AppName.sh Scripts**
- `AppName.sh` scripts found in the `/ct` directory. These scripts are responsible for the installation of the desired Application. For this guide we take `/ct/snipeit.sh` as example.
+ `AppName.sh` scripts found in the `/ct` directory. These scripts are responsible for the installation of the desired application. For this guide we take `/ct/snipeit.sh` as example.
## 1. **File Header**
@@ -11,18 +11,18 @@
#!/usr/bin/env bash
```
### 1.2 **Import Functions**
-- Import the build.func File.
-- When developing your own Script, change the link to your own repository.
+- Import the build.func file.
+- When developing your own script, change the URL to your own repository.
> [!CAUTION]
-> Before opening a Pull Request, change the link to point to the community-scripts repo.
+> Before opening a Pull Request, change the URL to point to the community-scripts repo.
Example for development:
```bash
source <(curl -s https://raw.githubusercontent.com/[USER]/[REPO]/refs/heads/[BRANCH]/misc/build.func)
```
-Example for final Script:
+Example for final script:
```bash
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
```
@@ -44,13 +44,13 @@ Example:
---
-## 2 **Variables and Function import**
+## 2 **Variables and function import**
> [!NOTE]
-> You need to have all this set in your Script, otherwise it will not work!
+> You need to have all this set in your script, otherwise it will not work!
### 2.1 **Default Values**
-- This sections sets the Default Values for the Container.
-- `APP` needs to be set to the Application name and must represent the filenames of your scripts.
+- This section sets the default values for the container.
+- `APP` needs to be set to the application name and must be equal to the filenames of your scripts.
- `var_tags`: You can set Tags for the CT wich show up in the Proxmox UI. Don´t overdo it!
>[!NOTE]
@@ -78,7 +78,7 @@ var_version="12"
var_unprivileged="1"
```
-## 2.2 **📋 App Output & Base Settings**
+## 2.2 **📋 App output & base settings**
```bash
# App Output & Base Settings
@@ -89,7 +89,7 @@ base_settings
- `header_info`: Generates ASCII header for APP
- `base_settings`: Allows overwriting variable values
-## 2.3 **🛠 Core Functions**
+## 2.3 **🛠 Core functions**
```bash
# Core
@@ -104,11 +104,11 @@ catch_errors
---
-## 3 **Update Function**
+## 3 **Update function**
### 3.1 **Function Header**
-- If applicable write a function wich updates the Application and the OS in the container.
-- Each update function starts with a standardised Header:
+- If applicable write a function that updates the application and the OS in the container.
+- Each update function starts with the same code:
```bash
function update_script() {
header_info
@@ -117,7 +117,7 @@ function update_script() {
```
### 3.2 **Check APP**
-- Befor doing anything updatewise, check if the App is installed in the Container.
+- Before doing anything update-wise, check if the app is installed in the container.
Example:
```bash
@@ -126,9 +126,9 @@ if [[ ! -d /opt/snipe-it ]]; then
exit
fi
```
-### 3.3 **Check Version**
-- Befor updating, check if a new Version exists.
-- For this we use the `${APPLICATION}_version.txt` file created in `/opt` during the install.
+### 3.3 **Check version**
+- Befoer updating, check if a new version exists.
+ - We use the `${APPLICATION}_version.txt` file created in `/opt` during the install to compare new versions against the currently installed version.
Example with a Github Release:
```bash
@@ -143,13 +143,13 @@ Example with a Github Release:
}
```
### 3.4 **Verbosity**
-- Use the appropiate flag (**-q** in the examples) for a command to suppres its output.
+- Use the appropriate flag (**-q** in the examples) for a command to suppress its output.
Example:
```bash
wget -q
unzip -q
```
-- If a command dose not come with such a functionality use `&>/dev/null` to suppress its output.
+- If a command does not come with this functionality use `&>/dev/null` to suppress it's output.
Example:
```bash
@@ -158,10 +158,10 @@ php artisan config:clear &>/dev/null
```
### 3.5 **Backups**
-- Backup userdata if nessesary.
-- Move all userdata back in the Directory when the update is finnished.
+- Backup user data if necessary.
+- Move all user data back in the directory when the update is finished.
>[!NOTE]
->This is not meant to be a permantent backup
+>This is not meant to be a permanent backup
Example backup:
```bash
@@ -200,11 +200,11 @@ function update_script() {
---
-## 4 **End of the Script**
+## 4 **End of the script**
- `start`: Launches Whiptail dialogue
- `build_container`: Collects and integrates user settings
- `description`: Sets LXC container description
-- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the App.
+- With `echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"` you can point the user to the IP:PORT/folder needed to access the app.
```bash
start
@@ -218,14 +218,14 @@ echo -e "${TAB}${GATEWAY}${BGN}http://${IP}${CL}"
```
---
-## 5. **Best Practices Checklist**
+## 5. **Contribution checklist**
- [ ] Shebang is correctly set (`#!/usr/bin/env bash`).
- [ ] Correct link to *build.func*
- [ ] Metadata (author, license) is included at the top.
- [ ] Variables follow naming conventions.
- [ ] Update function exists.
-- [ ] Update functions checks if App is installed an for new Version.
+- [ ] Update functions checks if app is installed an for new version.
- [ ] Update function up temporary files.
-- [ ] Script ends with a helpfull message for the User to reach the App.
+- [ ] Script ends with a helpful message for the user to reach the application.
diff --git a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
index 2b5d7074..bf28d113 100644
--- a/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
+++ b/.github/CONTRIBUTOR_GUIDE/ct/AppName.sh
@@ -7,21 +7,21 @@ source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/m
# App Default Values
APP="[APP_NAME]"
-# Name of the App (e.g. Google, Adventurelog, Apache-Guacamole"
+# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole"
TAGS="[TAGS]"
# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp)
var_cpu="[CPU]"
-# Number of Cores (1-X) (e.g. 4) - default are 2
+# Number of cores (1-X) (e.g. 4) - default are 2
var_ram="[RAM]"
# Amount of used RAM in MB (e.g. 2048 or 4096)
var_disk="[DISK]"
-# Amount of used Disk Space in GB (e.g. 4 or 10)
+# Amount of used disk space in GB (e.g. 4 or 10)
var_os="[OS]"
# Default OS (e.g. debian, ubuntu, alpine)
var_version="[VERSION]"
# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine)
var_unprivileged="[UNPRIVILEGED]"
-# 1 = unprivileged Container, 0 = privileged Container
+# 1 = unprivileged container, 0 = privileged container
# App Output & Base Settings
header_info "$APP"
diff --git a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
index cd660411..701e7cc3 100644
--- a/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
+++ b/.github/CONTRIBUTOR_GUIDE/install/AppName-install.md
@@ -1,8 +1,8 @@
# **AppName-install.sh Scripts**
- `AppName-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the Application. For this guide we take `/install/snipeit-install.sh` as example.
+ `AppName-install.sh` scripts found in the `/install` directory. These scripts are responsible for the installation of the application. For this guide we take `/install/snipeit-install.sh` as example.
-## 1. **File Header**
+## 1. **File header**
### 1.1 **Shebang**
- Use `#!/usr/bin/env bash` as the shebang.
@@ -26,7 +26,7 @@ Example:
> - Add your username
> - When updating/reworking scripts, add "| Co-Author [YourUserName]"
-### 1.3 **Variables and Function import**
+### 1.3 **Variables and function import**
- This sections adds the support for all needed functions and variables.
```bash
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
@@ -39,9 +39,9 @@ update_os
```
---
-## 2. **Variable Naming and Management**
+## 2. **Variable naming and management**
-### 2.1 **Naming Conventions**
+### 2.1 **Naming conventions**
- Use uppercase names for constants and environment variables.
- Use lowercase names for local script variables.
@@ -68,8 +68,8 @@ $STD apt-get install -y \
nginx
```
-### 3.2 **Collaps Dependencies**
-- Collaps dependencies to keep the Code readable.
+### 3.2 **Collapse dependencies**
+Collapse dependencies to keep the code readable.
Example:
Use
@@ -83,26 +83,26 @@ php8.2-bcmath php8.2-common php8.2-ctype
---
-## 4. **Paths to applications**
-- If possible install the App and all nessesery files in `/opt/`
+## 4. **Paths to application files**
+If possible install the app and all necessary files in `/opt/`
---
-## 5. **Version Management**
+## 5. **Version management**
-### 5.1 **Install the latest Release**
-- Always try and install the latest Release if possibly
-- Do not hardcode any version if not absolutly nessesery
+### 5.1 **Install the latest release**
+- Always try and install the latest release
+- Do not hardcode any version if not absolutely necessary
-Example for a git Release:
+Example for a git release:
```bash
RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
```
-### 5.2 **Store the Version in a File for later Updates**
-- Write the installed Version into a file.
-- This is used for the Update function in app.sh to check if we need to update or not
+### 5.2 **Save the version for update checks**
+- Write the installed version into a file.
+- This is used for the update function in AppName.sh to check for updates
Example:
```bash
@@ -110,9 +110,9 @@ echo "${RELEASE}" >"/opt/AppName_version.txt"
```
---
-## 6. **Input and Output Management**
+## 6. **Input and output management**
-### 6.1 **User Feedback**
+### 6.1 **User feedback**
- Use standard functions like `msg_info` and `msg_ok` to print status messages.
- Display meaningful progress messages at key stages.
@@ -152,19 +152,19 @@ sed -i -e "s|^DB_DATABASE=.*|DB_DATABASE=$DB_NAME|" \
---
-## 8. **Security Practices**
+## 8. **Security practices**
-### 8.1 **Password Generation**
-- Use secure tools (e.g., `openssl`) to generate random passwords.
-- Use only Alphanumeric Values to not introduce unknown behaviour.
+### 8.1 **Password generation**
+- Use `openssl` to generate random passwords.
+- Use only alphanumeric values to not introduce unknown behaviour.
Example:
```bash
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
```
-### 8.2 **File Permissions**
-- Explicitly set secure ownership and permissions for sensitive files.
+### 8.2 **File permissions**
+Explicitly set secure ownership and permissions for sensitive files.
Example:
```bash
@@ -176,8 +176,8 @@ chmod -R 755 /opt/snipe-it
## 9. **Service Configuration**
-### 9.1 **Configuration Files**
-- Use `cat <> ~/application.creds
```
-### 9.3 **Enviromental Files**
-- Use `cat </path/to/.env
VARIABLE="value"
@@ -212,7 +215,7 @@ EOF
```
### 9.4 **Services**
-- Enable affected services after configuration changes and start it right away.
+Enable affected services after configuration changes and start them right away.
Example:
```bash
@@ -223,16 +226,16 @@ systemctl enable -q --now nginx
## 10. **Cleanup**
-### 10.1 **Remove Temporary Files**
-- Remove temporary files or unnecessary downloads after use.
+### 10.1 **Remove temporary files**
+Remove temporary files and downloads after use.
Example:
```bash
rm -rf /opt/v${RELEASE}.zip
```
-### 10.2 **Autoremove and Autoclean**
-- Clean up unused dependencies to reduce disk space usage.
+### 10.2 **Autoremove and autoclean**
+Remove unused dependencies to reduce disk space usage.
Example:
```bash
@@ -255,8 +258,8 @@ apt-get -y autoclean
### Example: High-Level Script Flow
-1. **Dependencies Installation**
-2. **Database Setup**
-3. **Download and Configure Application**
-4. **Service Configuration**
-5. **Final Cleanup**
+1. Dependencies installation
+2. Database setup
+3. Download and configure application
+4. Service configuration
+5. Final cleanup
diff --git a/.github/CONTRIBUTOR_GUIDE/json/AppName.md b/.github/CONTRIBUTOR_GUIDE/json/AppName.md
index 59d38aa3..e91afe1f 100644
--- a/.github/CONTRIBUTOR_GUIDE/json/AppName.md
+++ b/.github/CONTRIBUTOR_GUIDE/json/AppName.md
@@ -1,5 +1,5 @@
# **AppName.json Files**
- `AppName.json` files found in the `/json` directory. These files are used to provide informations for the frontend. For this guide we take `/json/snipeit.json` as example.
+ `AppName.json` files found in the `/json` directory. These files are used to provide informations for the website. For this guide we take `/json/snipeit.json` as example.
- ## 1 **Json Generator**
- - To spare you some headache creating the json file, use the [Json-Editor](https://community-scripts.github.io/ProxmoxVE/json-editor)
\ No newline at end of file
+ ## 1. JSON Generator
+Use the [JSON Generator](https://community-scripts.github.io/ProxmoxVE/json-editor) to create this file for your application.
\ No newline at end of file