Merge branch 'testing' into LFS

This commit is contained in:
ericgaspar 2022-07-25 07:51:39 +02:00
commit a218277579
4 changed files with 31 additions and 27 deletions

View File

@ -1,9 +1,9 @@
;; General
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -12,6 +12,8 @@
setup_private=1
setup_public=1
upgrade=1
#1.14.5
upgrade=1 from_commit=7ea357724f2371aa1173f15ba5a7502609a0a131
upgrade=1 from_commit=349992d4f3921e4e1adb37a0cace4a5a9eb67099
upgrade=1 from_commit=4e078e91129725c8b09ba551ab2a04e0328a45b3
backup_restore=1
@ -20,6 +22,8 @@
port_already_use=1 (6000)
change_url=1
;;; Upgrade options
; commit=7ea357724f2371aa1173f15ba5a7502609a0a131
name=1.14.5
; commit=349992d4f3921e4e1adb37a0cace4a5a9eb67099
name=First package version
; commit=4e078e91129725c8b09ba551ab2a04e0328a45b3

View File

@ -129,8 +129,8 @@ ynh_script_progression --message="Configuring permissions"
ynh_permission_create --permission="admin" --allowed=$admin
# Add gitea to YunoHost's monitored services
ynh_script_progression --message="Register gitea service..."
yunohost service add "$app" --log "/var/log/$app/gitea.log"
ynh_script_progression --message="Register Gitea service..."
yunohost service add "$app" --log="/var/log/$app/gitea.log"
# Configure logrotate
ynh_script_progression --message="Configuring log rotation..."
@ -141,8 +141,8 @@ ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream
# Reload services
ynh_script_progression --message="Starting gitea services..." --weight=3
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
sleep 1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
# Store the checksum with the 'INTERNAL_TOKEN' value.
# Should be removed when the issue https://github.com/go-gitea/gitea/issues/3246 is fixed

View File

@ -69,8 +69,8 @@ ynh_script_progression --message="Configuring log rotation..."
ynh_use_logrotate --logfile "/var/log/$app"
# Add gitea to YunoHost's monitored services
ynh_script_progression --message="Register gitea service..."
yunohost service add "$app" --log /var/log/"$app"/gitea.log
ynh_script_progression --message="Register Gitea service..."
yunohost service add "$app" --log=/var/log/$app/gitea.log
# Reload services
ynh_script_progression --message="Reloading services..."

View File

@ -68,7 +68,7 @@ fi
[[ $YNH_APP_ID == "gogs" ]] \
&& [[ "$(cat "/opt/$app/templates/.VERSION")" != 0.11.79.1211 ]] \
&& ynh_die --message "It look like that you have an old gogs install. You need first upgrade gogs instance (id : $gogs_migrate_id) and after migrate to gitea."
&& ynh_die --message "It look like that you have an old Gogs install. You need first upgrade Gogs instance (id: $gogs_migrate_id) and after migrate to Gitea."
ynh_handle_app_migration --migration_id=gogs --migration_list=gogs_migrations
if [[ $migration_process -eq 1 ]]; then
@ -127,14 +127,13 @@ config_gitea
ynh_script_progression --message="Updating systemd units..."
ynh_add_systemd_config
# Modify Nginx configuration file and copy it to Nginx conf directory
ynh_script_progression --message="Configuring nginx..." --weight=1
# Modify Nginx configuration file and copy it to NGINX conf directory
ynh_script_progression --message="Configuring NGINX..." --weight=1
config_nginx
#=================================================
# DB migration
#=================================================
ynh_script_progression --message="Upgrading database and sources..." --weight=6
# Before the version 1.7 the upstream version was not stored
@ -151,7 +150,7 @@ fi
restart_gitea() {
# Set permissions
set_permission
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
# Leave the time to update the database schema
sleep 5
systemctl stop $app
@ -232,8 +231,8 @@ ynh_setup_source $final_path source/$architecture
restart_gitea
# 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_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
#=================================================
# GENERIC FINALIZATION
@ -243,15 +242,15 @@ ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Faile
ynh_script_progression --message="Update permission..."
if ! ynh_permission_exists --permission admin; then
ynh_app_setting_delete --app $app --key unprotected_uris
ynh_permission_create --permission 'admin' --allowed "$admin"
ynh_permission_create --permission="admin" --allowed="$admin"
# Update ldap config
ynh_replace_string --match_string "__APP__" --replace_string "$app" --target_file ../conf/login_source.sql
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/login_source.sql"
ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql
fi
# Add gitea to YunoHost's monitored services
ynh_script_progression --message="Register gitea service..."
yunohost service add "$app" --log "/var/log/$app/gitea.log"
ynh_script_progression --message="Register Gitea service..."
yunohost service add "$app" --log="/var/log/$app/gitea.log"
# Add ssh permission for gitea user
adduser $app ssh.app
@ -261,23 +260,24 @@ ynh_script_progression --message="Protecting directory"
set_permission
# 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
ynh_script_progression --message="Starting gitea services..." --weight=3
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
sleep 1
ynh_script_progression --message="Starting Gitea services..." --weight=3
#ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
#sleep 1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
# Store the checksum with the 'INTERNAL_TOKEN' value.
# Should be removed when the issue https://github.com/go-gitea/gitea/issues/3246 is fixed
ynh_store_file_checksum --file "$final_path/custom/conf/app.ini"
ynh_store_file_checksum --file="$final_path/custom/conf/app.ini"
#=================================================
# FINISH MIGRATION PROCESS
#=================================================
if [[ $migration_process -eq 1 ]]; then
echo "gogs has been successfully migrated to Gitea! \
echo "Gogs has been successfully migrated to Gitea! \
A last scheduled operation will run in a couple of minutes to finish the \
migration in YunoHost side. Do not proceed any application operation while \
you don't see Gogs as installed." >&2