yunohost-gitea_ynh/scripts/_common.sh
2024-02-02 15:23:28 +01:00

28 lines
935 B
Bash

#=================================================
# SET ALL CONSTANTS
#=================================================
systemd_match_start_line='Starting new Web server: tcp:127.0.0.1:'
ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+")
#=================================================
# DEFINE ALL COMMON FONCTIONS
#=================================================
_set_permissions() {
chown -R "$app:$app" "$install_dir"
chmod -R u=rwX,g=rX,o= "$install_dir"
chmod +x "$install_dir/gitea"
chown -R "$app:$app" "$data_dir"
find $data_dir \( \! -perm u=rwX,g=rX,-o= \
-o \! -user $app \
-o \! -group $app \) \
-exec chown $app:$app {} \; \
-exec chmod u=rwX,g=rX,o= {} \;
chmod -R u=rwX,g=,o= "$data_dir/.ssh"
chown -R "$app:$app" "/var/log/$app"
chmod -R u=rwX,g=rX,o= "/var/log/$app"
}