Gentoo Archives: gentoo-commits

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/
Date: Sat, 25 Jun 2022 17:43:30
Message-Id: 1656178935.598d011fca2332523f6a2bf506647fc44f2f031d.cybertailor@gentoo
1 commit: 598d011fca2332523f6a2bf506647fc44f2f031d
2 Author: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
3 AuthorDate: Sat Jun 25 15:46:59 2022 +0000
4 Commit: Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
5 CommitDate: Sat Jun 25 17:42:15 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=598d011f
7
8 boinc-app.eclass: fix paths and permissions
9
10 Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>
11
12 eclass/boinc-app.eclass | 36 +++++++++++++++++++++++++++---------
13 1 file changed, 27 insertions(+), 9 deletions(-)
14
15 diff --git a/eclass/boinc-app.eclass b/eclass/boinc-app.eclass
16 index 496dbb337..8478c373d 100644
17 --- a/eclass/boinc-app.eclass
18 +++ b/eclass/boinc-app.eclass
19 @@ -1,4 +1,4 @@
20 -# Copyright 2021 Gentoo Authors
21 +# Copyright 2021-2022 Gentoo Authors
22 # Distributed under the terms of the GNU General Public License v2
23
24 # @ECLASS: boinc-app.eclass
25 @@ -142,6 +142,21 @@ get_project_root() {
26 echo "$(get_boincdir)/projects/$(get_project_dirname)"
27 }
28
29 +# @FUNCTION: _boinc-app_fix_permissions
30 +# @USAGE:
31 +# @INTERNAL
32 +# @DESCRIPTION:
33 +# Fix owner and permissions for the project root.
34 +_boinc-app_fix_permissions() {
35 + local paths=(
36 + $(get_boincdir)
37 + $(get_boincdir)/projects
38 + $(get_project_root)
39 + )
40 + fowners boinc:boinc "${paths[@]}"
41 + fperms 0771 "${paths[@]}"
42 +}
43 +
44 # @FUNCTION: boinc-app_appinfo_prepare
45 # @USAGE: <writable app_info.xml>
46 # @DESCRIPTION:
47 @@ -151,7 +166,7 @@ boinc-app_appinfo_prepare() {
48 debug-print-function ${FUNCNAME} "${@}"]
49
50 sed -i "$1" \
51 - -e "s:%PV%:${PV}:g" \
52 + -e "s:@PV@:${PV}:g" \
53 || die "app_info.xml sed failed"
54 }
55
56 @@ -199,6 +214,8 @@ doappinfo() {
57 insopts -m 0644 --owner boinc --group boinc
58 doins "${T}"/app_info.xml
59 ) || die "failed to install app_info.xml"
60 +
61 + _boinc-app_fix_permissions
62 }
63
64 # @FUNCTION: boinc-wrapper_foreach_wrapper_job
65 @@ -263,10 +280,12 @@ dowrapper() {
66 ( # subshell to avoid pollution of calling environment
67 insinto $(get_project_root)
68 insopts -m 0644 --owner boinc --group boinc
69 - doins "${T}"/${wrapperjob}
70 + doins "${T}/${wrapperjob}"
71 dosym -r /usr/bin/boinc-wrapper "$(get_project_root)/${wrapperexe}"
72 ) || die "failed to install '${app}' wrapper app"
73 done
74 +
75 + _boinc-app_fix_permissions
76 }
77
78 # @FUNCTION: boinc-app_pkg_postinst
79 @@ -276,8 +295,8 @@ dowrapper() {
80 boinc-app_pkg_postinst() {
81 debug-print-function ${FUNCNAME} "${@}"]
82
83 - if [[ -f "${EROOT}$(get_boincdir)/master_$(get_project_dirname).xml" ]]; then
84 - if [[ ! ${REPLACING_VERSIONS} ]]; then
85 + if [[ -f "${EROOT}/$(get_boincdir)/master_$(get_project_dirname).xml" ]]; then
86 + if [[ -z ${REPLACING_VERSIONS} ]]; then
87 # most likely replacing applications downloaded
88 # by the BOINC client from project's website
89 elog "Restart the BOINC daemon for changes to take place:"
90 @@ -311,14 +330,13 @@ boinc-app_pkg_postinst() {
91 boinc-app_pkg_postrm() {
92 debug-print-function ${FUNCNAME} "${@}"]
93
94 - if [[ ! ${REPLACED_BY_VERSION} ]]; then
95 + if [[ -z ${REPLACING_VERSIONS} ]]; then
96 local gui_rpc_auth="$(get_boincdir)/gui_rpc_auth.cfg"
97 - local passwd=$(cat "${EROOT}${gui_rpc_auth}")
98 - if [[ ! ${passwd} ]]; then
99 + local passwd=$(cat "${EROOT}/${gui_rpc_auth}" 2>/dev/null)
100 + if [[ -z ${passwd} ]]; then
101 passwd="\$(cat ${gui_rpc_auth})"
102 fi
103
104 - elog
105 elog "You should detach this project from the BOINC client"
106 elog "to stop current tasks and delete remaining project files:"
107 elog