yunohost-gitea_ynh/scripts/_common.sh

32 lines
1.3 KiB
Bash
Raw Normal View History

2023-11-29 10:58:11 +01:00
#=================================================
# SET ALL CONSTANTS
#=================================================
systemd_match_start_line='Starting new Web server: tcp:127.0.0.1:'
2024-04-27 00:07:37 +02:00
ssh_port="$(yunohost settings get security.ssh.ssh_port)"
2018-02-25 21:45:24 +01:00
#=================================================
# DEFINE ALL COMMON FONCTIONS
#=================================================
2023-11-29 10:58:11 +01:00
_set_permissions() {
2024-08-31 09:56:13 +02:00
chown -R "$app:$app" "$install_dir"
chmod -R u=rwX,g=rX,o= "$install_dir"
2023-11-29 10:58:11 +01:00
chmod +x "$install_dir/gitea"
chown -R "$app:$app" "$data_dir"
2024-04-27 00:07:37 +02:00
find "$data_dir" \( \! -perm -o= \
-o \! -user "$app" \
-o \! -group "$app" \) \
-exec chown "$app:$app" {} \; \
2023-11-29 10:58:11 +01:00
-exec chmod u=rwX,g=rX,o= {} \;
chmod -R u=rwX,g=,o= "$data_dir/.ssh"
2024-08-31 09:56:13 +02:00
}
2024-08-31 09:56:13 +02:00
set_settings_default() {
ynh_app_setting_set_default --key=internal_token --value="$(ynh_exec_as_app "$install_dir/gitea" generate secret INTERNAL_TOKEN)"
ynh_app_setting_set_default --key=secret_key --value="$(ynh_exec_as_app "$install_dir/gitea" generate secret SECRET_KEY)"
ynh_app_setting_set_default --key=lfs_jwt_secret --value="$(ynh_exec_as_app "$install_dir/gitea" generate secret JWT_SECRET)"
ynh_app_setting_set_default --key=jwt_secret --value="$(ynh_exec_as_app "$install_dir/gitea" generate secret JWT_SECRET)"
2018-02-25 21:45:24 +01:00
}