From 4e405a7f7a2cb39037cd3e97e492facbcd0eafdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kov=C3=A1cs=20Zolt=C3=A1n?= Date: Mon, 4 May 2026 15:18:28 +0200 Subject: [PATCH] Improvements in .templates/bin scripts: * obsolescent egrep calls have removed; * /usr/local/bin has been added to PATH for cron calls. --- .metadata | Bin 22705 -> 22705 bytes .templates/bin/.launcher | 10 ++++++---- .templates/bin/maintenance_daily | 6 ++++-- .templates/bin/maintenance_midnight | 9 ++++++--- .templates/bin/maintenance_reboot | 9 ++++++--- .templates/bin/psql_dumpdb | 12 +++++++----- .templates/bin/rotate_folder | 14 ++++++++------ 7 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.metadata b/.metadata index ff2283121d1abf0e0560157d6aff02e6374ea828..59cbf4c2e1a0c3e1c8d56ee3801ba8067e7f0f69 100644 GIT binary patch delta 137 zcmdnEk#XZj#tq9jc(P~y$YcP5gDV$^Pi_>@o*cl&Kgo!9^G}XnA}p1;KQbqOlv187 zB`3zRE+5R1-yAGg#>lcd2Fw$gyo`r`^9T6@@+=VrU=gLw*X+-6up~lMi%#BWz%e<2 aQE2jkK-SH7JVJR{YBC{)ZjK0xWC8&A-8dEi delta 129 zcmdnEk#XZj#tq9jc>D{#WikN4#uOjX$&CWqlLOfJCmHc>{>kx6gz3BS # Kovács Zoltán # 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" @@ -95,14 +98,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 @@ -111,7 +114,6 @@ if ! [[ "$PATH" =~ '/sbin:' ]]; then PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin # TR=$(which tr 2>/dev/null) if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi -#for item in basename df egrep head mail printf sleep for item in basename printf sleep do if [ -n "$(which $item)" ] diff --git a/.templates/bin/maintenance_daily b/.templates/bin/maintenance_daily index bbbc13b..eef93af 100755 --- a/.templates/bin/maintenance_daily +++ b/.templates/bin/maintenance_daily @@ -7,6 +7,8 @@ # Author: Kovács Zoltán # Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) +# 2026-05-04 v1.2 +# fix: /usr/local/bin was missing from the PATH for cron calls. # 2026-05-01 v1.1 # new: dnf support has been added for Oracle/RHEL compatibility. # mod: the egrep calls have been replaced by grep -E command @@ -66,8 +68,8 @@ if [ -n "$CRON" ]; then [[ -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 diff --git a/.templates/bin/maintenance_midnight b/.templates/bin/maintenance_midnight index 5dce4ea..2c8f0b7 100755 --- a/.templates/bin/maintenance_midnight +++ b/.templates/bin/maintenance_midnight @@ -7,6 +7,9 @@ # Author: Kovács Zoltán # Kovács Zoltán # 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 diff --git a/.templates/bin/maintenance_reboot b/.templates/bin/maintenance_reboot index 004ec2c..886b306 100755 --- a/.templates/bin/maintenance_reboot +++ b/.templates/bin/maintenance_reboot @@ -7,6 +7,9 @@ # Author: Kovács Zoltán # Kovács Zoltán # 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 diff --git a/.templates/bin/psql_dumpdb b/.templates/bin/psql_dumpdb index e6666ad..598ef35 100755 --- a/.templates/bin/psql_dumpdb +++ b/.templates/bin/psql_dumpdb @@ -20,6 +20,8 @@ # Author: Kovács Zoltán # Kovács Zoltán # 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. # 2023-06-18 v1.0 # new: forked from the "SMARTERP_skeleton" repository. # 2022-11-03 v0.4 @@ -131,7 +133,7 @@ done; shift $((OPTIND -1)) # Common dependencies. TR=$(which tr 2>/dev/null) if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi -for item in basename df date dirname egrep grep gzip hostname id \ +for item in basename df date dirname grep gzip hostname id \ pwd sed tail tee $additem do if [ -n "$(which $item)" ] @@ -346,8 +348,8 @@ else # 1st the schema with some arbitrary conversions. "$PG_DUMP" $CONNECT \ $PGDUMPACLS --schema-only -d "$PGDATABASE" | \ - "$EGREP" -iv '^SET idle_in_transaction_session_timeout =' | \ - "$EGREP" -iv '^SET default_table_access_method =' | \ + "$GREP" -E -iv '^SET idle_in_transaction_session_timeout =' | \ + "$GREP" -E -iv '^SET default_table_access_method =' | \ "$SED" 's/FUNCTION =/PROCEDURE = /' | \ "$SED" "s/CURRENT_DATE/\('now'::text\)::date/g" # 2nd the data as COPY statements. @@ -358,8 +360,8 @@ else # 1st the schema with some arbitrary conversions. "$PG_DUMP" $CONNECT \ $PGDUMPACLS --schema-only -d "$PGDATABASE" | \ - "$EGREP" -iv '^SET idle_in_transaction_session_timeout =' | \ - "$EGREP" -iv '^SET default_table_access_method =' | \ + "$GREP" -E -iv '^SET idle_in_transaction_session_timeout =' | \ + "$GREP" -E -iv '^SET default_table_access_method =' | \ "$SED" 's/FUNCTION =/PROCEDURE = /' | \ "$SED" "s/CURRENT_DATE/\('now'::text\)::date/g" \ >"$PGDUMPFILE" 2>>"$logfile"; result=$? diff --git a/.templates/bin/rotate_folder b/.templates/bin/rotate_folder index 18c0647..20a3653 100755 --- a/.templates/bin/rotate_folder +++ b/.templates/bin/rotate_folder @@ -55,6 +55,8 @@ # Author: Kovács Zoltán # Kovács Zoltán # License: GNU/GPL v3+ (https://www.gnu.org/licenses/gpl-3.0.en.html) +# 2026-05-04 v1.4 +# mod: the obsolescent egrep calls have been changed to POSIX grep -E calls. # 2025-09-15 v1.3 # fix: now correctly handles "zero elements to keep" directives. # 2025-08-12 v1.2 @@ -127,7 +129,7 @@ done # Checks the dependencies. TR=$(which tr 2>/dev/null) if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi -for item in basename date dirname egrep sed seq sort stat xargs +for item in basename date dirname grep sed seq sort stat xargs do if [ -n "$(which $item)" ] then export $(echo $item | "$TR" '[:lower:]' '[:upper:]')=$(which $item) @@ -219,11 +221,11 @@ function rotate_class { if [ -z "$CLASSES_PATTERN" ]; then # All non-hidden files but no subfolders, symlinks, etc. files=$(cd "$BACKUP_FOLDER"; \ - ls -1 -t --file-type | "$XARGS" -0 | "$EGREP" -v '[/=>@|$]$' ) + ls -1 -t --file-type | "$XARGS" -0 | "$GREP" -E -v '[/=>@|$]$' ) else # Non-hidden files (but no subfolders, symlinks, etc.) matching to the pattern. files=$(cd "$BACKUP_FOLDER"; \ - ls -1 -t --file-type | "$XARGS" -0 | "$EGREP" "$CLASSES_PATTERN" ) + ls -1 -t --file-type | "$XARGS" -0 | "$GREP" -E "$CLASSES_PATTERN" ) fi # Lack of files gives it up here. [[ -z "$files" ]] && return @@ -401,7 +403,7 @@ function rotate_classes { # Tries to validate the pattern. # Test calls simulate the later use. if [ -n "$CLASSES_PATTERN" ]; then - echo "test" | "$EGREP" "$CLASSES_PATTERN" >/dev/null 2>&1 + echo "test" | "$GREP" -E "$CLASSES_PATTERN" >/dev/null 2>&1 [[ $? -gt 1 ]] && return # unusable fi # Does contain unexplored classifiers? @@ -413,7 +415,7 @@ function rotate_classes { # Needs further exploring. # Non-hidden files (but no subfolders, symlinks, etc.) matching to the pattern. local files=$(cd "$BACKUP_FOLDER"; \ - ls -1 -t --file-type | "$XARGS" -0 | "$EGREP" "$CLASSES_PATTERN" ) + ls -1 -t --file-type | "$XARGS" -0 | "$GREP" -E "$CLASSES_PATTERN" ) # Selects the qualifier substrings which actually have matching files. local classes=$(echo -e "$files" | "$SED" -E "s/$CLASSES_PATTERN/\1/" | "$SORT" -u) # Enumerates these qualifiers. @@ -434,7 +436,7 @@ if [ -z "$CLASSES_PATTERN" ]; then rotate_class else # Tries to validate the pattern (loosely). - echo "test" | "$EGREP" "$CLASSES_PATTERN" >/dev/null 2>&1 + echo "test" | "$GREP" -E "$CLASSES_PATTERN" >/dev/null 2>&1 [[ $? -gt 1 ]] && echo -e "$MSG_BADPATTERN $CLASSES_PATTERN" >&2 && exit 1 # Seems to be valid, go on! rotate_classes "$CLASSES_PATTERN"