1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00
This commit is contained in:
ericgaspar 2021-04-23 07:57:08 +02:00
parent 5b54dc4938
commit b9c6ab427f
4 changed files with 13 additions and 20 deletions

View file

@ -162,9 +162,9 @@ DSA = 1024
; Either "mysql", "postgres" or "sqlite3", you can connect to TiDB with MySQL protocol ; Either "mysql", "postgres" or "sqlite3", you can connect to TiDB with MySQL protocol
DB_TYPE = mysql DB_TYPE = mysql
HOST = 127.0.0.1:3306 HOST = 127.0.0.1:3306
NAME = __DB_USER__ NAME = __DB_NAME__
USER = __DB_USER__ USER = __DB_NAME__
PASSWD = __DB_PASSWORD__ PASSWD = __DB_PWD__
; For "postgres" only, either "disable", "require" or "verify-full" ; For "postgres" only, either "disable", "require" or "verify-full"
SSL_MODE = disable SSL_MODE = disable
; For "sqlite3" and "tidb", use absolute path when you start as service ; For "sqlite3" and "tidb", use absolute path when you start as service

View file

@ -34,10 +34,8 @@ create_dir() {
config_gogs() { config_gogs() {
ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini" ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini"
ynh_backup_if_checksum_is_different "$final_path/custom/conf/auth.d/ldap.conf"
cp ../conf/app.ini "$final_path/custom/conf" cp ../conf/app.ini "$final_path/custom/conf"
cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf"
if [ "$path_url" = "/" ] if [ "$path_url" = "/" ]
then then
@ -47,8 +45,8 @@ config_gogs() {
fi fi
ynh_replace_string "__REPOS_PATH__" "$REPO_PATH" "$final_path/custom/conf/app.ini" 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_PWD__" "$dbpass" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DB_USER__" "$dbuser" "$final_path/custom/conf/app.ini" ynh_replace_string "__DB_NAME__" "$dbuser" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DOMAIN__" "$domain" "$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 "__KEY__" "$key" "$final_path/custom/conf/app.ini"
ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini" ynh_replace_string "__DATA_PATH__" "$DATA_PATH" "$final_path/custom/conf/app.ini"
@ -62,10 +60,9 @@ config_gogs() {
ynh_replace_string "__PRIVATE_MODE__" "true" "$final_path/custom/conf/app.ini" ynh_replace_string "__PRIVATE_MODE__" "true" "$final_path/custom/conf/app.ini"
fi fi
ynh_replace_string "__ADMIN__" "$admin" "$final_path/custom/conf/auth.d/ldap.conf" ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
ynh_store_file_checksum "$final_path/custom/conf/app.ini" ynh_store_file_checksum "$final_path/custom/conf/app.ini"
ynh_store_file_checksum "$final_path/custom/conf/auth.d/ldap.conf"
} }
set_permission() { set_permission() {

View file

@ -124,7 +124,6 @@ mkdir -p "/var/log/$app"
#================================================= #=================================================
cp ../conf/app.ini "$final_path/custom/conf" cp ../conf/app.ini "$final_path/custom/conf"
cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf"
if [ "$path_url" = "/" ] if [ "$path_url" = "/" ]
then then
@ -134,8 +133,8 @@ else
fi fi
ynh_replace_string --match_string="__REPOS_PATH__" --replace_string="$REPO_PATH" --target_file="$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="$db_pwd" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_user" --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="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/custom/conf/app.ini"
ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --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="__DATA_PATH__" --replace_string="$DATA_PATH" --target_file="$final_path/custom/conf/app.ini"
@ -149,10 +148,9 @@ else
ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini"
fi fi
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/custom/conf/auth.d/ldap.conf" ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
ynh_store_file_checksum --file="$final_path/custom/conf/app.ini" ynh_store_file_checksum --file="$final_path/custom/conf/app.ini"
ynh_store_file_checksum --file="$final_path/custom/conf/auth.d/ldap.conf"
# Configure init script # Configure init script
ynh_add_systemd_config ynh_add_systemd_config

View file

@ -77,10 +77,8 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir=$final_path --source_id="$architecture" ynh_setup_source --dest_dir=$final_path --source_id="$architecture"
ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini" ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini"
ynh_backup_if_checksum_is_different "$final_path/custom/conf/auth.d/ldap.conf"
cp ../conf/app.ini "$final_path/custom/conf" cp ../conf/app.ini "$final_path/custom/conf"
cp ../conf/ldap.conf "$final_path/custom/conf/auth.d/ldap.conf"
if [ "$path_url" = "/" ] if [ "$path_url" = "/" ]
then then
@ -90,8 +88,8 @@ else
fi fi
ynh_replace_string --match_string="__REPOS_PATH__" --replace_string="$REPO_PATH" --target_file="$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="$db_pwd" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/custom/conf/app.ini"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_user" --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="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/custom/conf/app.ini"
ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__KEY__" --replace_string="$(ynh_string_random)" --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="__DATA_PATH__" --replace_string="$DATA_PATH" --target_file="$final_path/custom/conf/app.ini"
@ -105,10 +103,10 @@ else
ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini" ynh_replace_string --match_string="__PRIVATE_MODE__" --replace_string="true" --target_file="$final_path/custom/conf/app.ini"
fi fi
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/custom/conf/auth.d/ldap.conf"
ynh_add_config --template="../conf/ldap.conf" --destination="$final_path/custom/conf/auth.d/ldap.conf"
ynh_store_file_checksum "$final_path/custom/conf/app.ini" ynh_store_file_checksum "$final_path/custom/conf/app.ini"
ynh_store_file_checksum "$final_path/custom/conf/auth.d/ldap.conf"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD