fix: move .ssh dir to home dir

This commit is contained in:
Emmanuel Averty 2023-06-07 15:22:12 +02:00 committed by grosmanal
parent 78128a2f05
commit b1883d875a
4 changed files with 8 additions and 5 deletions

View file

@ -6,10 +6,10 @@ After=syslog.target network.target mysql.service slapd.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__DATA_DIR__/
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/forgejo web -p __PORT__
Restart=always
Environment=USER=__APP__ HOME=__DATA_DIR__/
Environment=USER=__APP__
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -64,7 +64,6 @@ ram.runtime = "2G"
[resources.install_dir]
[resources.data_dir]
subdirs = ['.ssh']
[resources.permissions]
main.url = "/"

View file

@ -22,8 +22,6 @@ mkdir -p "$install_dir/custom/conf"
chmod -R o-rwx "$install_dir/custom"
chown -R $app:$app "$install_dir/custom"
chmod 700 $data_dir/.ssh
#=================================================
# KEYS GENERATION
#=================================================

View file

@ -28,6 +28,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# forgejo home directory has changed (yunohost packaging v2)
# .ssh directory should move from old home dir (data_dir) to new one
# (/var/www/$app is the default value for home in resources.system_user)
if [ -d "$data_dir/.ssh" ]; then
mv "$data_dir/.ssh" /var/www/$app
fi
# If secret_key doesn't exist, create it
if [ -z "$secret_key" ]; then