From ca9bbc8b4d56f86ebf717768e3a0d2a4515256fe Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Mon, 8 May 2023 22:16:40 +0000 Subject: [PATCH] wip --- doc/ADMIN.md | 4 ++-- doc/ADMIN_fr.md | 4 ++-- doc/DESCRIPTION.md | 2 +- manifest.toml | 3 +-- scripts/install | 11 ++++++++--- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- tests.toml | 2 +- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/doc/ADMIN.md b/doc/ADMIN.md index 4b6c406..de7de2f 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1,10 +1,10 @@ ### Installation -* The package does not create a dedicated system user, rather during installation you are asked what user you want code-server to run as. **Don't give access to users you don't fully trust!** +* VS Code will run as the user you choose during the installation. ### Limitations -* `code-server` files are stored inside `/home//.local/share/code-server` +* `code-server` files are stored inside `/home/yunohost.app//.local/share/code-server` ### Extensions diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index bc8b2b8..31c2ef3 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,10 +1,10 @@ ### Installation -* Le paquet ne crée pas d'utilisateur système dédié; on vous demandera pendant l'installation quel utilisateur vous voulez que code-serveur éxecute en tant que. **Ne donnez pas accès à des utilisateurs en lesquels vous n'avez pas complètement confiance !** +* VS Code sera éxecuté en tant que l'utilisateurice sélectionnée lors de l'installation. ### Limitations -* Les fichiers de `code-server` sont stockés dans `/home//.local/share/code-server` +* Les fichiers de `code-server` sont stockés dans `/home/yunohost.app//.local/share/code-server` ### Extensions diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 21101a5..6c1a957 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1 @@ -Run VS Code on your server and access it in the browser \ No newline at end of file +Run VS Code on your server and access it in the browser diff --git a/manifest.toml b/manifest.toml index 6011b74..588d361 100644 --- a/manifest.toml +++ b/manifest.toml @@ -50,9 +50,8 @@ ram.runtime = "100M" [resources.ports] - [resources.system_user] - [resources.install_dir] + dir = /opt/yunohost/__APP__ [resources.data_dir] subdirs = ["user-data", "extensions"] diff --git a/scripts/install b/scripts/install index fcac4d3..a2bc533 100755 --- a/scripts/install +++ b/scripts/install @@ -25,7 +25,7 @@ ynh_script_progression --message="Setting up source files..." --weight=5 ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R $user:www-data "$install_dir" chmod +x "$install_dir/bin/code-server" #================================================= @@ -51,11 +51,11 @@ ynh_script_progression --message="Adding a configuration file..." --weight=2 ynh_add_config --template="config.yaml" --destination="$install_dir/config.yaml" chmod 440 "$install_dir/config.yaml" -chown $app:$app "$install_dir/config.yaml" +chown $admin:$admin "$install_dir/config.yaml" ynh_add_config --template="code-server.env" --destination="$install_dir/code-server.env" chmod 440 "$install_dir/code-server.env" -chown $app:$app "$install_dir/code-server.env" +chown $admin:$admin "$install_dir/code-server.env" #================================================= # START SYSTEMD SERVICE @@ -65,6 +65,11 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +#================================================= +# SET PERMISSION FOR THE USER +#================================================= +ynh_permission_update --permission="main" --add="$admin" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 6255ba4..5ba507c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -18,7 +18,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R $admin:www-data "$install_dir" #================================================= # RESTORE THE DATA DIRECTORY @@ -27,7 +27,7 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -chown -R $app:www-data "$data_dir" +chown -R $admin:www-data "$data_dir" #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 7d4e25e..8e2db7c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,7 +79,7 @@ then fi chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R $admin:www-data "$install_dir" chmod +x "$install_dir/bin/code-server" #================================================= @@ -104,7 +104,7 @@ then fi chmod 440 "$install_dir/config.yaml" "$install_dir/code-server.env" -chown $app:$app "$install_dir/config.yaml" "$install_dir/code-server.env" +chown $admin:$admin "$install_dir/config.yaml" "$install_dir/code-server.env" #================================================= # SETUP SYSTEMD diff --git a/tests.toml b/tests.toml index 091af15..3ba225f 100644 --- a/tests.toml +++ b/tests.toml @@ -6,4 +6,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.d4d938378a7b807264f82797cb297daebd1600f0.name = "Upgrade from 4.2.0" \ No newline at end of file + test_upgrade_from.d4d938378a7b807264f82797cb297daebd1600f0.name = "Upgrade from 4.2.0"