index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Levente Polyak <anthraxx@archlinux.org> | 2023-04-05 22:58:49 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2023-05-20 00:08:12 +0200 |
commit | bc182032eb4a1cbae573c9f09bdd9f8338b20d23 (patch) | |
tree | dde5914cd92389f19ec0a99e094c1f9cc7bdfcea /src/lib/config.sh | |
parent | f3518e248cc8be165009f2200ff3b6500bfc0476 (diff) |
-rw-r--r-- | src/lib/config.sh | 21 |
diff --git a/src/lib/config.sh b/src/lib/config.sh index ba6532e..b09479a 100644 --- a/src/lib/config.sh +++ b/src/lib/config.sh @@ -14,6 +14,13 @@ readonly XDG_DEVTOOLS_GITLAB_CONFIG="${XDG_DEVTOOLS_DIR}/gitlab.conf" export GITLAB_TOKEN="" load_devtools_config() { + # temporary permission fixup + if [[ -d "${XDG_DEVTOOLS_DIR}" ]]; then + chmod 700 "${XDG_DEVTOOLS_DIR}" + fi + if [[ -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then + chmod 600 "${XDG_DEVTOOLS_GITLAB_CONFIG}" + fi if [[ -n "${DEVTOOLS_GITLAB_TOKEN}" ]]; then GITLAB_TOKEN="${DEVTOOLS_GITLAB_TOKEN}" return @@ -26,6 +33,16 @@ load_devtools_config() { } save_devtools_config() { - mkdir -p "${XDG_DEVTOOLS_DIR}" - printf 'GITLAB_TOKEN="%s"\n' "${GITLAB_TOKEN}" > "${XDG_DEVTOOLS_GITLAB_CONFIG}" + # temporary permission fixup + if [[ -d "${XDG_DEVTOOLS_DIR}" ]]; then + chmod 700 "${XDG_DEVTOOLS_DIR}" + fi + if [[ -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then + chmod 600 "${XDG_DEVTOOLS_GITLAB_CONFIG}" + fi + ( + umask 0077 + mkdir -p "${XDG_DEVTOOLS_DIR}" + printf 'GITLAB_TOKEN="%s"\n' "${GITLAB_TOKEN}" > "${XDG_DEVTOOLS_GITLAB_CONFIG}" + ) } |