aboutsummaryrefslogtreecommitdiff
path: root/.config/common_service.sh
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2024-10-20 12:34:47 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2024-10-20 12:34:47 +0000
commit257aab6f3228ff372a6703880b313d539037465d (patch)
treefc977183ff21f5efd7c74f6d4185598e7bafda48 /.config/common_service.sh
parentbc73bd092c633ea088776ac42be11044833a2f36 (diff)
downloaddotfiles-257aab6f3228ff372a6703880b313d539037465d.tar
dotfiles-257aab6f3228ff372a6703880b313d539037465d.tar.gz
dotfiles-257aab6f3228ff372a6703880b313d539037465d.tar.bz2
dotfiles-257aab6f3228ff372a6703880b313d539037465d.tar.lz
dotfiles-257aab6f3228ff372a6703880b313d539037465d.tar.xz
dotfiles-257aab6f3228ff372a6703880b313d539037465d.tar.zst
dotfiles-257aab6f3228ff372a6703880b313d539037465d.zip
common_service.sh: check for files before using them
Diffstat (limited to '')
-rw-r--r--.config/common_service.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/.config/common_service.sh b/.config/common_service.sh
index 50c34ee..d1322cf 100644
--- a/.config/common_service.sh
+++ b/.config/common_service.sh
@@ -1,12 +1,26 @@
#!/usr/bin/env sh
: ${TURNSTILE_ENV_DIR:="${HOME}/.config/service-env"}
-. /etc/profile
+if [ ! -d "${TURNSTILE_ENV_DIR}" ]
+then
+ mkdir -p "${TURNSTILE_ENV_DIR}"
+fi
-for file in /etc/profile.d/*.sh
-do
- . "$file"
-done
+if [ -f "/etc/profile" ]
+then
+ . "/etc/profile"
+fi
-. "$HOME/.profile"
+if [ -d "/etc/profile.d/" ]
+then
+ for file in /etc/profile.d/*.sh
+ do
+ . "$file"
+ done
+fi
+
+if [ -f "$HOME/.profile" ]
+then
+ . "$HOME/.profile"
+fi