Skip to content

Commit e87c1b7

Browse files
committed
Updated contributor docs
1 parent 0da24e2 commit e87c1b7

File tree

4 files changed

+69
-71
lines changed

4 files changed

+69
-71
lines changed

.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ Example:
108108

109109
```bash
110110
APP="SnipeIT"
111-
var_tags="asset-management;foss"
112-
var_cpu="2"
113-
var_ram="2048"
114-
var_disk="4"
115-
var_os="debian"
116-
var_version="12"
117-
var_unprivileged="1"
111+
var_tags="${var_tags:-asset-management;foss}"
112+
var_cpu="${var_cpu:-2}"
113+
var_ram="${var_ram:-2048}"
114+
var_disk="${var_disk:-4}"
115+
var_os="${var_os:-debian}"
116+
var_version="${var_version:-12}"
117+
var_unprivileged="${var_unprivileged:-1}"
118118
```
119119

120120
## 2.2 **📋 App output & base settings**

.github/CONTRIBUTOR_AND_GUIDES/ct/AppName.sh

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,74 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
66
# Source: [SOURCE_URL]
77

88
# App Default Values
9-
APP="[APP_NAME]"
109
# Name of the app (e.g. Google, Adventurelog, Apache-Guacamole"
11-
var_tags="[TAGS]"
10+
APP="[APP_NAME]"
1211
# Tags for Proxmox VE, maximum 2 pcs., no spaces allowed, separated by a semicolon ; (e.g. database | adblock;dhcp)
13-
var_cpu="[CPU]"
12+
var_tags="${var_tags:-[TAGS]}"
1413
# Number of cores (1-X) (e.g. 4) - default are 2
15-
var_ram="[RAM]"
14+
var_cpu="${var_cpu:-[CPU]}"
1615
# Amount of used RAM in MB (e.g. 2048 or 4096)
17-
var_disk="[DISK]"
16+
var_ram="${var_ram:-[RAM]}"
1817
# Amount of used disk space in GB (e.g. 4 or 10)
19-
var_os="[OS]"
18+
var_disk="${var_disk:-[DISK]}"
2019
# Default OS (e.g. debian, ubuntu, alpine)
21-
var_version="[VERSION]"
20+
var_os="${var_os:-[OS]}"
2221
# Default OS version (e.g. 12 for debian, 24.04 for ubuntu, 3.20 for alpine)
23-
var_unprivileged="[UNPRIVILEGED]"
22+
var_version="${var_version:-[VERSION]}"
2423
# 1 = unprivileged container, 0 = privileged container
24+
var_unprivileged="${var_unprivileged:-[UNPRIVILEGED]}"
2525

2626
header_info "$APP"
2727
variables
2828
color
2929
catch_errors
3030

3131
function update_script() {
32-
header_info
33-
check_container_storage
34-
check_container_resources
32+
header_info
33+
check_container_storage
34+
check_container_resources
3535

36-
# Check if installation is present | -f for file, -d for folder
37-
if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
38-
msg_error "No ${APP} Installation Found!"
39-
exit
40-
fi
36+
# Check if installation is present | -f for file, -d for folder
37+
if [[ ! -f [INSTALLATION_CHECK_PATH] ]]; then
38+
msg_error "No ${APP} Installation Found!"
39+
exit
40+
fi
4141

42-
# Crawling the new version and checking whether an update is required
43-
RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
44-
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
45-
# Stopping Services
46-
msg_info "Stopping $APP"
47-
systemctl stop [SERVICE_NAME]
48-
msg_ok "Stopped $APP"
42+
# Crawling the new version and checking whether an update is required
43+
RELEASE=$(curl -fsSL [RELEASE_URL] | [PARSE_RELEASE_COMMAND])
44+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
45+
# Stopping Services
46+
msg_info "Stopping $APP"
47+
systemctl stop [SERVICE_NAME]
48+
msg_ok "Stopped $APP"
4949

50-
# Creating Backup
51-
msg_info "Creating Backup"
52-
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
53-
msg_ok "Backup Created"
50+
# Creating Backup
51+
msg_info "Creating Backup"
52+
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" [IMPORTANT_PATHS]
53+
msg_ok "Backup Created"
5454

55-
# Execute Update
56-
msg_info "Updating $APP to v${RELEASE}"
57-
[UPDATE_COMMANDS]
58-
msg_ok "Updated $APP to v${RELEASE}"
55+
# Execute Update
56+
msg_info "Updating $APP to v${RELEASE}"
57+
[UPDATE_COMMANDS]
58+
msg_ok "Updated $APP to v${RELEASE}"
5959

60-
# Starting Services
61-
msg_info "Starting $APP"
62-
systemctl start [SERVICE_NAME]
63-
msg_ok "Started $APP"
60+
# Starting Services
61+
msg_info "Starting $APP"
62+
systemctl start [SERVICE_NAME]
63+
msg_ok "Started $APP"
6464

65-
# Cleaning up
66-
msg_info "Cleaning Up"
67-
rm -rf [TEMP_FILES]
68-
msg_ok "Cleanup Completed"
65+
# Cleaning up
66+
msg_info "Cleaning Up"
67+
rm -rf [TEMP_FILES]
68+
msg_ok "Cleanup Completed"
6969

70-
# Last Action
71-
echo "${RELEASE}" >/opt/${APP}_version.txt
72-
msg_ok "Update Successful"
73-
else
74-
msg_ok "No update required. ${APP} is already at v${RELEASE}"
75-
fi
76-
exit
70+
# Last Action
71+
echo "${RELEASE}" >/opt/${APP}_version.txt
72+
msg_ok "Update Successful"
73+
else
74+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
75+
fi
76+
exit
7777
}
7878

