1 |
Bug: https://bugs.gentoo.org/497798 |
2 |
Signed-off-by: Ulrich Müller <ulm@g.o> |
3 |
--- |
4 |
eclass/bzr.eclass | 22 ++++++++++++++++++++-- |
5 |
1 file changed, 20 insertions(+), 2 deletions(-) |
6 |
|
7 |
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass |
8 |
index 10bd6bc7e5a..598a0f87fe6 100644 |
9 |
--- a/eclass/bzr.eclass |
10 |
+++ b/eclass/bzr.eclass |
11 |
@@ -140,6 +140,17 @@ EXPORT_FUNCTIONS src_unpack |
12 |
# by users. |
13 |
: ${EBZR_OFFLINE=${EVCS_OFFLINE}} |
14 |
|
15 |
+# @ECLASS-VARIABLE: EVCS_UMASK |
16 |
+# @DEFAULT_UNSET |
17 |
+# @DESCRIPTION: |
18 |
+# Set this variable to a custom umask. This is intended to be set by |
19 |
+# users. By setting this to something like 002, it can make life easier |
20 |
+# for people who do development as non-root (but are in the portage |
21 |
+# group), and then switch over to building with FEATURES=userpriv. |
22 |
+# Or vice-versa. Shouldn't be a security issue here as anyone who has |
23 |
+# portage group write access already can screw the system over in more |
24 |
+# creative ways. |
25 |
+ |
26 |
# @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT |
27 |
# @DEFAULT_UNSET |
28 |
# @DESCRIPTION: |
29 |
@@ -197,7 +208,7 @@ bzr_update() { |
30 |
# working copy. |
31 |
bzr_fetch() { |
32 |
local repo_dir branch_dir |
33 |
- local save_sandbox_write=${SANDBOX_WRITE} |
34 |
+ local save_sandbox_write=${SANDBOX_WRITE} save_umask |
35 |
|
36 |
[[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty" |
37 |
|
38 |
@@ -214,6 +225,10 @@ bzr_fetch() { |
39 |
repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT} |
40 |
branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}} |
41 |
|
42 |
+ if [[ -n ${EVCS_UMASK} ]]; then |
43 |
+ save_umask=$(umask) |
44 |
+ umask "${EVCS_UMASK}" || die |
45 |
+ fi |
46 |
addwrite "${EBZR_STORE_DIR}" |
47 |
|
48 |
if [[ ! -d ${branch_dir}/.bzr ]]; then |
49 |
@@ -240,8 +255,11 @@ bzr_fetch() { |
50 |
bzr_update "${EBZR_REPO_URI}" "${branch_dir}" |
51 |
fi |
52 |
|
53 |
- # Restore sandbox environment |
54 |
+ # Restore sandbox environment and umask |
55 |
SANDBOX_WRITE=${save_sandbox_write} |
56 |
+ if [[ -n ${save_umask} ]]; then |
57 |
+ umask "${save_umask}" || die |
58 |
+ fi |
59 |
|
60 |
cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}" |
61 |
|
62 |
-- |
63 |
2.23.0 |