Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastiaan <[email protected]>
  • Loading branch information
michelroegl-brunner and se-bastiaan authored Dec 29, 2024
1 parent acd26c4 commit d14a7d9
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 92 deletions.
32 changes: 16 additions & 16 deletions .github/CONTRIBUTOR_GUIDE/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.

Expand All @@ -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.

---
Expand All @@ -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.

---

Expand Down
56 changes: 28 additions & 28 deletions .github/CONTRIBUTOR_GUIDE/ct/AppName.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# **AppName<span></span>.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**
Expand All @@ -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)
```
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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.
8 changes: 4 additions & 4 deletions .github/CONTRIBUTOR_GUIDE/ct/AppName.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit d14a7d9

Please sign in to comment.