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`).