Skip to content

Commit

Permalink
Fix bookworm restore permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Jun 5, 2024
1 parent e261ea3 commit b5cae75
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,24 @@ ynh_restore_file --origin_path="/opt/kepubify/$app"
#=================================================
# RESTORE USER RIGHTS
#=================================================
chown -R $app: $install_dir
chown -R "$app:" "$install_dir"
chmod 740 $install_dir

#Use venv to install pip requirements - Inspired from https://github.com/YunoHost-Apps/pyinventory_ynh/blob/master/scripts/install
ynh_script_progression --message="Reinstalling pip requirements..." --weight=70
# Always recreate everything fresh with current python version
# When reinstalling on a new yunohost, this is required
# When reinstalling on a new yunohost, this is required
if [ -d "${install_dir}/venv" ] ; then
ynh_secure_remove "${install_dir}/venv"
fi

# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
python3 -m venv --without-pip "${install_dir}/venv"
chown -R "$app:" "$install_dir"
ynh_exec_as $app python3 -m venv --without-pip "${install_dir}/venv"

#run source in a 'sub shell'
(
set +o nounset
source "${install_dir}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $install_dir/venv/bin/python3 -m ensurepip
ynh_exec_as $app $install_dir/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $install_dir/venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/requirements.txt"
ynh_exec_as $app $install_dir/venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/optional-requirements.txt"
)
ynh_exec_as $app $install_dir/venv/bin/python3 -m ensurepip
ynh_exec_as $app $install_dir/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $install_dir/venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/requirements.txt"
ynh_exec_as $app $install_dir/venv/bin/pip3 install --no-cache-dir --upgrade -r "$install_dir/optional-requirements.txt"

#=================================================
# RESTORE SYSTEMD
Expand Down Expand Up @@ -167,4 +160,3 @@ ynh_script_progression --message="Restoration completed for $app" --last
# WARNING FOR READ ACCESS
#=================================================
ynh_print_warn "Please, give required access to $app user to the $calibre_dir folder."

0 comments on commit b5cae75

Please sign in to comment.