mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-11 03:15:09 +00:00
160c546002
* First Design: CONTRIBUTING * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Ideas for CONTRIBUTING.md (#768) * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Update CONTRIBUTING.md * Add files via upload * fix var_tags * add comments to AppName.sh * Rework Contributing to merge the tow existing Versions * Remove coding_standards.md * Fix broken link * Fix broken link * UPDATE contributing * UPDATE contributing * UPDATE contributing * Update * UPDATE * Update AppName.md * UPDATE CONTRIBUTING.md * UPDATE CONTRIBUTING.md * Fixing some typos * Update Co-authored-by: Sébastiaan <se_bastiaan@outlook.com> * Update Contributing --------- Co-authored-by: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Co-authored-by: Michel Roegl-Brunner <michel.roegl-brunner@htl-braunau.at> Co-authored-by: Rémi Bédard-Couture <remi.bc@outlook.com> Co-authored-by: Sébastiaan <se_bastiaan@outlook.com>
87 lines
2.0 KiB
Bash
87 lines
2.0 KiB
Bash
#!/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 <<EOF >/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
|