diff --git a/README.md b/README.md index 422ca6a..93139d9 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It shall NOT be edited by hand. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**Shipped version:** 1.21.5~ynh1 +**Shipped version:** 1.22.0~ynh1 ## Screenshots diff --git a/README_es.md b/README_es.md index 17bb059..f2a2e34 100644 --- a/README_es.md +++ b/README_es.md @@ -19,7 +19,7 @@ No se debe editar a mano. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**Versión actual:** 1.21.5~ynh1 +**Versión actual:** 1.22.0~ynh1 ## Capturas diff --git a/README_eu.md b/README_eu.md index 5e30caa..736c4ff 100644 --- a/README_eu.md +++ b/README_eu.md @@ -19,7 +19,8 @@ EZ editatu eskuz. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**Paketatutako bertsioa:** 1.21.5~ynh1 +**Paketatutako bertsioa:** 1.22.0~ynh1 + ## Pantaila-argazkiak diff --git a/README_fr.md b/README_fr.md index 48ba703..a94535c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,8 @@ Il NE doit PAS être modifié à la main. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**Version incluse :** 1.21.5~ynh1 + +**Version incluse :** 1.22.0~ynh1 ## Captures d’écran diff --git a/README_gl.md b/README_gl.md index 0c422a4..fdc96f9 100644 --- a/README_gl.md +++ b/README_gl.md @@ -19,7 +19,8 @@ NON debe editarse manualmente. Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**Versión proporcionada:** 1.21.5~ynh1 +**Versión proporcionada:** 1.22.0~ynh1 + ## Capturas de pantalla diff --git a/README_zh_Hans.md b/README_zh_Hans.md index fea7878..b8d62d4 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -19,7 +19,9 @@ Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to GitHub. -**分发版本:** 1.21.5~ynh1 + +**分发版本:** 1.22.0~ynh1 + ## 截图 diff --git a/manifest.toml b/manifest.toml index d217d29..9a5057d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Gitea" description.en = "Lightweight Git forge" description.fr = "Forge Git légère" -version = "1.21.5~ynh1" +version = "1.22.0~ynh1" maintainers = ["Josué Tille"] # previous_maintainers = [ @@ -32,7 +32,8 @@ architectures = [ ] multi_instance = true ldap = true -sso = true +# reverse proxy authentication disabled until https://github.com/go-gitea/gitea/pull/18452 is merged +sso = false disk = "120M" ram.build = "0M" ram.runtime = "100M" @@ -66,14 +67,14 @@ ram.runtime = "100M" extract = false rename = "gitea" - armhf.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-arm-6" - armhf.sha256 = "a531726f695aeb6bed4d69827e56e78e22fd0e4134b02b08edbc31c50c7e8735" - arm64.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-arm64" - arm64.sha256 = "55d132cfb7016984773029abc8d1d8e9d844138f5e4c8ff8df273b55aa2190f3" - i386.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-386" - i386.sha256 = "fbfde0506c100cc5e86a42c4eb73907d37be417df493a9b57400a0df55cafb14" - amd64.url = "https://github.com/go-gitea/gitea/releases/download/v1.21.5/gitea-1.21.5-linux-amd64" - amd64.sha256 = "7a521914203b07c7a0613ae30d8ab229111b149a2fa219423e643cd9a039256e" + armhf.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-arm-6" + armhf.sha256 = "a3881b9d065977923c5646547f1e80e71cffa503d81f08d70ec0419556ffd402" + arm64.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-arm64" + arm64.sha256 = "ef6afed370b14d33b2b8dcc0c7ea56105b73ce9a3361090708985a878475d94b" + i386.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-386" + i386.sha256 = "b320cf3a853389b3159ccd611af3bd9f4d96b843bf8eda67613760aa8d566d4d" + amd64.url = "https://github.com/go-gitea/gitea/releases/download/v1.22.0/gitea-1.22.0-linux-amd64" + amd64.sha256 = "a31086f073cb9592d28611394b2de3655db515d961e4fdcf5b549cb40753ef3d" autoupdate.strategy = "latest_github_release" autoupdate.asset.armhf = "^gitea-.*-linux-arm-6$" diff --git a/scripts/_common.sh b/scripts/_common.sh index 8702cf6..281512f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ #================================================= systemd_match_start_line='Starting new Web server: tcp:127.0.0.1:' -ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") +ssh_port="$(yunohost settings get security.ssh.ssh_port)" #================================================= # DEFINE ALL COMMON FONCTIONS @@ -15,10 +15,10 @@ _set_permissions() { chmod +x "$install_dir/gitea" chown -R "$app:$app" "$data_dir" - find $data_dir \( \! -perm -o= \ - -o \! -user $app \ - -o \! -group $app \) \ - -exec chown $app:$app {} \; \ + find "$data_dir" \( \! -perm -o= \ + -o \! -user "$app" \ + -o \! -group "$app" \) \ + -exec chown "$app:$app" {} \; \ -exec chmod u=rwX,g=rX,o= {} \; chmod -R u=rwX,g=,o= "$data_dir/.ssh" diff --git a/scripts/backup b/scripts/backup index 294d4ca..b413ff1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -9,7 +9,7 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -if [[ ! "$(systemctl status $app.service)" =~ 'Active: inactive (dead)' ]]; then +if systemctl is-active "$app".service --quiet; then ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service with this command before to run the backup 'systemctl stop $app.service'" fi @@ -19,23 +19,23 @@ fi ynh_print_info --message='Declaring files to be backed up...' # Copy the app source files -ynh_backup --src_path "$install_dir" +ynh_backup --src_path="$install_dir" # Copy the data files -ynh_backup --src_path "$data_dir" --is_big=1 +ynh_backup --src_path="$data_dir" --is_big=1 # 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/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" ynh_backup --src_path="/etc/logrotate.d/$app" -ynh_backup --src_path "/etc/systemd/system/$app.service" +ynh_backup --src_path="/etc/systemd/system/$app.service" # Backup logs -ynh_backup --src_path "/var/log/$app" +ynh_backup --src_path="/var/log/$app" # Dump the database ynh_print_info --message="Backing up the MySQL database" diff --git a/scripts/install b/scripts/install index 8ed9a0d..5ea75e6 100644 --- a/scripts/install +++ b/scripts/install @@ -17,10 +17,10 @@ source /usr/share/yunohost/helpers ynh_script_progression --message='Creating base directory...' -if [ -n "$(ls -A $data_dir)" ]; then +if [ -n "$(ls -A "$data_dir")" ]; then old_data_dir_path="${data_dir}_$(date '+%Y%m%d.%H%M%S')" ynh_print_warn "Data directory was not empty. Data was moved to $old_data_dir_path" - mkdir -p $old_data_dir_path + mkdir -p "$old_data_dir_path" mv -t "$old_data_dir_path" "$data_dir"/* fi @@ -42,15 +42,15 @@ _set_permissions ynh_script_progression --message="Configuring application, step 1/2..." -internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) -secret_key=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY) -lfs_jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) -jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) +internal_token="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN)" +secret_key="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY)" +lfs_jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)" +jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)" ynh_app_setting_set --app="$app" --key=internal_token --value="$internal_token" ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key" ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret" -ynh_app_setting_set --app "$app" --key jwt_secret --value="$jwt_secret" +ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret" ynh_add_config --template='app.ini' --destination="$install_dir/custom/conf/app.ini" @@ -69,7 +69,7 @@ ynh_add_systemd_config yunohost service add "$app" --log="/var/log/$app/gitea.log" # Configure logrotate -ynh_use_logrotate --logfile "/var/log/$app" +ynh_use_logrotate --logfile="/var/log/$app" # Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex='.*Failed authentication attempt for .* from ' --max_retry=5 diff --git a/scripts/restore b/scripts/restore index 1fd0b31..32211bb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,7 @@ yunohost service add "$app" --log="/var/log/$app/gitea.log" # SETUP FAIL2BAN ynh_script_progression --message="Configuring fail2ban..." -ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from " --max_retry 5 +ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from " --max_retry=5 #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 3200a9b..0d3cfa0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,7 @@ source _common.sh source /usr/share/yunohost/helpers -upgrade_type=$(ynh_check_app_version_changed) +upgrade_type="$(ynh_check_app_version_changed)" #================================================= # STANDARD UPGRADE STEPS @@ -18,11 +18,11 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message='Ensuring downward compatibility...' --weight=1 -if ynh_compare_current_package_version --comparison lt --version "1.6.4~ynh1"; then +if ynh_compare_current_package_version --comparison=lt --version="1.6.4~ynh1"; then message="Upgrade from $YNH_APP_CURRENT_VERSION was dropped. You need to run this, then upgrade to the latest version: sudo yunohost app upgrade $app -u https://github.com/YunoHost-Apps/gitea_ynh/commit/a9ceb157032ae2290e944c1d0a255451ff2d133d" ynh_print_info "$message" - ynh_die --message="$message" --ret_code 1 + ynh_die --message="$message" --ret_code=1 fi #================================================= @@ -53,8 +53,9 @@ if [ ~"$app" != "$data_dir" ]; then usermod --home "$data_dir" "$app" fi -# Ensure secrets are defined -ynh_setup_source --dest_dir="$install_dir" --source_id=main +if [ "$upgrade_type" == UPGRADE_APP ]; then + ynh_setup_source --dest_dir="$install_dir" --source_id=main --full_replace=1 --keep=custom +fi #================================================= # MIGRATION STEP 2 (Set undefined Vars) @@ -68,36 +69,36 @@ chmod -R u=rwX,g=rX,o= "$install_dir" chmod +x "$install_dir/gitea" if [[ -z "${internal_token:-}" ]]; then - internal_token=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN) - ynh_app_setting_set --app "$app" --key internal_token --value="$internal_token" + internal_token="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret INTERNAL_TOKEN)" + ynh_app_setting_set --app="$app" --key=internal_token --value="$internal_token" fi if [[ -z "${secret_key:-}" ]]; then - secret_key=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY) - ynh_app_setting_set --app "$app" --key secret_key --value="$secret_key" + secret_key="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret SECRET_KEY)" + ynh_app_setting_set --app="$app" --key=secret_key --value="$secret_key" fi if [[ -n "${lfs_key:-}" ]]; then lfs_jwt_secret="$lfs_key" - ynh_app_setting_delete --app "$app" --key lfs_key - ynh_app_setting_set --app "$app" --key lfs_jwt_secret --value="$lfs_jwt_secret" + ynh_app_setting_delete --app="$app" --key=lfs_key + ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret" fi if [[ -z "${lfs_jwt_secret:-}" ]]; then - lfs_jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) - ynh_app_setting_set --app "$app" --key lfs_jwt_secret --value="$lfs_jwt_secret" + lfs_jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)" + ynh_app_setting_set --app="$app" --key=lfs_jwt_secret --value="$lfs_jwt_secret" fi if [[ -z "${jwt_secret:-}" ]]; then - jwt_secret=$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET) - ynh_app_setting_set --app "$app" --key jwt_secret --value="$jwt_secret" + jwt_secret="$(ynh_exec_as "$app" "$install_dir/gitea" generate secret JWT_SECRET)" + ynh_app_setting_set --app="$app" --key=jwt_secret --value="$jwt_secret" fi #================================================= # MIGRATION STEP Fix regression linked to 77c3678 and #76 #================================================= -list_param_sql=$(yunohost user list --output-as json | jq -c '.users | keys' | sed 's|\[|\(|' | sed 's|\]|\)|') +list_param_sql="$(yunohost user list --output-as json | jq -c '.users | keys' | sed 's|\[|\(|' | sed 's|\]|\)|')" ynh_replace_string --match_string=__APP__ --replace_string="$app" --target_file=./fix_user_db_for_local_users.sql ynh_replace_string --match_string=__USER_LIST__ --replace_string="$list_param_sql" --target_file=./fix_user_db_for_local_users.sql ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ./fix_user_db_for_local_users.sql @@ -139,7 +140,7 @@ yunohost service add "$app" --log="/var/log/$app/gitea.log" ynh_use_logrotate --non-append -ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from " --max_retry 5 +ynh_add_fail2ban_config --logpath="/var/log/$app/gitea.log" --failregex=".*Failed authentication attempt for .* from " --max_retry=5 #================================================= # START SYSTEMD SERVICE