mirror of
https://framagit.org/YunoHost-Apps/gitea_ynh.git
synced 2024-11-21 18:41:35 +01:00
Fix install and fix linter
This commit is contained in:
parent
56ca616017
commit
4c0f81b035
@ -37,7 +37,7 @@ If you want to use Gitea with ssh and be able to pull/push with you ssh key, you
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
PubkeyAuthentication yes
|
PubkeyAuthentication yes
|
||||||
AuthorizedKeysFile /home/%u/.ssh/authorized_keys
|
AuthorizedKeysFile /home/yunohost.app/%u/.ssh/authorized_keys
|
||||||
ChallengeResponseAuthentication no
|
ChallengeResponseAuthentication no
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
UsePAM no
|
UsePAM no
|
||||||
@ -78,14 +78,14 @@ This app use now the core-only feature of the backup. To keep the integrity of t
|
|||||||
|
|
||||||
`yunohost backup create --app gitea`
|
`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`.
|
- 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/yunohost.app/gitea`.
|
||||||
- Restart the gitea service with theses command:
|
- Restart the gitea service with theses command:
|
||||||
|
|
||||||
`systemctl start gitea.service`
|
`systemctl start gitea.service`
|
||||||
|
|
||||||
### Remove
|
### 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.
|
Due of the backup core only feature the data directory in `/home/yunohost.app/gitea` **is not removed**. It need to be removed manually to purge app user data.
|
||||||
|
|
||||||
### LFS setup
|
### LFS setup
|
||||||
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
||||||
@ -125,4 +125,4 @@ or
|
|||||||
sudo yunohost app upgrade gitea -u https://github.com/YunoHost-Apps/gitea_ynh/tree/testing --debug
|
sudo yunohost app upgrade gitea -u https://github.com/YunoHost-Apps/gitea_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||||
|
@ -33,7 +33,7 @@ If you want to use Gitea with ssh and be able to pull/push with you ssh key, you
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
PubkeyAuthentication yes
|
PubkeyAuthentication yes
|
||||||
AuthorizedKeysFile /home/%u/.ssh/authorized_keys
|
AuthorizedKeysFile /home/yunohost.app/%u/.ssh/authorized_keys
|
||||||
ChallengeResponseAuthentication no
|
ChallengeResponseAuthentication no
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
UsePAM no
|
UsePAM no
|
||||||
@ -74,14 +74,14 @@ This app use now the core-only feature of the backup. To keep the integrity of t
|
|||||||
|
|
||||||
`yunohost backup create --app gitea`
|
`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`.
|
- 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/yunohost.app/gitea`.
|
||||||
- Restart the gitea service with theses command:
|
- Restart the gitea service with theses command:
|
||||||
|
|
||||||
`systemctl start gitea.service`
|
`systemctl start gitea.service`
|
||||||
|
|
||||||
### Remove
|
### 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.
|
Due of the backup core only feature the data directory in `/home/yunohost.app/gitea` **is not removed**. It need to be removed manually to purge app user data.
|
||||||
|
|
||||||
### LFS setup
|
### LFS setup
|
||||||
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
||||||
@ -121,4 +121,4 @@ ou
|
|||||||
sudo yunohost app upgrade gitea -u https://github.com/YunoHost-Apps/gitea_ynh/tree/testing --debug
|
sudo yunohost app upgrade gitea -u https://github.com/YunoHost-Apps/gitea_ynh/tree/testing --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||||
|
@ -15,10 +15,10 @@ After=slapd.service
|
|||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=/home/__APP__
|
WorkingDirectory=/home/yunohost.app/__APP__
|
||||||
ExecStart=/opt/__APP__/gitea web
|
ExecStart=/opt/__APP__/gitea web
|
||||||
Restart=always
|
Restart=always
|
||||||
Environment=USER=__APP__ HOME=/home/__APP__
|
Environment=USER=__APP__ HOME=/home/yunohost.app/__APP__
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
@ -7,7 +7,7 @@ If you want to use Gitea with ssh and be able to pull/push with you ssh key, you
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
PubkeyAuthentication yes
|
PubkeyAuthentication yes
|
||||||
AuthorizedKeysFile /home/%u/.ssh/authorized_keys
|
AuthorizedKeysFile /home/yunohost.app/%u/.ssh/authorized_keys
|
||||||
ChallengeResponseAuthentication no
|
ChallengeResponseAuthentication no
|
||||||
PasswordAuthentication no
|
PasswordAuthentication no
|
||||||
UsePAM no
|
UsePAM no
|
||||||
@ -48,14 +48,14 @@ This app use now the core-only feature of the backup. To keep the integrity of t
|
|||||||
|
|
||||||
`yunohost backup create --app gitea`
|
`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`.
|
- 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/yunohost.app/gitea`.
|
||||||
- Restart the gitea service with theses command:
|
- Restart the gitea service with theses command:
|
||||||
|
|
||||||
`systemctl start gitea.service`
|
`systemctl start gitea.service`
|
||||||
|
|
||||||
### Remove
|
### 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.
|
Due of the backup core only feature the data directory in `/home/yunohost.app/gitea` **is not removed**. It need to be removed manually to purge app user data.
|
||||||
|
|
||||||
### LFS setup
|
### LFS setup
|
||||||
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
To use a repository with an `LFS` setup, you need to activate-it on `/opt/gitea/custom/conf/app.ini`
|
||||||
|
@ -6,10 +6,10 @@ app=$YNH_APP_INSTANCE_NAME
|
|||||||
dbname=$app
|
dbname=$app
|
||||||
db_user=$app
|
db_user=$app
|
||||||
final_path="/opt/$app"
|
final_path="/opt/$app"
|
||||||
DATADIR="/home/$app"
|
datadir="/home/yunohost.app/$app"
|
||||||
REPO_PATH="$DATADIR/repositories"
|
repos_path="$datadir/repositories"
|
||||||
DATA_PATH="$DATADIR/data"
|
data_path="$datadir/data"
|
||||||
SSH_PATH="$DATADIR/.ssh"
|
ssh_path="$datadir/.ssh"
|
||||||
|
|
||||||
# Detect the system architecture to download the right tarball
|
# Detect the system architecture to download the right tarball
|
||||||
# NOTE: `uname -m` is more accurate and universal than `arch`
|
# NOTE: `uname -m` is more accurate and universal than `arch`
|
||||||
@ -36,10 +36,10 @@ fi
|
|||||||
create_dir() {
|
create_dir() {
|
||||||
mkdir -p "$final_path/data"
|
mkdir -p "$final_path/data"
|
||||||
mkdir -p "$final_path/custom/conf"
|
mkdir -p "$final_path/custom/conf"
|
||||||
mkdir -p "$SSH_PATH"
|
mkdir -p "$ssh_path"
|
||||||
mkdir -p "$REPO_PATH"
|
mkdir -p "$repos_path"
|
||||||
mkdir -p "$DATA_PATH/avatars"
|
mkdir -p "$data_path/avatars"
|
||||||
mkdir -p "$DATA_PATH/attachments"
|
mkdir -p "$data_path/attachments"
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,12 +58,12 @@ config_gitea() {
|
|||||||
|
|
||||||
set_permission() {
|
set_permission() {
|
||||||
chown -R $app:$app "$final_path"
|
chown -R $app:$app "$final_path"
|
||||||
chown -R $app:$app "/home/$app"
|
chown -R $app:$app "$datadir"
|
||||||
chown -R $app:$app "/var/log/$app"
|
chown -R $app:$app "/var/log/$app"
|
||||||
|
|
||||||
chmod u=rwX,g=rX,o= "$final_path"
|
chmod u=rwX,g=rX,o= "$final_path"
|
||||||
chmod u=rwx,g=rx,o= "$final_path/gitea"
|
chmod u=rwx,g=rx,o= "$final_path/gitea"
|
||||||
chmod u=rwx,g=rx,o= "$final_path/custom/conf/app.ini"
|
chmod u=rwx,g=rx,o= "$final_path/custom/conf/app.ini"
|
||||||
chmod u=rwX,g=rX,o= "/home/$app"
|
chmod u=rwX,g=rX,o= "$datadir"
|
||||||
chmod u=rwX,g=rX,o= "/var/log/$app"
|
chmod u=rwX,g=rX,o= "/var/log/$app"
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ ynh_backup --src_path "$final_path"
|
|||||||
|
|
||||||
# Copy the data files
|
# Copy the data files
|
||||||
ynh_print_info --message="Backing up user data..."
|
ynh_print_info --message="Backing up user data..."
|
||||||
ynh_backup --src_path "$DATADIR" --is_big=1
|
ynh_backup --src_path "$datadir" --is_big=1
|
||||||
|
|
||||||
ynh_print_info --message="Backing up configuration..."
|
ynh_print_info --message="Backing up configuration..."
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ domain=$YNH_APP_NEW_DOMAIN
|
|||||||
path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
|
path_url=$(ynh_normalize_url_path --path_url ${YNH_APP_NEW_PATH:-'/'})
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
DB_PASSWORD=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
db_password=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||||
key=$(ynh_app_setting_get --app $app --key secret_key)
|
key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||||
port=$(ynh_app_setting_get --app $app --key web_port)
|
port=$(ynh_app_setting_get --app $app --key web_port)
|
||||||
@ -55,7 +55,7 @@ config_gitea
|
|||||||
|
|
||||||
# RELOAD services
|
# RELOAD services
|
||||||
ynh_script_progression --message="Starting services..."
|
ynh_script_progression --message="Starting services..."
|
||||||
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10 -a restart
|
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10 -a restart
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
||||||
|
@ -33,15 +33,15 @@ ynh_user_exists "$admin" \
|
|||||||
# Check Final Path availability
|
# Check Final Path availability
|
||||||
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"
|
||||||
|
|
||||||
if [ -e "$DATADIR" ]; then
|
if [ -e "$datadir" ]; then
|
||||||
old_data_dir_path="$DATADIR$(date '+%Y%m%d.%H%M%S')"
|
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"
|
ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path"
|
||||||
mv "$DATADIR" "$old_data_dir_path"
|
mv "$datadir" "$old_data_dir_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate random password and key
|
# Generate random password and key
|
||||||
ynh_script_progression --message="Defining db password and key..."
|
ynh_script_progression --message="Defining db password and key..."
|
||||||
DB_PASSWORD=$(ynh_string_random)
|
db_password=$(ynh_string_random)
|
||||||
key=$(ynh_string_random)
|
key=$(ynh_string_random)
|
||||||
|
|
||||||
# Find available ports
|
# Find available ports
|
||||||
@ -49,7 +49,7 @@ port=$(ynh_find_port --port 6000)
|
|||||||
|
|
||||||
# Store Settings
|
# Store Settings
|
||||||
ynh_script_progression --message="Storing installation settings..."
|
ynh_script_progression --message="Storing installation settings..."
|
||||||
ynh_app_setting_set --app $app --key mysqlpwd --value $DB_PASSWORD
|
ynh_app_setting_set --app $app --key mysqlpwd --value $db_password
|
||||||
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 secret_key --value $key
|
ynh_app_setting_set --app $app --key secret_key --value $key
|
||||||
ynh_app_setting_set --app $app --key web_port --value $port
|
ynh_app_setting_set --app $app --key web_port --value $port
|
||||||
@ -60,11 +60,11 @@ ynh_app_setting_set --app $app --key web_port --value $port
|
|||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
ynh_script_progression --message="Configuring MySQL database..."
|
ynh_script_progression --message="Configuring MySQL database..."
|
||||||
ynh_mysql_create_db "$dbname" "$db_user" "$DB_PASSWORD"
|
ynh_mysql_create_db "$dbname" "$db_user" "$db_password"
|
||||||
|
|
||||||
# Add users
|
# Add users
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..."
|
||||||
ynh_system_user_create --username=$app --home_dir=/home/$app --use_shell
|
ynh_system_user_create --username=$app --home_dir=$datadir --use_shell
|
||||||
# Add ssh permission for gitea user
|
# Add ssh permission for gitea user
|
||||||
adduser $app ssh.app
|
adduser $app ssh.app
|
||||||
|
|
||||||
@ -98,14 +98,14 @@ ynh_script_progression --message="Configuring application, step 2/2..."
|
|||||||
systemctl start "$app".service
|
systemctl start "$app".service
|
||||||
|
|
||||||
# Wait untill login_source mysql table is created
|
# Wait untill login_source mysql table is created
|
||||||
while ! $(ynh_mysql_connect_as "$db_user" "$DB_PASSWORD" "$dbname" <<< "SELECT * FROM login_source;" &>/dev/null)
|
while ! $(ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" <<< "SELECT * FROM login_source;" &>/dev/null)
|
||||||
do
|
do
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add ldap config
|
# Add 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
|
ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql
|
||||||
|
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
ynh_script_progression --message="Configuring fail2ban..."
|
ynh_script_progression --message="Configuring fail2ban..."
|
||||||
@ -116,7 +116,7 @@ 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"
|
ynh_script_progression --message="Configuring permissions..."
|
||||||
if [ "$is_public" == '1' ];
|
if [ "$is_public" == '1' ];
|
||||||
then
|
then
|
||||||
ynh_permission_update --permission "main" --add "visitors"
|
ynh_permission_update --permission "main" --add "visitors"
|
||||||
@ -139,7 +139,7 @@ ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream
|
|||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
ynh_script_progression --message="Starting gitea services..." --weight=3
|
ynh_script_progression --message="Starting gitea services..." --weight=3
|
||||||
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
||||||
|
@ -58,7 +58,7 @@ yunohost service remove "$app"
|
|||||||
ynh_script_progression --message="Removing fail2ban configuration..."
|
ynh_script_progression --message="Removing fail2ban configuration..."
|
||||||
ynh_remove_fail2ban_config
|
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_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
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
sleep 1
|
sleep 1
|
||||||
|
@ -19,7 +19,7 @@ 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)
|
||||||
DB_PASSWORD=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
db_password=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||||
port=$(ynh_app_setting_get --app $app --key web_port)
|
port=$(ynh_app_setting_get --app $app --key web_port)
|
||||||
upstream_version=$(ynh_app_setting_get $app upstream_version)
|
upstream_version=$(ynh_app_setting_get $app upstream_version)
|
||||||
@ -37,7 +37,7 @@ test ! -e "$final_path" || ynh_die --message "This path already contains a folde
|
|||||||
|
|
||||||
# Add users
|
# Add users
|
||||||
ynh_script_progression --message="Configuring system user..."
|
ynh_script_progression --message="Configuring system user..."
|
||||||
ynh_system_user_create --username=$app --home_dir=/home/$app --use_shell
|
ynh_system_user_create --username=$app --home_dir=$datadir --use_shell
|
||||||
|
|
||||||
# Restore all files
|
# Restore all files
|
||||||
ynh_script_progression --message="Restoring files..." --weight=10
|
ynh_script_progression --message="Restoring files..." --weight=10
|
||||||
@ -45,8 +45,8 @@ ynh_restore
|
|||||||
|
|
||||||
# Create and restore the database
|
# Create and restore the database
|
||||||
ynh_script_progression --message="Restoring database..." --weight=3
|
ynh_script_progression --message="Restoring database..." --weight=3
|
||||||
ynh_mysql_create_db "$dbname" "$db_user" "$DB_PASSWORD"
|
ynh_mysql_create_db "$dbname" "$db_user" "$db_password"
|
||||||
ynh_mysql_connect_as "$db_user" "$DB_PASSWORD" "$dbname" < ./db.sql
|
ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ./db.sql
|
||||||
|
|
||||||
# Restore systemd files
|
# Restore systemd files
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
@ -75,7 +75,7 @@ yunohost service add "$app" --log /var/log/"$app"/gitea.log
|
|||||||
# Reload services
|
# Reload services
|
||||||
ynh_script_progression --message="Reloading services..."
|
ynh_script_progression --message="Reloading services..."
|
||||||
systemctl reload nginx.service
|
systemctl reload nginx.service
|
||||||
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
@ -18,7 +18,7 @@ ynh_abort_if_errors
|
|||||||
ynh_script_progression --message="Loading installation 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 --path_url $(ynh_app_setting_get --app $app --key path))
|
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
|
||||||
DB_PASSWORD=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
db_password=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||||
key=$(ynh_app_setting_get --app $app --key secret_key)
|
key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||||
port=$(ynh_app_setting_get --app $app --key web_port)
|
port=$(ynh_app_setting_get --app $app --key web_port)
|
||||||
@ -57,14 +57,14 @@ if [[ $migration_process -eq 1 ]]; then
|
|||||||
dbname=$app
|
dbname=$app
|
||||||
db_user=$app
|
db_user=$app
|
||||||
final_path="/opt/$app"
|
final_path="/opt/$app"
|
||||||
DATADIR="/home/$app"
|
datadir="/home/""$app"
|
||||||
REPO_PATH="$DATADIR/repositories"
|
repos_path="$datadir/repositories"
|
||||||
DATA_PATH="$DATADIR/data"
|
data_path="$datadir/data"
|
||||||
|
|
||||||
# Replace the user
|
# Replace the user
|
||||||
ynh_system_user_delete $old_app
|
ynh_system_user_delete $old_app
|
||||||
test getent passwd "$app" &>/dev/null || \
|
test getent passwd "$app" &>/dev/null || \
|
||||||
useradd -d "$DATADIR" --system --user-group "$app" --shell /bin/bash || \
|
useradd -d "$datadir" --system --user-group "$app" --shell /bin/bash || \
|
||||||
ynh_die --message "Unable to create $app system account"
|
ynh_die --message "Unable to create $app system account"
|
||||||
|
|
||||||
# Clean old binary
|
# Clean old binary
|
||||||
@ -73,14 +73,14 @@ if [[ $migration_process -eq 1 ]]; then
|
|||||||
|
|
||||||
# Restore authentication from SQL database
|
# Restore authentication from SQL database
|
||||||
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
|
ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql
|
||||||
|
|
||||||
# Fix hooks
|
# Fix hooks
|
||||||
if [[ -e $REPO_PATH ]];then
|
if [[ -e $repos_path ]];then
|
||||||
ls $REPO_PATH/*/*.git/hooks/pre-receive | while read p; do
|
ls $repos_path/*/*.git/hooks/pre-receive | while read p; do
|
||||||
ynh_secure_remove --file=$p
|
ynh_secure_remove --file=$p
|
||||||
done
|
done
|
||||||
ls $REPO_PATH/*/*.git/hooks/post-receive | while read p; do
|
ls $repos_path/*/*.git/hooks/post-receive | while read p; do
|
||||||
ynh_secure_remove --file=$p
|
ynh_secure_remove --file=$p
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -88,6 +88,11 @@ if [[ $migration_process -eq 1 ]]; then
|
|||||||
upstream_version="0.0.1"
|
upstream_version="0.0.1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Move data directory
|
||||||
|
if [ -e "/home/""$app" ] && [ ! -e $datadir ]; then
|
||||||
|
mv "/home/""$app" "$datadir"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
@ -223,7 +228,7 @@ if ! ynh_permission_exists --permission admin; then
|
|||||||
ynh_permission_create --permission 'admin' --allowed "$admin"
|
ynh_permission_create --permission 'admin' --allowed "$admin"
|
||||||
# Update ldap config
|
# 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
|
ynh_mysql_connect_as "$db_user" "$db_password" "$dbname" < ../conf/login_source.sql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add gitea to YunoHost's monitored services
|
# Add gitea to YunoHost's monitored services
|
||||||
@ -240,13 +245,9 @@ 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
|
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
|
||||||
set_access_settings
|
|
||||||
|
|
||||||
# Reload services
|
# Reload services
|
||||||
ynh_script_progression --message="Starting gitea services..." --weight=3
|
ynh_script_progression --message="Starting gitea services..." --weight=3
|
||||||
ynh_systemd_action -l "Starting new server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
ynh_systemd_action -l "Starting new Web server: tcp:127.0.0.1:" -p "/var/log/$app/gitea.log" -t 10
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
# Store the checksum with the 'INTERNAL_TOKEN' value.
|
||||||
|
Loading…
Reference in New Issue
Block a user