From 284f6b93de4330f4150c43d687a3737328ab0f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 14 Mar 2021 15:25:48 +0100 Subject: [PATCH] Fix issues on home dir path management --- check_process | 3 +++ scripts/_common.sh | 5 ----- scripts/install | 2 +- scripts/upgrade | 4 +++- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/check_process b/check_process index b3ae1ff..fa6484d 100644 --- a/check_process +++ b/check_process @@ -14,6 +14,7 @@ upgrade=1 upgrade=1 from_commit=0705f4ffb4f7538a1aa33a801f95766ee23367db upgrade=1 from_commit=35774cc0eabb82b03230210689fa060d5f2b0bd8 + upgrade=1 from_commit=dbf0a2c9359ccd62b55132cace548b17e44af9bf backup_restore=1 multi_instance=1 incorrect_path=0 @@ -26,3 +27,5 @@ name=Fix postgresql helper from old_version_for_CI_2 branch ; commit=35774cc0eabb82b03230210689fa060d5f2b0bd8 name=Migrate from self signed certificate to cert managed by Yunohost from old_version_for_CI_3 branch + ; commit=dbf0a2c9359ccd62b55132cace548b17e44af9bf + name=Before permission implementation diff --git a/scripts/_common.sh b/scripts/_common.sh index a64f1cc..420e454 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,7 +11,6 @@ install_sources() { mkdir -p $final_path chown $synapse_user:root -R $final_path - chown $synapse_user:root -R $data_path if [ -n "$(uname -m | grep arm)" ] then @@ -37,10 +36,6 @@ install_sources() { sudo -u "$synapse_user" env PATH=$PATH rustup update else sudo -u "$synapse_user" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable' - mv $data_path/.cargo $final_path/ - mv $data_path/.rustup $final_path/ - ln -s $final_path/.cargo $data_path/.cargo - ln -s $final_path/.rustup $data_path/.rustup fi # Install virtualenv if it don't exist diff --git a/scripts/install b/scripts/install index 6a16455..9e5bb73 100644 --- a/scripts/install +++ b/scripts/install @@ -151,7 +151,7 @@ ynh_install_app_dependencies $dependances #================================================= ynh_script_progression --message="Configuring system user..." --weight=3 -ynh_system_user_create --username=$synapse_user --home_dir=$data_path +ynh_system_user_create --username=$synapse_user --home_dir=$final_path adduser $synapse_user ssl-cert adduser turnserver ssl-cert diff --git a/scripts/upgrade b/scripts/upgrade index 238c2c4..8e034a3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,8 +143,10 @@ if [ -e "/var/lib/matrix-$app" ]; then mv "$data_path" "$old_data_dir_path" fi mv "/var/lib/matrix-$app" "$data_path" +fi +if ! grep -q "$final_path" /etc/passwd; then # matrix-synapse:x:994:994::/var/lib/matrix-synapse:/usr/sbin/nologin - sed --in-place -r "s@matrix-$app\:x\:(\n*:\n*)\:\:/var/lib/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:(\n*:\n*)\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd + sed --in-place -r "s@matrix-$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:\1\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd fi #=================================================