Improvements in .templates/bin scripts:

* obsolescent egrep calls have removed;
* /usr/local/bin has been added to PATH for cron calls.
This commit is contained in:
Kovács Zoltán
2026-05-04 15:18:28 +02:00
parent 9dab9d465d
commit 4e405a7f7a
7 changed files with 37 additions and 23 deletions
+6 -3
View File
@@ -7,6 +7,9 @@
# Author: Kovács Zoltán <kovacs.zoltan@smartfront.hu>
# Kovács Zoltán <kovacsz@marcusconsulting.hu>
# License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html)
# 2026-05-04 v1.1
# mod: the obsolescent egrep calls have been changed to POSIX grep -E calls.
# fix: /usr/local/bin was missing from the PATH for cron calls.
# 2023-06-18 v1.0
# new: forked from the "SMARTERP_skeleton" repository.
# mod: "instance" => "service"
@@ -45,14 +48,14 @@ if [ -n "$CRON" ]; then
# Ubuntu gets the initial environment from a separate file.
if [ -r "/etc/environment" ]; then
# Extracts from this file, strips the right part w/o quotes.
includepath=$(cat "/etc/environment" | $(which egrep) '^PATH=')
includepath=$(cat "/etc/environment" | $(which grep) -E '^PATH=')
includepath=${includepath:5}
includepath="${includepath%\"}"; includepath="${includepath#\"}"
[[ -n "$includepath" ]] && PATH="$PATH:$includepath"
unset includepath
fi
# We need the $HOME/bin as well.
PATH="$HOME/bin:$PATH"
# We need the $HOME/bin and /usr/local/bin paths as well.
PATH="$HOME/bin:/usr/local/bin:$PATH"
fi
# We need also the sbin directories.
if ! [[ "$PATH" =~ '/sbin:' ]]; then PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"; fi