diff --git a/conf/systemd.service b/conf/systemd.service index 9ebb132..cc4c7e6 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -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 diff --git a/manifest.toml b/manifest.toml index bbac867..64cb608 100644 --- a/manifest.toml +++ b/manifest.toml @@ -64,7 +64,6 @@ ram.runtime = "2G" [resources.install_dir] [resources.data_dir] - subdirs = ['.ssh'] [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 9f34306..243f1b4 100644 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c313e67..88afa1b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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