Merge branch 'testing' into master

This commit is contained in:
Josué Tille 2021-02-14 15:16:19 +01:00
commit 46b612b153
No known key found for this signature in database
GPG Key ID: 716A6C99B04194EF
33 changed files with 218 additions and 189 deletions

View File

@ -3,7 +3,7 @@ Gitea package for YunoHost
[![Integration level](https://dash.yunohost.org/integration/gitea.svg)](https://dash.yunohost.org/appci/app/gitea) ![](https://ci-apps.yunohost.org/ci/badges/gitea.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/gitea.maintain.svg)
[![Install gitea with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=gitea)
[![Install gitea with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=gitea)
> *This package allow you to install gitea quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
@ -13,7 +13,7 @@ Overview
Gitea is a fork of Gogs a self-hosted Git service written in Go. Alternative to Github.
**Shipped version:** 1.12.6
**Shipped version:** 1.13.1
Screenshots
-----------
@ -68,9 +68,43 @@ Host domain.tld
port 2222 # change this with the port you use
```
Architecture: this package is compatible with amd64, i386 and arm. The package will try to detect it with the command uname -m and fail if it can't detect the architecture. If that happens please open an issue describing your hardware and the result of the command `uname -m`.
### Upgrade
By default a backup is made before the upgrade. To avoid this you have theses following possibilites:
- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade gitea`.
- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command:
`yunohost app setting gitea disable_backup_before_upgrade -v 1`
After this settings will be applied for **all** next upgrade.
From command line:
`yunohost app upgrade seafile`
### Backup
This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this:
- Stop gitea service with theses following command:
`systemctl stop gitea.service`
- Launch the backup of gitea with this following command:
`yunohost backup create --app gitea`
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is generally stored in `/home/gitea`.
- Restart the gitea service with theses command:
`systemctl start gitea.service`
### Remove
Due of the backup core only feature the data directory in `/home/gitea` **is not removed**. It need to be removed manually to purge app user data.
### LFS setup
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
```ini

View File

@ -19,18 +19,6 @@
incorrect_path=0
port_already_use=1 (6000)
change_url=1
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# https://github.com/YunoHost-Apps/gitea_ynh/blob/master/conf/login_source.sql
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Upgrade options
; commit=349992d4f3921e4e1adb37a0cace4a5a9eb67099
name=First package version

View File

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-arm-6
SOURCE_SUM=116caba20b596886b03309df0e319a5885ee72e3740e62ac488e4e38f424ca88
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.13.1/gitea-1.13.1-linux-arm-6
SOURCE_SUM=7073237cc7c03af2fd407b3e0284a71e3a3bd31e9f5737eb00a670a841afe700
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

5
conf/source/arm64.src Normal file
View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.13.0/gitea-1.13.0-linux-arm64
SOURCE_SUM=630881e79b18580e81d998c93ad81cc4e44204fb4391c787e07706406fbbb709
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.0.2/gitea-1.0.2-linux-arm64
SOURCE_SUM=b13562f19c41602d2b4f1601931e9d150de8273682969c081a4a5029622eb8b3
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.1.4/gitea-1.1.4-linux-arm64
SOURCE_SUM=3f7a01669bbad671907942cece744f12390a37771fd8e1142afffeb9ee1f31f7
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.10.3/gitea-1.10.3-linux-arm64
SOURCE_SUM=3a0b6470a205c6b9f19a8b31469728f29818c58dd17e85a81ac4a928ab9f9512
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.11.7/gitea-1.11.7-linux-arm64
SOURCE_SUM=71bc3b41955461491ca3b1a1e4abeaf70dc0cbd15e43e59e2178514b8f1ef0f8
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-arm64
SOURCE_SUM=b1e4620191d817b6d6975358c35197bf659bce04a5690bea2d1e6511054d0866
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.2.3/gitea-1.2.3-linux-arm64
SOURCE_SUM=e779d43f2050c43138509a40540bdd4d16a11e8b76a6f66b447623ead6466fca
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.3.3/gitea-1.3.3-linux-arm64
SOURCE_SUM=348993e5fd119b6708b96a29067ddc41d8fefe4c0d5abf540d1e89e9886202ce
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.4.3/gitea-1.4.3-linux-arm64
SOURCE_SUM=af6a55516b94f5bfb7a9744086bd92124e6cba8c3d610935e5fe4c8ba42427ef
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.5.3/gitea-1.5.3-linux-arm64
SOURCE_SUM=cdddf46e1711c7964cfd18b4ae37109d4865996b26426d4badaa78da969cfbae
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.6.4/gitea-1.6.4-linux-arm64
SOURCE_SUM=30252ca0adf170e84f52499a502195ad762f4fdca941f40ded80292790eaa2d3
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.7.3/gitea-1.7.3-linux-arm64
SOURCE_SUM=dc34250ddbcdf3096a7355db419fff615d7fd488e0336bec9bc880091f549c23
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.8.3/gitea-1.8.3-linux-arm64
SOURCE_SUM=e3569745122a793dbf1e86940a00c8843c0c3022513a9d9004593823b9e6abe1
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.9.6/gitea-1.9.6-linux-arm64
SOURCE_SUM=f11e46fdca921e81255c4b052969e5c6085f24245e6e0da726c9627aaec78252
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

5
conf/source/arm_1.12.src Normal file
View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-arm-6
SOURCE_SUM=116caba20b596886b03309df0e319a5885ee72e3740e62ac488e4e38f424ca88
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -1,8 +1,8 @@
# The armv7 build is brocken
# See : https://github.com/go-gitea/gitea/issues/6700
# Use temporary the armv6 binary
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-arm-6
SOURCE_SUM=116caba20b596886b03309df0e319a5885ee72e3740e62ac488e4e38f424ca88
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.13.1/gitea-1.13.1-linux-arm-6
SOURCE_SUM=7073237cc7c03af2fd407b3e0284a71e3a3bd31e9f5737eb00a670a841afe700
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,8 @@
# The armv7 build is brocken
# See : https://github.com/go-gitea/gitea/issues/6700
# Use temporary the armv6 binary
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-arm-6
SOURCE_SUM=116caba20b596886b03309df0e319a5885ee72e3740e62ac488e4e38f424ca88
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-386
SOURCE_SUM=de287e912b32b0617e538f4c9c8d263fc16b5e2ba0b76ea9ab018011e9943316
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.13.1/gitea-1.13.1-linux-386
SOURCE_SUM=0e32aa4d1d092fd9e839e03625668fed3f85f3ea31aa64b05c38490c6c944dc8
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-386
SOURCE_SUM=de287e912b32b0617e538f4c9c8d263fc16b5e2ba0b76ea9ab018011e9943316
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-amd64
SOURCE_SUM=74417bc8e950b685de79c3a39655029f28d27c99e94adbe83c0ec22325d8771f
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.13.1/gitea-1.13.1-linux-amd64
SOURCE_SUM=8d017378137a2e829caaed93b4cef0975c3307b5af069e4b004d083520488d21
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/go-gitea/gitea/releases/download/v1.12.6/gitea-1.12.6-linux-amd64
SOURCE_SUM=74417bc8e950b685de79c3a39655029f28d27c99e94adbe83c0ec22325d8771f
SOURCE_SUM_PRG=sha256sum
SOURCE_FILENAME=gitea
SOURCE_EXTRACT=false

View File

@ -8,7 +8,7 @@
},
"url": "http://gitea.io",
"license": "MIT",
"version": "1.12.6~ynh1",
"version": "1.13.1~ynh1",
"maintainer": {
"name": "rafi59",
"email": "rafi59_dev@srvmaison.fr.nf"

View File

@ -14,14 +14,16 @@ SSH_PATH="$DATADIR/.ssh"
# Detect the system architecture to download the right tarball
# NOTE: `uname -m` is more accurate and universal than `arch`
# See https://en.wikipedia.org/wiki/Uname
if [ -n "$(uname -m | grep 64)" ]; then
architecture="x86-64"
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="x86-64"
elif [ -n "$(uname -m | grep 86)" ]; then
architecture="i386"
architecture="i386"
elif [ -n "$(uname -m | grep armv7)" ]; then
architecture="armv7"
architecture="armv7"
elif [ -n "$(uname -m | grep arm)" ]; then
architecture="arm"
architecture="arm"
else
ynh_die --message "Unable to detect your achitecture, please open a bug describing \
your hardware and the result of the command \"uname -m\"." 1

View File

@ -4,44 +4,48 @@
# GENERIC START
#=================================================
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
# Retrieve app settings
ynh_script_progression --message="Loading installation settings..."
ynh_print_info --message="Loading installation settings..."
domain=$(ynh_app_setting_get --app $app --key domain)
if [[ ! "$(systemctl status $app.service)" =~ "Active: inactive (dead)" ]]; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service and with this command before to run the backup 'systemctl stop $app.service'"
fi
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# Copy the app source files
ynh_script_progression --message="Backing up code..." --weight=3
ynh_print_info --message="Backing up code..."
ynh_backup --src_path "$final_path"
# Copy the data files
ynh_script_progression --message="Backing up user data..." --weight=10
ynh_backup --src_path "$DATADIR"
ynh_print_info --message="Backing up user data..."
ynh_backup --src_path "$DATADIR" --is_big=1
ynh_script_progression --message="Backing up configuration..."
ynh_print_info --message="Backing up configuration..."
# Copy the conf files
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup --src_path "/etc/systemd/system/${app}.service"
# Backup logs
ynh_script_progression --message="Backing up logs..."
ynh_print_info --message="Backing up logs..."
ynh_backup --src_path "/var/log/$app"
# Dump the database
ynh_script_progression --message="Backing up database"
ynh_print_info --message="Backing up database"
ynh_mysql_dump_db "$dbname" > ./db.sql
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View File

@ -4,16 +4,16 @@
# GENERIC START
#=================================================
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
ynh_script_progression --message="Loading installation settings..."
# RETRIEVE ARGUMENTS

View File

@ -1,82 +1,3 @@
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
#
# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]
# | arg: -n, --service_name= - Name of the service to reload. Default : $app
# | arg: -a, --action= - Action to perform with systemctl. Default: start
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot.
# If not defined it don't wait until the service is completely started.
# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
# | arg: -e, --length= - Length of the error log : Default : 20
ynh_systemd_action() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
local service_name
local action
local line_match
local length
local log_path
local timeout
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local service_name="${service_name:-$app}"
local action=${action:-start}
local log_path="${log_path:-/var/log/$service_name/$service_name.log}"
local length=${length:-20}
local timeout=${timeout:-300}
# Start to read the log
if [[ -n "${line_match:-}" ]]
then
local templog="$(mktemp)"
# Following the starting of the app in its log
if [ "$log_path" == "systemd" ] ; then
# Read the systemd journal
journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" &
else
# Read the specified log file
tail -F -n0 "$log_path" > "$templog" &
fi
# Get the PID of the tail command
local pid_tail=$!
fi
echo "${action^} the service $service_name" >&2
systemctl $action $service_name \
|| ( journalctl --lines=$length -u $service_name >&2 \
; test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
; false )
# Start the timeout and try to find line_match
if [[ -n "${line_match:-}" ]]
then
local i=0
for i in $(seq 1 $timeout)
do
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
if grep --quiet "$line_match" "$templog"
then
echo "The service $service_name has correctly started." >&2
break
fi
echo -n "." >&2
sleep 1
done
if [ $i -eq $timeout ]
then
echo "The service $service_name didn't fully started before the timeout." >&2
echo "Please find here an extract of the end of the log of the service $service_name:"
journalctl --lines=$length -u $service_name >&2
test -e "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
fi
echo ""
ynh_clean_check_starting
fi
}
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
@ -334,39 +255,3 @@ ynh_handle_app_migration () {
migration_process=1
fi
}
# Verify the checksum and backup the file if it's different
# This helper is primarily meant to allow to easily backup personalised/manually
# modified config files.
#
# $app should be defined when calling this helper
#
# usage: ynh_backup_if_checksum_is_different --file=file
# | arg: -f, --file - The file on which the checksum test will be perfomed.
# | ret: the name of a backup file, or nothing
#
# Requires YunoHost version 2.6.4 or higher.
ynh_backup_if_checksum_is_different () {
# Declare an array to define the options of this helper.
local legacy_args=f
declare -Ar args_array=( [f]=file= )
local file
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local checksum_setting_name=checksum_${file//[\/ ]/_} # Replace all '/' and ' ' by '_'
local checksum_value=$(ynh_app_setting_get --app=$app --key=$checksum_setting_name)
# backup_file_checksum isn't declare as local, so it can be reuse by ynh_store_file_checksum
backup_file_checksum=""
if [ -n "$checksum_value" ]
then # Proceed only if a value was stored into the app settings
if [ -e $file ] && ! echo "$checksum_value $file" | sudo md5sum -c --status
then # If the checksum is now different
backup_file_checksum="/home/yunohost.conf/backup/$file.backup.$(date '+%Y%m%d.%H%M%S')"
sudo mkdir -p "$(dirname "$backup_file_checksum")"
sudo cp -a "$file" "$backup_file_checksum" # Backup the current file
ynh_print_warn "File $file has been manually modified since the installation or last upgrade. So it has been duplicated in $backup_file_checksum"
echo "$backup_file_checksum" # Return the name of the backup file
fi
fi
}

View File

@ -4,21 +4,21 @@
# GENERIC START
#=================================================
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
ynh_script_progression --message="Validating installation parameters..."
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH)
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
upstream_version=$(ynh_app_upstream_version)
@ -33,6 +33,12 @@ ynh_user_exists "$admin" \
# Check Final Path availability
test ! -e "$final_path" || ynh_die --message "This path already contains a folder"
if [ -e "$DATADIR" ]; then
old_data_dir_path="$DATADIR$(date '+%Y%m%d.%H%M%S')"
ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path"
mv "$DATADIR" "$old_data_dir_path"
fi
# Generate random password and key
ynh_script_progression --message="Defining db password and key..."
dbpass=$(ynh_string_random)

View File

@ -4,13 +4,13 @@
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
# Retrieve domain from app settings
@ -32,8 +32,6 @@ ynh_mysql_drop_user "$dbuser" 2>/dev/null
# Delete app directory and configurations
ynh_script_progression --message="Removing code..."
ynh_secure_remove --file="$final_path"
ynh_script_progression --message="Removing user data..."
ynh_secure_remove --file="$DATADIR"
ynh_script_progression --message="Removing logs..."
ynh_secure_remove --file="/var/log/$app"
@ -60,4 +58,7 @@ yunohost service remove "$app"
ynh_script_progression --message="Removing fail2ban configuration..."
ynh_remove_fail2ban_config
ynh_print_info --message="Due of the backup core only feature the data directory in '$DATADIR' was not removed. It need to be removed manually to purge app user data."
ynh_script_progression --message="Removal of $app completed" --last
sleep 1

View File

@ -4,16 +4,16 @@
# GENERIC START
#=================================================
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
ynh_script_progression --message="Loading settings..."
# Retrieve old app settings
@ -53,7 +53,7 @@ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./db.sql
# Restore systemd files
systemctl daemon-reload
systemctl enable "$app".service
systemctl enable "$app".service --quiet
# SETUP FAIL2BAN
ynh_script_progression --message="Configuring fail2ban..."

View File

@ -4,16 +4,16 @@
# GENERIC START
#=================================================
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Load common variables and helpers
source ./experimental_helper.sh
source ./_common.sh
# Retrieve app settings
ynh_script_progression --message="Loading installation settings..."
domain=$(ynh_app_setting_get --app $app --key domain)
@ -25,16 +25,24 @@ is_public=$(ynh_app_setting_get --app $app --key is_public)
port=$(ynh_app_setting_get --app $app --key web_port)
upstream_version=$(ynh_app_setting_get --app $app --key upstream_version)
# Backup the current version of the app
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_restore_upgradebackup
}
# Stop service
ynh_script_progression --message="Stoping services..."
systemctl stop "$app".service
# We stop the service before to set ynh_clean_setup
ynh_systemd_action --service_name=$app.service --action=stop
# Backup the current version of the app
if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ]
then
ynh_backup_before_upgrade
ynh_clean_setup () {
# Clean installation remainings that are not handled by the remove script.
ynh_clean_check_starting
ynh_restore_upgradebackup
}
fi
#=================================================
# MIGRATION FROM GOGS
@ -43,7 +51,7 @@ systemctl stop "$app".service
[[ $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_handle_app_migration gogs gogs_migrations
ynh_handle_app_migration --migration_id=gogs --migration_list=gogs_migrations
if [[ $migration_process -eq 1 ]]; then
# Reload variables
@ -121,7 +129,7 @@ fi
restart_gitea() {
# Set permissions
set_permission
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "systemd"
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 30
# Leave the time to update the database schema
sleep 5
systemctl stop $app
@ -179,6 +187,10 @@ case $upstream_version in
ynh_setup_source $final_path source/${architecture}_1.11
restart_gitea
;&
"1.11."* )
ynh_setup_source $final_path source/${architecture}_1.12
restart_gitea
;&
esac
# Install gitea source
@ -206,6 +218,10 @@ then
ynh_permission_update --permission "main" --add "visitors"
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"
# Set permissions
ynh_script_progression --message="Protecting directory"
set_permission