boinc-app.eclass: fix paths and permissions

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova
2022-06-25 20:46:59 +05:00
parent bec2b834dd
commit 598d011fca

View File

@@ -1,4 +1,4 @@
# Copyright 2021 Gentoo Authors # Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: boinc-app.eclass # @ECLASS: boinc-app.eclass
@@ -142,6 +142,21 @@ get_project_root() {
echo "$(get_boincdir)/projects/$(get_project_dirname)" echo "$(get_boincdir)/projects/$(get_project_dirname)"
} }
# @FUNCTION: _boinc-app_fix_permissions
# @USAGE:
# @INTERNAL
# @DESCRIPTION:
# Fix owner and permissions for the project root.
_boinc-app_fix_permissions() {
local paths=(
$(get_boincdir)
$(get_boincdir)/projects
$(get_project_root)
)
fowners boinc:boinc "${paths[@]}"
fperms 0771 "${paths[@]}"
}
# @FUNCTION: boinc-app_appinfo_prepare # @FUNCTION: boinc-app_appinfo_prepare
# @USAGE: <writable app_info.xml> # @USAGE: <writable app_info.xml>
# @DESCRIPTION: # @DESCRIPTION:
@@ -151,7 +166,7 @@ boinc-app_appinfo_prepare() {
debug-print-function ${FUNCNAME} "${@}"] debug-print-function ${FUNCNAME} "${@}"]
sed -i "$1" \ sed -i "$1" \
-e "s:%PV%:${PV}:g" \ -e "s:@PV@:${PV}:g" \
|| die "app_info.xml sed failed" || die "app_info.xml sed failed"
} }
@@ -199,6 +214,8 @@ doappinfo() {
insopts -m 0644 --owner boinc --group boinc insopts -m 0644 --owner boinc --group boinc
doins "${T}"/app_info.xml doins "${T}"/app_info.xml
) || die "failed to install app_info.xml" ) || die "failed to install app_info.xml"
_boinc-app_fix_permissions
} }
# @FUNCTION: boinc-wrapper_foreach_wrapper_job # @FUNCTION: boinc-wrapper_foreach_wrapper_job
@@ -263,10 +280,12 @@ dowrapper() {
( # subshell to avoid pollution of calling environment ( # subshell to avoid pollution of calling environment
insinto $(get_project_root) insinto $(get_project_root)
insopts -m 0644 --owner boinc --group boinc insopts -m 0644 --owner boinc --group boinc
doins "${T}"/${wrapperjob} doins "${T}/${wrapperjob}"
dosym -r /usr/bin/boinc-wrapper "$(get_project_root)/${wrapperexe}" dosym -r /usr/bin/boinc-wrapper "$(get_project_root)/${wrapperexe}"
) || die "failed to install '${app}' wrapper app" ) || die "failed to install '${app}' wrapper app"
done done
_boinc-app_fix_permissions
} }
# @FUNCTION: boinc-app_pkg_postinst # @FUNCTION: boinc-app_pkg_postinst
@@ -276,8 +295,8 @@ dowrapper() {
boinc-app_pkg_postinst() { boinc-app_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"] debug-print-function ${FUNCNAME} "${@}"]
if [[ -f "${EROOT}$(get_boincdir)/master_$(get_project_dirname).xml" ]]; then if [[ -f "${EROOT}/$(get_boincdir)/master_$(get_project_dirname).xml" ]]; then
if [[ ! ${REPLACING_VERSIONS} ]]; then if [[ -z ${REPLACING_VERSIONS} ]]; then
# most likely replacing applications downloaded # most likely replacing applications downloaded
# by the BOINC client from project's website # by the BOINC client from project's website
elog "Restart the BOINC daemon for changes to take place:" elog "Restart the BOINC daemon for changes to take place:"
@@ -311,14 +330,13 @@ boinc-app_pkg_postinst() {
boinc-app_pkg_postrm() { boinc-app_pkg_postrm() {
debug-print-function ${FUNCNAME} "${@}"] debug-print-function ${FUNCNAME} "${@}"]
if [[ ! ${REPLACED_BY_VERSION} ]]; then if [[ -z ${REPLACING_VERSIONS} ]]; then
local gui_rpc_auth="$(get_boincdir)/gui_rpc_auth.cfg" local gui_rpc_auth="$(get_boincdir)/gui_rpc_auth.cfg"
local passwd=$(cat "${EROOT}${gui_rpc_auth}") local passwd=$(cat "${EROOT}/${gui_rpc_auth}" 2>/dev/null)
if [[ ! ${passwd} ]]; then if [[ -z ${passwd} ]]; then
passwd="\$(cat ${gui_rpc_auth})" passwd="\$(cat ${gui_rpc_auth})"
fi fi
elog
elog "You should detach this project from the BOINC client" elog "You should detach this project from the BOINC client"
elog "to stop current tasks and delete remaining project files:" elog "to stop current tasks and delete remaining project files:"
elog elog