7979
start
@@ -83,4 +83,4 @@ description
8383
msg_ok "Completed Successfully!\n"
8484
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
8585
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
86-
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"
86+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}"

.github/CONTRIBUTOR_AND_GUIDES/install/AppName-install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Example for a git release:
152152

153153
```bash
154154
RELEASE=$(curl -fsSL https://api.github.com/repos/snipe/snipe-it/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
155-
wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
155+
curl -fsSL "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip"
156156
```
157157

158158
### 5.2 **Save the version for update checks**
@@ -163,7 +163,7 @@ wget -q "https://github.com/snipe/snipe-it/archive/refs/tags/v${RELEASE}.zip"
163163
Example:
164164

165165
```bash
166-
echo "${RELEASE}" >"/opt/AppName_version.txt"
166+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
167167
```
168168

169169
---

.github/CONTRIBUTOR_AND_GUIDES/install/AppName-install.sh

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Source: [SOURCE_URL]
77

88
# Import Functions und Setup
9-
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
9+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
1010
color
1111
verb_ip6
1212
catch_errors
@@ -31,30 +31,28 @@ $STD mysql -u root -e "CREATE DATABASE $DB_NAME;"
3131
$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');"
3232
$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
3333
{
34-
echo "${APPLICATION} Credentials"
35-
echo "Database User: $DB_USER"
36-
echo "Database Password: $DB_PASS"
37-
echo "Database Name: $DB_NAME"
38-
} >> ~/$APP_NAME.creds
34+
echo "${APPLICATION} Credentials"
35+
echo "Database User: $DB_USER"
36+
echo "Database Password: $DB_PASS"
37+
echo "Database Name: $DB_NAME"
38+
} >>~/"$APP_NAME".creds
3939
msg_ok "Set up Database"
4040

41-
# Temp
42-
4341
# Setup App
4442
msg_info "Setup ${APPLICATION}"
4543
RELEASE=$(curl -fsSL https://api.github.com/repos/[REPO]/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
4644
curl -fsSL -o "${RELEASE}.zip" "https://github.com/[REPO]/archive/refs/tags/${RELEASE}.zip"
4745
unzip -q "${RELEASE}.zip"
4846
mv "${APPLICATION}-${RELEASE}/" "/opt/${APPLICATION}"
49-
#
50-
#
5147
#
52-
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
48+
#
49+
#
50+
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
5351
msg_ok "Setup ${APPLICATION}"
5452

5553
# Creating Service (if needed)
5654
msg_info "Creating Service"
57-
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
55+
cat <<EOF >/etc/systemd/system/"${APPLICATION}".service
5856
[Unit]
5957
Description=${APPLICATION} Service
6058
After=network.target
@@ -66,15 +64,15 @@ Restart=always
6664
[Install]
6765
WantedBy=multi-user.target
6866
EOF
69-
systemctl enable -q --now ${APPLICATION}
67+
systemctl enable -q --now "${APPLICATION}"
7068
msg_ok "Created Service"
7169

7270
motd_ssh
7371
customize
7472

7573
# Cleanup
7674
msg_info "Cleaning up"
77-
rm -f ${RELEASE}.zip
75+
rm -f "${RELEASE}".zip
7876
$STD apt-get -y autoremove
7977
$STD apt-get -y autoclean
80-
msg_ok "Cleaned"
78+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)