mirror of
https://framagit.org/YunoHost-Apps/gitea_ynh.git
synced 2024-11-22 02:51:35 +01:00
Add ynh_script_progression somewhere
This commit is contained in:
parent
3a6e4b46d7
commit
3a66c7b87b
@ -15,6 +15,7 @@ source ../settings/scripts/experimental_helper.sh
|
|||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -22,17 +23,23 @@ domain=$(ynh_app_setting_get --app $app --key domain)
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Copy the app source files
|
# Copy the app source files
|
||||||
|
ynh_script_progression --message="Backing up code..." --weight=3
|
||||||
ynh_backup --src_path "$final_path"
|
ynh_backup --src_path "$final_path"
|
||||||
|
|
||||||
# Copy the data files
|
# Copy the data files
|
||||||
|
ynh_script_progression --message="Backing up user data..." --weight=10
|
||||||
ynh_backup --src_path "$DATADIR"
|
ynh_backup --src_path "$DATADIR"
|
||||||
|
|
||||||
|
ynh_script_progression --message="Backing up configuration..."
|
||||||
|
|
||||||
# Copy the conf files
|
# Copy the conf files
|
||||||
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
||||||
ynh_backup --src_path "/etc/systemd/system/${app}.service"
|
ynh_backup --src_path "/etc/systemd/system/${app}.service"
|
||||||
|
|
||||||
# Backup logs
|
# Backup logs
|
||||||
|
ynh_script_progression --message="Backing up logs..."
|
||||||
ynh_backup --src_path "/var/log/$app"
|
ynh_backup --src_path "/var/log/$app"
|
||||||
|
|
||||||
# Dump the database
|
# Dump the database
|
||||||
|
ynh_script_progression --message="Backing up database"
|
||||||
ynh_mysql_dump_db "$dbname" > ./db.sql
|
ynh_mysql_dump_db "$dbname" > ./db.sql
|
||||||
|
@ -14,7 +14,7 @@ ynh_abort_if_errors
|
|||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
cp -r /etc/yunohost/apps/${app}/conf ../ # Quick hack for https://github.com/YunoHost/yunohost/pull/427
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
@ -32,6 +32,8 @@ upstream_version=$(ynh_app_setting_get $app upstream_version)
|
|||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Updating nginx configuration..."
|
||||||
|
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
@ -48,9 +50,11 @@ fi
|
|||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
# Update gitea config
|
# Update gitea config
|
||||||
|
ynh_script_progression --message="Updating gitea configuration..."
|
||||||
config_gitea
|
config_gitea
|
||||||
|
|
||||||
# RELOAD services
|
# RELOAD services
|
||||||
|
ynh_script_progression --message="Starting services..."
|
||||||
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -a restart -t 10
|
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -a restart -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ ynh_abort_if_errors
|
|||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Validating installation parameters..."
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
||||||
@ -32,6 +34,7 @@ ynh_user_exists "$admin" \
|
|||||||
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
|
||||||
|
|
||||||
# Generate random password and key
|
# Generate random password and key
|
||||||
|
ynh_script_progression --message="Defining db password and key..."
|
||||||
dbpass=$(ynh_string_random)
|
dbpass=$(ynh_string_random)
|
||||||
key=$(ynh_string_random)
|
key=$(ynh_string_random)
|
||||||
|
|
||||||
@ -39,6 +42,7 @@ key=$(ynh_string_random)
|
|||||||
port=$(ynh_find_port 6000)
|
port=$(ynh_find_port 6000)
|
||||||
|
|
||||||
# Store Settings
|
# Store Settings
|
||||||
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set --app $app --key mysqlpwd --value $dbpass
|
ynh_app_setting_set --app $app --key mysqlpwd --value $dbpass
|
||||||
ynh_app_setting_set --app $app --key adminusername --value $admin
|
ynh_app_setting_set --app $app --key adminusername --value $admin
|
||||||
ynh_app_setting_set --app $app --key is_public --value $is_public
|
ynh_app_setting_set --app $app --key is_public --value $is_public
|
||||||
@ -49,42 +53,40 @@ ynh_app_setting_set --app $app --key web_port --value $port
|
|||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
|
||||||
# Configure init script
|
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
||||||
config_nginx
|
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
|
ynh_script_progression --message="Configuring MySQL database..."
|
||||||
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||||
|
|
||||||
# Add users
|
# Add users
|
||||||
# We can't use the official helper (for now) because we need to set the shell for the login
|
ynh_script_progression --message="Configuring system user..."
|
||||||
test getent passwd "$app" &>/dev/null || \
|
ynh_system_user_create --username= $app --home_dir=/opt/yunohost/$app --use_shell
|
||||||
useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \
|
|
||||||
ynh_die --message "Unable to create $app system account"
|
|
||||||
# Should be replaced by this when getops is available in the helper ynh_system_user_create (probably in Yunohost 3.5)
|
|
||||||
# ynh_system_user_create --username= $app --home_dir=/opt/yunohost/$app --use_shell
|
|
||||||
|
|
||||||
# create needed directories
|
# create needed directories
|
||||||
create_dir
|
create_dir
|
||||||
|
|
||||||
# Configure init script
|
# Configure init script
|
||||||
|
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
# Configure gitea with app.ini file
|
# Configure gitea with app.ini file
|
||||||
|
ynh_script_progression --message="Configuring application, step 1/2..."
|
||||||
config_gitea
|
config_gitea
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installing sources files..." --weight=10
|
||||||
|
|
||||||
# Install gitea
|
# Install gitea
|
||||||
ynh_setup_source $final_path source/$architecture
|
ynh_setup_source $final_path source/$architecture
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
ynh_script_progression --message="Protecting directory"
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
|
ynh_script_progression --message="Configuring application, step 2/2..."
|
||||||
|
|
||||||
# Start gitea for building mysql tables
|
# Start gitea for building mysql tables
|
||||||
systemctl start "$app".service
|
systemctl start "$app".service
|
||||||
|
|
||||||
@ -100,6 +102,7 @@ ynh_replace_string --match_string "__APP__" --replace_string "$app" --target_fil
|
|||||||
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ../conf/login_source.sql
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ../conf/login_source.sql
|
||||||
|
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
ynh_script_progression --message="Configuring fail2ban..."
|
||||||
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -107,18 +110,22 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Faile
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Unprotect root from SSO if public
|
# Unprotect root from SSO if public
|
||||||
|
ynh_script_progression --message="Protecting directory"
|
||||||
set_access_settings
|
set_access_settings
|
||||||
|
|
||||||
# Add gitea to YunoHost's monitored services
|
# Add gitea to YunoHost's monitored services
|
||||||
|
ynh_script_progression --message="Register gitea service..."
|
||||||
yunohost service add "$app" --log "/var/log/$app/gitea.log"
|
yunohost service add "$app" --log "/var/log/$app/gitea.log"
|
||||||
|
|
||||||
# Configure logrotate
|
# Configure logrotate
|
||||||
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate "/var/log/$app"
|
ynh_use_logrotate "/var/log/$app"
|
||||||
|
|
||||||
# Save Version
|
# Save Version
|
||||||
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
|
ynh_script_progression --message="Starting gitea services..." --weight=3
|
||||||
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
@ -11,41 +11,53 @@ source /usr/share/yunohost/helpers
|
|||||||
source ./experimental_helper.sh
|
source ./experimental_helper.sh
|
||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
|
# Retrieve domain from app settings
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Stop gitea
|
# Stop gitea
|
||||||
|
ynh_script_progression --message="Stoping services..."
|
||||||
systemctl stop "$app".service
|
systemctl stop "$app".service
|
||||||
|
|
||||||
# Drop MySQL database and user
|
# Drop MySQL database and user
|
||||||
|
ynh_script_progression --message="Removing databases..."
|
||||||
ynh_mysql_drop_db "$dbname" 2>/dev/null
|
ynh_mysql_drop_db "$dbname" 2>/dev/null
|
||||||
ynh_mysql_drop_user "$dbuser" 2>/dev/null
|
ynh_mysql_drop_user "$dbuser" 2>/dev/null
|
||||||
|
|
||||||
# Retrieve domain from app settings
|
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
||||||
|
|
||||||
# Delete app directory and configurations
|
# Delete app directory and configurations
|
||||||
|
ynh_script_progression --message="Removing code..."
|
||||||
ynh_secure_remove --file="$final_path"
|
ynh_secure_remove --file="$final_path"
|
||||||
|
ynh_script_progression --message="Removing user data..."
|
||||||
ynh_secure_remove --file="$DATADIR"
|
ynh_secure_remove --file="$DATADIR"
|
||||||
|
ynh_script_progression --message="Removing logs..."
|
||||||
ynh_secure_remove --file="/var/log/$app"
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
# Remove nginx config
|
# Remove nginx config
|
||||||
|
ynh_script_progression --message="Removing nginx configuration..."
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
|
||||||
# Remove gitea user and data
|
# Remove gitea user and data
|
||||||
|
ynh_script_progression --message="Removing the dedicated system user..."
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
# Remove init script
|
# Remove init script
|
||||||
|
ynh_script_progression --message="Removing systemd units..."
|
||||||
ynh_remove_systemd_config
|
ynh_remove_systemd_config
|
||||||
|
|
||||||
# Remove monitor
|
# Remove monitor
|
||||||
|
ynh_script_progression --message="Removing gitea service..."
|
||||||
yunohost service remove "$app"
|
yunohost service remove "$app"
|
||||||
|
|
||||||
# Remove fail2ban config
|
# Remove fail2ban config
|
||||||
|
ynh_script_progression --message="Removing fail2ban configuration..."
|
||||||
ynh_remove_fail2ban_config
|
ynh_remove_fail2ban_config
|
||||||
|
|
||||||
true # Do not fail if remove after install error
|
true # Do not fail if remove after install error
|
||||||
|
@ -14,6 +14,8 @@ ynh_abort_if_errors
|
|||||||
source ../settings/scripts/experimental_helper.sh
|
source ../settings/scripts/experimental_helper.sh
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
|
|
||||||
|
ynh_script_progression --message="Loading settings..."
|
||||||
|
|
||||||
# Retrieve old app settings
|
# Retrieve old app settings
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
path_url=$(ynh_app_setting_get --app $app --key path)
|
path_url=$(ynh_app_setting_get --app $app --key path)
|
||||||
@ -37,17 +39,15 @@ test ! -e "$final_path" || ynh_die --message "This path already contains a folde
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Add users
|
# Add users
|
||||||
# We can't use the official helper (for now) because we need to set the shell for the login
|
ynh_script_progression --message="Configuring system user..."
|
||||||
test getent passwd "$app" &>/dev/null || \
|
ynh_system_user_create --username= $app --home_dir=/opt/yunohost/$app --use_shell
|
||||||
useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \
|
|
||||||
ynh_die --message "Unable to create $app system account"
|
|
||||||
# Should be replaced by this when getops is available in the helper ynh_system_user_create (probably in Yunohost 3.5)
|
|
||||||
# ynh_system_user_create --username= $app --home_dir=/opt/yunohost/$app --use_shell
|
|
||||||
|
|
||||||
# Restore all files
|
# Restore all files
|
||||||
|
ynh_script_progression --message="Restoring files..." --weight=10
|
||||||
ynh_restore
|
ynh_restore
|
||||||
|
|
||||||
# Create and restore the database
|
# Create and restore the database
|
||||||
|
ynh_script_progression --message="Restoring database..." --weight=3
|
||||||
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
|
||||||
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
|
ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
|
||||||
|
|
||||||
@ -56,6 +56,7 @@ systemctl daemon-reload
|
|||||||
systemctl enable "$app".service
|
systemctl enable "$app".service
|
||||||
|
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
ynh_script_progression --message="Configuring fail2ban..."
|
||||||
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -63,15 +64,19 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Faile
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
ynh_script_progression --message="Protecting directory..."
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# Configure logrotate
|
# Configure logrotate
|
||||||
|
ynh_script_progression --message="Configuring log rotation..."
|
||||||
ynh_use_logrotate "/var/log/$app"
|
ynh_use_logrotate "/var/log/$app"
|
||||||
|
|
||||||
# Add gitea to YunoHost's monitored services
|
# Add gitea to YunoHost's monitored services
|
||||||
|
ynh_script_progression --message="Register gitea service..."
|
||||||
yunohost service add "$app" --log /var/log/"$app"/gitea.log
|
yunohost service add "$app" --log /var/log/"$app"/gitea.log
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
|
ynh_script_progression --message="Reloading services..."
|
||||||
systemctl reload nginx.service
|
systemctl reload nginx.service
|
||||||
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -15,6 +15,7 @@ source ./experimental_helper.sh
|
|||||||
source ./_common.sh
|
source ./_common.sh
|
||||||
|
|
||||||
# Retrieve app settings
|
# Retrieve app settings
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
|
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
|
||||||
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
@ -25,12 +26,14 @@ port=$(ynh_app_setting_get --app $app --key web_port)
|
|||||||
upstream_version=$(ynh_app_setting_get --app $app --key upstream_version)
|
upstream_version=$(ynh_app_setting_get --app $app --key upstream_version)
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop service
|
# Stop service
|
||||||
|
ynh_script_progression --message="Stoping services..."
|
||||||
systemctl stop "$app".service
|
systemctl stop "$app".service
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -83,6 +86,8 @@ fi
|
|||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Configuring application..."
|
||||||
|
|
||||||
# Clean template to fix issue : https://github.com/gogits/gogs/issues/4585
|
# Clean template to fix issue : https://github.com/gogits/gogs/issues/4585
|
||||||
ynh_secure_remove --file="/opt/$app/templates"
|
ynh_secure_remove --file="/opt/$app/templates"
|
||||||
|
|
||||||
@ -90,15 +95,19 @@ ynh_secure_remove --file="/opt/$app/templates"
|
|||||||
config_gitea
|
config_gitea
|
||||||
|
|
||||||
# Configure init script
|
# Configure init script
|
||||||
|
ynh_script_progression --message="Updating systemd units..."
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
ynh_script_progression --message="Configuring nginx..." --weight=1
|
||||||
config_nginx
|
config_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DB migration
|
# DB migration
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrading database and sources..." --weight=6
|
||||||
|
|
||||||
# Before the version 1.7 the upstream version was not stored
|
# Before the version 1.7 the upstream version was not stored
|
||||||
# The way to find the version for the install < 1.7 is to parse the binary file to find which version is installed
|
# The way to find the version for the install < 1.7 is to parse the binary file to find which version is installed
|
||||||
if [ -z ${upstream_version:-} ]; then
|
if [ -z ${upstream_version:-} ]; then
|
||||||
@ -165,6 +174,7 @@ esac
|
|||||||
ynh_setup_source $final_path source/$architecture
|
ynh_setup_source $final_path source/$architecture
|
||||||
|
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
ynh_script_progression --message="Configuring fail2ban..."
|
||||||
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -172,15 +182,18 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Faile
|
|||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Set permissions
|
# Set permissions
|
||||||
|
ynh_script_progression --message="Protecting directory"
|
||||||
set_permission
|
set_permission
|
||||||
|
|
||||||
# Save Version
|
# Save Version
|
||||||
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
||||||
|
|
||||||
# Unprotect root from SSO if public
|
# Unprotect root from SSO if public
|
||||||
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
set_access_settings
|
set_access_settings
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
|
ynh_script_progression --message="Starting gitea services..." --weight=3
|
||||||
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user