From 257aab6f3228ff372a6703880b313d539037465d Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sun, 20 Oct 2024 14:34:47 +0200 Subject: common_service.sh: check for files before using them --- .config/common_service.sh | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to '.config/common_service.sh') 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 -- cgit v1.2.3