From ad2f1bc8794197b76de7540ed697aaece7867ec8 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Wed, 25 Mar 2026 13:46:38 +0100 Subject: [PATCH] Delete .github/CONTRIBUTOR_AND_GUIDES/ct directory --- .github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md | 286 ------------------- .github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh | 86 ------ 2 files changed, 372 deletions(-) delete mode 100644 .github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md delete mode 100644 .github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh diff --git a/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md b/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md deleted file mode 100644 index 8507c7c2..00000000 --- a/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md +++ /dev/null @@ -1,286 +0,0 @@ -# **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. - -## Table of Contents - -- [**AppName.sh Scripts**](#appnamesh-scripts) - - [Table of Contents](#table-of-contents) - - [1. **File Header**](#1-file-header) - - [1.1 **Shebang**](#11-shebang) - - [1.2 **Import Functions**](#12-import-functions) - - [1.3 **Metadata**](#13-metadata) - - [2 **Variables and function import**](#2-variables-and-function-import) - - [2.1 **Default Values**](#21-default-values) - - [2.2 **πŸ“‹ App output \& base settings**](#22--app-output--base-settings) - - [2.3 **πŸ›  Core functions**](#23--core-functions) - - [3 **Update function**](#3-update-function) - - [3.1 **Function Header**](#31-function-header) - - [3.2 **Check APP**](#32-check-app) - - [3.3 **Check version**](#33-check-version) - - [3.4 **Verbosity**](#34-verbosity) - - [3.5 **Backups**](#35-backups) - - [3.6 **Cleanup**](#36-cleanup) - - [3.7 **No update function**](#37-no-update-function) - - [4 **End of the script**](#4-end-of-the-script) - - [5. **Contribution checklist**](#5-contribution-checklist) - -## 1. **File Header** - -### 1.1 **Shebang** - -- Use `#!/usr/bin/env bash` as the shebang. - -```bash -#!/usr/bin/env bash -``` - -### 1.2 **Import Functions** - -- Import the build.func file. -- When developing your own script, change the URL to your own repository. - -> [!IMPORTANT] -> You also need to change all apperances of this URL in `misc/build.func` and `misc/install.func` - -Example for development: - -```bash -source <(curl -s https://raw.githubusercontent.com/[USER]/[REPO]/refs/heads/[BRANCH]/misc/build.func) -``` - -Final script: - -```bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -``` - -> [!CAUTION] -> Before opening a Pull Request, change the URLs to point to the community-scripts repo. - -### 1.3 **Metadata** - -- Add clear comments for script metadata, including author, copyright, and license information. - -Example: - -```bash -# Copyright (c) 2021-2026 community-scripts ORG -# Author: [YourUserName] -# License: MIT | https://github.com/community-scripts/ProxmoxVED/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** -> -> [!NOTE] -> You need to have all this set in your script, otherwise it will not work! - -### 2.1 **Default Values** - -- 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] ->Description for all Default Values -> ->| Variable | Description | Notes | ->|----------|-------------|-------| ->| `APP` | Application name | Must match ct\AppName.sh | ->| `var_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 | ->| `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 -header_info "$APP" -``` -- `header_info`: Generates ASCII header for APP - -## 2.3 **πŸ›  Core functions** - -```bash -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 that updates the application and the OS in the container. -- Each update function starts with the same code: - -```bash -function update_script() { - header_info - check_container_storage - check_container_resources -``` - -### 3.2 **Check APP** - -- Before doing anything update-wise, 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** - -- Before 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 - 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 - else - msg_ok "No update required. ${APP} is already at v${RELEASE}." - fi - exit -} -``` - -### 3.4 **Verbosity** - -- Use the appropriate flag (**-q** in the examples) for a command to suppress its output. -Example: - -```bash -curl -fsSL -unzip -q -``` - -- If a command does not come with this functionality use `$STD` to suppress it's output. - -Example: - -```bash -$STD php artisan migrate --force -$STD php artisan config:clear -``` - -### 3.5 **Backups** - -- 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 permanent 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 an 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 "Currently we don't provide an update function for this ${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. **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 and for new version. -- [ ] Update function cleans up temporary files. -- [ ] Script ends with a helpful message for the user to reach the application. diff --git a/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh b/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh deleted file mode 100644 index cf9333c4..00000000 --- a/.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) -# Copyright (c) 2021-2026 community-scripts ORG -# Author: [YourUserName] -# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE -# Source: [SOURCE_URL] - -# App Default Values -APP="[APP_NAME]" -# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole" -var_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 - -header_info "$APP" -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 - # 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] - 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}"