mirror of
https://framagit.org/YunoHost-Apps/gitea_ynh.git
synced 2024-11-21 18:41:35 +01:00
Add arguments for all helper call
This commit is contained in:
parent
d0d7f6fb0d
commit
df021cc560
@ -18,7 +18,7 @@ DOMAIN = __DOMAIN__
|
||||
HTTP_PORT = __PORT__
|
||||
ROOT_URL = https://__URL__/
|
||||
DISABLE_SSH = false
|
||||
SSH_PORT = __SSH_PORT_
|
||||
SSH_PORT = __SSH_PORT__
|
||||
OFFLINE_MODE = false
|
||||
APP_DATA_PATH = __DATA_PATH__
|
||||
LANDING_PAGE = explore
|
||||
|
@ -22,7 +22,7 @@ script_name="$0"
|
||||
# DELETE OLD APP'S SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_secure_remove "/etc/yunohost/apps/$old_app"
|
||||
ynh_secure_remove --file="/etc/yunohost/apps/$old_app"
|
||||
yunohost app ssowatconf
|
||||
|
||||
#=================================================
|
||||
|
@ -49,29 +49,29 @@ config_nginx() {
|
||||
|
||||
config_gitea() {
|
||||
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
|
||||
ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini"
|
||||
ynh_backup_if_checksum_is_different --file "$final_path/custom/conf/app.ini"
|
||||
|
||||
cp ../conf/app.ini "$final_path/custom/conf"
|
||||
usermod -s /bin/bash $app
|
||||
|
||||
if [ "$path_url" = "/" ]
|
||||
then
|
||||
ynh_replace_string "__URL__" "$domain" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __URL__ --replace_string "$domain" --target_file "$final_path/custom/conf/app.ini"
|
||||
else
|
||||
ynh_replace_string "__URL__" "$domain${path_url%/}" "$final_path/custom/conf/app.ini"
|
||||
fi
|
||||
|
||||
ynh_replace_string "__REPOS_PATH__" "$REPO_PATH" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__DB_PASSWORD__" "$dbpass" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__DB_USER__" "$dbuser" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__DOMAIN__" "$domain" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__KEY__" "$key" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__PORT__" $port "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__APP__" $app "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string "__SSH_PORT_" $ssh_port "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __REPOS_PATH__ --replace_string "$REPO_PATH" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __DB_PASSWORD__ --replace_string "$dbpass" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __DB_USER__ --replace_string "$dbuser" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __DOMAIN__ --replace_string "$domain" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __KEY__ --replace_string "$key" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __DATA_PATH__ --replace_string "$DATA_PATH" --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __PORT__ --replace_string $port --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __APP__ --replace_string $app --target_file "$final_path/custom/conf/app.ini"
|
||||
ynh_replace_string --match_string __SSH_PORT__ --replace_string $ssh_port --target_file "$final_path/custom/conf/app.ini"
|
||||
|
||||
ynh_store_file_checksum "$final_path/custom/conf/app.ini"
|
||||
ynh_store_file_checksum --file "$final_path/custom/conf/app.ini"
|
||||
}
|
||||
|
||||
set_permission() {
|
||||
@ -89,7 +89,7 @@ set_permission() {
|
||||
set_access_settings() {
|
||||
if [ "$is_public" = '1' ]
|
||||
then
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
ynh_app_setting_set --app $app --key unprotected_uris --value "/"
|
||||
else
|
||||
# For an access to the git server by https in private mode we need to allow the access to theses URL :
|
||||
# - "DOMAIN/PATH/USER/REPOSITORY/info/refs"
|
||||
@ -100,6 +100,6 @@ set_access_settings() {
|
||||
excaped_domain=${excaped_domain//'-'/'%-'}
|
||||
excaped_path=${path_url//'.'/'%.'}
|
||||
excaped_path=${excaped_path//'-'/'%-'}
|
||||
ynh_app_setting_set $app skipped_regex "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs"
|
||||
ynh_app_setting_set --app $app --key skipped_regex --value "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs"
|
||||
fi
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ source ../settings/scripts/experimental_helper.sh
|
||||
source ../settings/scripts/_common.sh
|
||||
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
@ -35,4 +35,4 @@ ynh_backup "/etc/systemd/system/${app}.service"
|
||||
ynh_backup "/var/log/$app"
|
||||
|
||||
# Dump the database
|
||||
ynh_mysql_dump_db "$dbname" > ./db.sql
|
||||
ynh_mysql_dump_db "$dbname" > ./db.sql
|
||||
|
@ -22,10 +22,10 @@ domain=$YNH_APP_NEW_DOMAIN
|
||||
path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH:-'/'})
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
admin=$(ynh_app_setting_get "$app" adminusername)
|
||||
key=$(ynh_app_setting_get "$app" secret_key)
|
||||
port=$(ynh_app_setting_get "$app" web_port)
|
||||
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||
key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||
port=$(ynh_app_setting_get --app $app --key web_port)
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
@ -55,4 +55,4 @@ sleep 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 "$final_path/custom/conf/app.ini"
|
||||
ynh_store_file_checksum --file "$final_path/custom/conf/app.ini"
|
||||
|
@ -95,7 +95,7 @@ ynh_systemd_action() {
|
||||
ynh_clean_check_starting () {
|
||||
# Stop the execution of tail.
|
||||
kill -s 15 $pid_tail 2>&1
|
||||
ynh_secure_remove "$templog" 2>&1
|
||||
ynh_secure_remove --file="$templog" 2>&1
|
||||
}
|
||||
|
||||
# Read the value of a key in a ynh manifest file
|
||||
@ -352,7 +352,7 @@ ynh_handle_app_migration () {
|
||||
# Remove the old database
|
||||
ynh_mysql_remove_db $db_name $db_name
|
||||
# And the dump
|
||||
ynh_secure_remove "$sql_dump"
|
||||
ynh_secure_remove --file="$sql_dump"
|
||||
|
||||
# Update the value of $db_name
|
||||
db_name=$new_db_name
|
||||
|
@ -39,11 +39,11 @@ key=$(ynh_string_random)
|
||||
port=$(ynh_find_port 6000)
|
||||
|
||||
# Store Settings
|
||||
ynh_app_setting_set $app mysqlpwd $dbpass
|
||||
ynh_app_setting_set $app adminusername $admin
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
ynh_app_setting_set $app secret_key $key
|
||||
ynh_app_setting_set $app web_port $port
|
||||
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 is_public --value $is_public
|
||||
ynh_app_setting_set --app $app --key secret_key --value $key
|
||||
ynh_app_setting_set --app $app --key web_port --value $port
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
@ -113,7 +113,7 @@ yunohost service add "$app" --log "/var/log/$app/$app.log"
|
||||
ynh_use_logrotate "/var/log/$app"
|
||||
|
||||
# Save Version
|
||||
ynh_app_setting_set $app upstream_version $(ynh_app_upstream_version)
|
||||
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
||||
|
||||
# Reload services
|
||||
ynh_systemd_action -l "Serving \[::\]:$port with pid" -p "systemd"
|
||||
@ -121,4 +121,4 @@ sleep 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 "$final_path/custom/conf/app.ini"
|
||||
ynh_store_file_checksum --file "$final_path/custom/conf/app.ini"
|
||||
|
@ -23,12 +23,12 @@ ynh_mysql_drop_db "$dbname" 2>/dev/null
|
||||
ynh_mysql_drop_user "$dbuser" 2>/dev/null
|
||||
|
||||
# Retrieve domain from app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
|
||||
# Delete app directory and configurations
|
||||
ynh_secure_remove "$final_path"
|
||||
ynh_secure_remove "$DATADIR"
|
||||
ynh_secure_remove "/var/log/$app"
|
||||
ynh_secure_remove --file="$final_path"
|
||||
ynh_secure_remove --file="$DATADIR"
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
@ -15,11 +15,11 @@ source ../settings/scripts/experimental_helper.sh
|
||||
source ../settings/scripts/_common.sh
|
||||
|
||||
# Retrieve old app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path_url=$(ynh_app_setting_get "$app" path)
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
admin=$(ynh_app_setting_get "$app" adminusername)
|
||||
port=$(ynh_app_setting_get "$app" web_port)
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
path_url=$(ynh_app_setting_get --app $app --key path)
|
||||
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||
port=$(ynh_app_setting_get --app $app --key web_port)
|
||||
|
||||
# Check domain/path availability with app helper
|
||||
ynh_webpath_available $domain $path_url || ynh_die "$domain is not available as domain, please use an other domain."
|
||||
|
@ -15,14 +15,14 @@ source ./experimental_helper.sh
|
||||
source ./_common.sh
|
||||
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
|
||||
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||
admin=$(ynh_app_setting_get "$app" adminusername)
|
||||
key=$(ynh_app_setting_get "$app" secret_key)
|
||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||
port=$(ynh_app_setting_get "$app" web_port)
|
||||
upstream_version=$(ynh_app_setting_get $app upstream_version)
|
||||
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get --app $app --key path))
|
||||
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
||||
admin=$(ynh_app_setting_get --app $app --key adminusername)
|
||||
key=$(ynh_app_setting_get --app $app --key secret_key)
|
||||
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
|
||||
ynh_backup_before_upgrade
|
||||
@ -58,8 +58,8 @@ if [[ $migration_process -eq 1 ]]; then
|
||||
ynh_die "Unable to create $app system account"
|
||||
|
||||
# Clean old binary
|
||||
ynh_secure_remove $final_path/gogs
|
||||
ynh_secure_remove $final_path/custom/conf/auth.d
|
||||
ynh_secure_remove --file=$final_path/gogs
|
||||
ynh_secure_remove --file=$final_path/custom/conf/auth.d
|
||||
|
||||
# Restore authentication from SQL database
|
||||
ynh_replace_string "__ADMIN__" "$admin" ../conf/login_source.sql
|
||||
@ -69,10 +69,10 @@ if [[ $migration_process -eq 1 ]]; then
|
||||
# Fix hooks
|
||||
if [[ -e $REPO_PATH ]];then
|
||||
ls $REPO_PATH/*/*.git/hooks/pre-receive | while read p; do
|
||||
ynh_secure_remove $p
|
||||
ynh_secure_remove --file=$p
|
||||
done
|
||||
ls $REPO_PATH/*/*.git/hooks/post-receive | while read p; do
|
||||
ynh_secure_remove $p
|
||||
ynh_secure_remove --file=$p
|
||||
done
|
||||
fi
|
||||
|
||||
@ -84,7 +84,7 @@ fi
|
||||
#=================================================
|
||||
|
||||
# Clean template to fix issue : https://github.com/gogits/gogs/issues/4585
|
||||
ynh_secure_remove "/opt/$app/templates"
|
||||
ynh_secure_remove --file="/opt/$app/templates"
|
||||
|
||||
# Configure gitea with app.ini file
|
||||
config_gitea
|
||||
@ -168,7 +168,7 @@ ynh_setup_source $final_path source/$architecture
|
||||
set_permission
|
||||
|
||||
# Save Version
|
||||
ynh_app_setting_set $app upstream_version $(ynh_app_upstream_version)
|
||||
ynh_app_setting_set --app $app --key upstream_version --value $(ynh_app_upstream_version)
|
||||
|
||||
# Unprotect root from SSO if public
|
||||
set_access_settings
|
||||
@ -179,7 +179,7 @@ sleep 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 "$final_path/custom/conf/app.ini"
|
||||
ynh_store_file_checksum --file "$final_path/custom/conf/app.ini"
|
||||
|
||||
#=================================================
|
||||
# FINISH MIGRATION PROCESS
|
||||
|
Loading…
Reference in New Issue
Block a user