diff --git a/scripts/_common.sh b/scripts/_common.sh index 9c2d489..ff1a10b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -22,10 +22,16 @@ setup_dir() { install_source() { # Clean venv is it was on python with an old version in case major upgrade of debian if [ ! -e $final_path/lib/python$python_version ]; then - ynh_secure_remove --file=$final_path + ynh_secure_remove --file=$final_path/bin + ynh_secure_remove --file=$final_path/lib + ynh_secure_remove --file=$final_path/lib64 + ynh_secure_remove --file=$final_path/include + ynh_secure_remove --file=$final_path/share + ynh_secure_remove --file=$final_path/pyvenv.cfg fi mkdir -p $final_path + chown $pgadmin_user:root -R $final_path if [ -n "$(uname -m | grep arm)" ] then @@ -40,9 +46,9 @@ install_source() { # We need this to be able to install cryptgraphy export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" if [ -e $final_path/.rustup ]; then - sudo -u "$synapse_user" env PATH=$PATH rustup update + sudo -u "$pgadmin_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' + sudo -u "$pgadmin_user" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable' fi # Install virtualenv if it don't exist diff --git a/scripts/install b/scripts/install index bb35dfa..4254391 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ ynh_install_app_dependencies $dependances # Create user ynh_script_progression --message="Configuring system user..." -ynh_system_user_create --username $pgadmin_user --home_dir /var/lib/$app +ynh_system_user_create --username $pgadmin_user --home_dir $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_script_progression --message="Installing sources files..." --weight=10 diff --git a/scripts/upgrade b/scripts/upgrade index 5013c0d..495b2d7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,10 @@ ynh_clean_setup () { test -e /etc/uwsgi/apps-available/$app.ini && \ ynh_systemd_action --service_name "uwsgi-app@$app.service" --action stop +if ! grep -q "$final_path" /etc/passwd; then + sed --in-place -r "s@$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/$app\:/usr/sbin/nologin@$app\:x\:\1\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd +fi + #================================================= # STANDARD UPGRADE STEPS #=================================================