1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitea_ynh.git synced 2024-09-03 20:36:22 +02:00

Few fixes

This commit is contained in:
yalh76 2022-05-29 20:23:13 +02:00
parent d04a90ec4d
commit 32627f0b10
5 changed files with 16 additions and 15 deletions

View file

@ -130,7 +130,7 @@ ynh_add_config --template="app.ini" --destination="$final_path/custom/conf/app.i
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" --timeout=10 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="AppURL"
sleep 1 sleep 1
#================================================= #=================================================

View file

@ -52,8 +52,7 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=mysqlpwd --value=$db_password ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
ynh_app_setting_set --app=$app --key=secret_key --value=$key
ynh_app_setting_set --app=$app --key=upstream_version --value=$upstream_version ynh_app_setting_set --app=$app --key=upstream_version --value=$upstream_version
#================================================= #=================================================
@ -73,7 +72,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path" --home_dir=$datadir --use_shell ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
# Add ssh permission for gitea user # Add ssh permission for gitea user
adduser $app ssh.app adduser $app ssh.app
@ -104,7 +103,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
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"
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
@ -145,7 +143,8 @@ ynh_script_progression --message="Adding a configuration file..."
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
ynh_add_config --template="app.ini" --destination="$final_path/custom/conf/app.ini" ynh_add_config --template="app.ini" --destination="$final_path/custom/conf/app.ini"
chmod 400 "$final_path/custom/conf/app.ini" chmod u=rwx,g=rx,o= "$final_path/custom/conf/app.ini"
chmod 600 "$final_path/custom/conf/app.ini"
chown $app:$app "$final_path/custom/conf/app.ini" chown $app:$app "$final_path/custom/conf/app.ini"
#================================================= #=================================================
@ -161,17 +160,19 @@ ynh_add_systemd_config
#================================================= #=================================================
ynh_script_progression --message="Setuping application..." ynh_script_progression --message="Setuping application..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="AppURL"
# Wait until login_source mysql table is created # Wait until 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 --user=$db_user --password=$db_pwd --database=$db_name <<< "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 --user=$db_user --password=$db_pwd --database=$db_name < ../conf/login_source.sql
ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -196,7 +197,7 @@ yunohost service add $app --log="/var/log/$app/gitea.log"
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" --timeout=10 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="AppURL"
sleep 1 sleep 1
#================================================= #=================================================

View file

@ -147,7 +147,7 @@ yunohost service add $app --log="/var/log/$app/gitea.log"
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" --timeout=10 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="AppURL"
sleep 1 sleep 1
#================================================= #=================================================

View file

@ -89,7 +89,7 @@ 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 --user=$db_user --password=$db_pwd --database=$db_name < ../conf/login_source.sql
# Fix hooks # Fix hooks
if [[ -e $datadir/repositories ]];then if [[ -e $datadir/repositories ]];then
@ -117,7 +117,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 --user=$db_user --password=$db_pwd --database=$db_name < ../conf/login_source.sql
fi fi
#================================================= #=================================================
@ -126,7 +126,7 @@ fi
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" --home_dir=$datadir --use_shell ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
# Add ssh permission for gitea user # Add ssh permission for gitea user
adduser $app ssh.app adduser $app ssh.app
@ -214,7 +214,7 @@ yunohost service add $app --log="/var/log/$app/gitea.log"
ynh_script_progression --message="Starting a systemd service..." ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:" --timeout=10 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/gitea.log" --line_match="AppURL"
sleep 1 sleep 1
#================================================= #=================================================