From ad74bc6915e8567cbd547fd5ff5bfb7a321d84f3 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:07:48 -0800 Subject: [PATCH 1/5] Improvements to UI Messages Improved UI messages related to syslog-ng configuration options check. --- README.md | 4 +-- scribe.sh | 95 +++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index b9849ff..4c17377 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** -## v3.2.8 -### Updated on 2026-Jan-25 +## v3.2.9 +### Updated on 2026-Jan-29 ## Getting Started diff --git a/scribe.sh b/scribe.sh index 4385f9c..802194f 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Jan-25 +# Last Modified: 2026-Jan-29 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -34,8 +34,8 @@ ################################################################# readonly script_name="scribe" -readonly scribe_ver="v3.2.8" -readonly scriptVer_TAG="26012523" +readonly scribe_ver="v3.2.9" +readonly scriptVer_TAG="26012900" scribe_branch="develop" script_branch="$scribe_branch" @@ -196,6 +196,7 @@ readonly syslogNg_ConfName=${syslogNgStr}.conf readonly syslogNg_TopConfig="/opt/etc/$syslogNg_ConfName" readonly syslogNg_WaitnSEM_FPath="${TEMPdir}/scribe_SysLogNg.WAITN.SEM" readonly syslogNg_StartSEM_FPath="${TEMPdir}/scribe_SysLogNg.START.SEM" +readonly syslogD_InitRebootLogFPath="${optVarLogDir}/syslog_init_reboot.LOG" readonly sysLogLinesMAX=20480 readonly sysLogMsgeSizeMAX=2048 sysLogFiFoSizeMIN=1024 @@ -1064,15 +1065,20 @@ _SysLogMsgSizeFromConfig_() if [ -n "$msgSizeNum" ] && [ "$msgSizeNum" -gt "$sysLogMsgeSizeMAX" ] then msgSizeOK=false fi - "$msgSizeOK" && return 0 - if [ "$1" = "check" ] - then return 1 - elif [ "$1" = "update" ] - then - sed -i "s/log_msg_size($msgSizeNum)/log_msg_size($sysLogMsgeSizeMAX)/g" "$sng_conf" - return 0 - fi + case "$1" in + check) + "$msgSizeOK" && return 0 || return 1 + ;; + update) + "$msgSizeOK" && return 1 #NO Change# + sed -i "s/log_msg_size($msgSizeNum)/log_msg_size($sysLogMsgeSizeMAX)/g" "$sng_conf" + return 0 + ;; + *) + return 1 + ;; + esac } ##-------------------------------------## @@ -1089,25 +1095,30 @@ _SysLogFiFoSizeFromConfig_() if [ -n "$fifoSizeNum" ] && [ "$fifoSizeNum" -lt "$sysLogFiFoSizeMIN" ] then fifoSizeOK=false fi - "$fifoSizeOK" && return 0 - if [ "$1" = "check" ] - then return 1 - elif [ "$1" = "update" ] - then - sed -i "s/log_fifo_size($fifoSizeNum)/log_fifo_size($sysLogFiFoSizeMIN)/g" "$sng_conf" - return 0 - fi + case "$1" in + check) + "$fifoSizeOK" && return 0 || return 1 + ;; + update) + "$fifoSizeOK" && return 1 #NO Change# + sed -i "s/log_fifo_size($fifoSizeNum)/log_fifo_size($sysLogFiFoSizeMIN)/g" "$sng_conf" + return 0 + ;; + *) + return 1 + ;; + esac } ##----------------------------------------## -## Modified by Martinski W. [2026-Jan-03] ## +## Modified by Martinski W. [2026-Jan-29] ## ##----------------------------------------## SysLogNg_Config_Sync() { local sng_conf_vtag1 sng_conf_vtag2 sng_version_str sng_conf_verstr - printf "$white %34s" "$( strip_path "$sng_conf" ) version check ..." + printf " ${white}%34s" "$(strip_path "$sng_conf") options check ..." sng_conf_vtag1="@version:" sng_conf_vtag2="${sng_conf_vtag1}[[:blank:]]*" sng_version_str="$( $sng --version | grep -m1 "$sng" | grep -oE '[0-9]{1,2}([_.][0-9]{1,2})' )" @@ -1118,29 +1129,42 @@ SysLogNg_Config_Sync() ! _SysLogFiFoSizeFromConfig_ check || \ [ "$sng_version_str" != "$sng_conf_verstr" ] then - printf "$red out of sync! (%s) $std\n" "$sng_conf_verstr" - printf "$cyan *** Updating %s and restarting %s *** $std\n" "$( strip_path "$sng_conf" )" "$sng" + printf " ${red}out of sync!${std}\n" + printf " ${cyan}*** Updating %s and restarting %s ***${std}\n" "$(strip_path "$sng_conf")" "$sng" $S01sng_init stop old_doc="doc\/syslog-ng-open" new_doc="list\/syslog-ng-open-source-edition" sed -i "s/$old_doc.*/$new_doc/" "$sng_conf" stats_freq="$( grep -m1 'stats_freq(' "$sng_conf" | cut -d ';' -f 1 | grep -oE '[0-9]*' )" [ -n "$stats_freq" ] && sed -i "s/stats_freq($stats_freq)/stats(freq($stats_freq))/g" "$sng_conf" + if [ -n "$sng_version_str" ] && \ [ -n "$sng_conf_verstr" ] && \ [ "$sng_version_str" != "$sng_conf_verstr" ] then + printf "\n ${red}%34s${std}\n" "version number out of sync!" sed -i "s/^${sng_conf_vtag2}${sng_conf_verstr}.*/$sng_conf_vtag1 $sng_version_str/" "$sng_conf" + printf " ${white}%34s" "$(strip_path "$sng_conf") version ..." + printf " ${yellow}updated! (%s)${std}\n" "$sng_version_str" + logger -t "$script_name" "$(strip_path "$sng_conf") version number updated ($sng_version_str)!" + fi + if _SysLogMsgSizeFromConfig_ update + then + printf "\n ${red}%34s${std}\n" "Log message size out of sync!" + printf " ${white}%34s" "$(strip_path "$sng_conf") log message size ..." + printf " ${yellow}updated! (%d)${std}\n" "$sysLogMsgeSizeMAX" + fi + if _SysLogFiFoSizeFromConfig_ update + then + printf "\n ${red}%34s${std}\n" "Log FIFO size out of sync!" + printf " ${white}%34s" "$(strip_path "$sng_conf") log FIFO size ..." + printf " ${yellow}updated! (%d)${std}\n" "$sysLogFiFoSizeMIN" fi - _SysLogMsgSizeFromConfig_ update - _SysLogFiFoSizeFromConfig_ update + echo $S01sng_init start Restart_uiScribe - printf "$white %34s" "$( strip_path "$sng_conf" ) version ..." - printf "$yellow updated! (%s) $std\n" "$sng_version_str" - logger -t "$script_name" "$( strip_path "$sng_conf" ) version number updated ($sng_version_str)!" else - printf "$green in sync. (%s) $std\n" "$sng_version_str" + printf " ${green}in sync. (v%s)${std}\n" "$sng_version_str" fi } @@ -1737,7 +1761,7 @@ Menu_Install() fi echo rm -f "$syslogNg_WaitnSEM_FPath" - echo "1" > "$syslogNg_StartSEM_FPath" + echo '1' > "$syslogNg_StartSEM_FPath" $S01sng_init start if [ ! -e "$lr_loc" ] @@ -1819,9 +1843,9 @@ StopSyslogNg() fi tail -n $lastNLines "$optmsg" > "$syslog_loc" - if ! "$usbUnmountCaller" - then rm -f "$messagesLogSAVED" - else mv -f "$optmsg" "$messagesLogSAVED" + if "$usbUnmountCaller" + then mv -f "$optmsg" "$messagesLogSAVED" + else rm -f "$messagesLogSAVED" "$syslogD_InitRebootLogFPath" fi ln -snf "$syslog_loc" "$optmsg" @@ -2044,7 +2068,7 @@ Menu_Update() Copy_LogRotate_Global_Options "$@" printf "\n$white %s updated!$std\n" "$script_name" rm -f "$syslogNg_WaitnSEM_FPath" - echo "1" > "$syslogNg_StartSEM_FPath" + echo '1' > "$syslogNg_StartSEM_FPath" sh "$script_loc" filters gotzip nologo sh "$script_loc" status nologo run_scribe=true @@ -2842,7 +2866,8 @@ then fi if [ "$action" != "help" ] && \ - [ "$action" != "about" ] + [ "$action" != "about" ] && \ + [ "$action" != "install" ] then # Read or create config file # Read_Config From ced4c4f7c7d461ffcd11edc2cb42e243fc6ef4ba Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Fri, 30 Jan 2026 23:54:32 -0800 Subject: [PATCH 2/5] Functional Improvements - Modified code to be able to filter the initial log messages generated during the reboot process when syslog-ng has not yet been started. - Miscellaneous code improvements. --- README.md | 2 +- init.d/rc.func.syslog-ng | 37 ++++++-- scribe.sh | 116 +++++++++++++++----------- syslog-ng.share/README.1ST | 27 +++--- syslog-ng.share/syslog-ng.conf-scribe | 16 +++- 5 files changed, 127 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 4c17377..e45e460 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.9 -### Updated on 2026-Jan-29 +### Updated on 2026-Jan-30 ## Getting Started diff --git a/init.d/rc.func.syslog-ng b/init.d/rc.func.syslog-ng index a90d559..50a005d 100644 --- a/init.d/rc.func.syslog-ng +++ b/init.d/rc.func.syslog-ng @@ -1,8 +1,8 @@ #!/bin/sh - # # NB: rc.func only runs PRECMD on "start" -# Last Modified: 2026-Jan-25 -# VERSION="3.1.4" +# Last Modified: 2026-Jan-27 +# VERSION="3.1.5" #------------------------------------------- ## Run the F/W built-in native commands ## @@ -21,12 +21,14 @@ logTagStr="scribe:kill_logger[$$]" logPrioNum="-p 4" ##----------------------------------------## -## Modified by Martinski W. [2026-Jan-25] ## +## Modified by Martinski W. [2026-Jan-30] ## ##----------------------------------------## kill_logger() { local serviceCallOK prevSysLog_Loc messagesLogSAVED local scribeScriptFPath="/jffs/scripts/scribe" + local booleanStr=false filterSyslogInitRebootLogMsgs=true + local syslogD_InitRebootLogPath="/opt/var/log/syslogd.ScribeInitReboot.LOG" local syslogNG_WaitnSEM_FPath="/tmp/var/tmp/scribe_SysLogNg.WAITN.SEM" local syslogNG_StartSEM_FPath="/tmp/var/tmp/scribe_SysLogNg.START.SEM" @@ -55,14 +57,14 @@ kill_logger() [ -z "$script_conf" ] && script_conf="/jffs/addons/scribe.d/config" isjffs=false prevSysLog_Loc="$syslog_loc" - messagesLogSAVED="${optmsg}.SAVED.LOG" + messagesLogSAVED="${optmsg}.Scribe_SAVED.LOG" # Figure out where syslogd expects log file to live # if [ -z "$syslog_loc" ] # do NOT look for config file if $syslog_loc is defined # then if [ -s "$script_conf" ] && $grepCmd -q "^SYSLOG_LOC=" "$script_conf" then - syslog_loc="$($grepCmd "^SYSLOG_LOC=" "$script_conf" | $cutCmd -f2 -d'=')" + syslog_loc="$($grepCmd "^SYSLOG_LOC=" "$script_conf" | $cutCmd -d'=' -f2)" elif [ -n "$($pidofCmd syslogd)" ] then findStr="$($psCmd ww | $grepCmd '/syslogd' | $grepCmd -oE '\-O .*/syslog.log')" @@ -79,6 +81,16 @@ kill_logger() fi fi + if [ -s "$script_conf" ] && \ + $grepCmd -q "^FILTER_INIT_REBOOT_LOG=" "$script_conf" + then + booleanStr="$($grepCmd "^FILTER_INIT_REBOOT_LOG=" "$script_conf" | $cutCmd -d'=' -f2)" + fi + if [ "$booleanStr" = "true" ] + then filterSyslogInitRebootLogMsgs=true + else filterSyslogInitRebootLogMsgs=false + fi + if "$serviceCallOK" then $loggerCmd -t "$logTagStr" $logPrioNum "optmsg=[$optmsg]" @@ -131,15 +143,26 @@ kill_logger() $rmCmd -f "$messagesLogSAVED" fi log1Msg="### Top of Log File ###" + printf '' > "$syslogD_InitRebootLogPath" + if [ ! -d "${syslog_loc}-1" ] && \ [ ! -L "${syslog_loc}-1" ] && \ [ -s "${syslog_loc}-1" ] && \ [ "$(head -n1 "${syslog_loc}-1")" != "$log1Msg" ] && \ [ "$(tail -n1 "${syslog_loc}-1")" != "$log1Msg" ] then ## Transfer 1st part of the system log ## - $catCmd "${syslog_loc}-1" >> "$optmsg" + if ! "$filterSyslogInitRebootLogMsgs" + then $catCmd "${syslog_loc}-1" >> "$optmsg" + else $catCmd "${syslog_loc}-1" > "$syslogD_InitRebootLogPath" + fi + fi + if [ -s "$syslog_loc" ] + then + if ! "$filterSyslogInitRebootLogMsgs" + then $catCmd "$syslog_loc" >> "$optmsg" + else $catCmd "$syslog_loc" >> "$syslogD_InitRebootLogPath" + fi fi - [ -s "$syslog_loc" ] && $catCmd "$syslog_loc" >> "$optmsg" $rmCmd -f "$syslog_loc" "${syslog_loc}-1" $lnCmd -snf "$optmsg" "$syslog_loc" echo "$log1Msg" > "${syslog_loc}-1" diff --git a/scribe.sh b/scribe.sh index 802194f..860a9ed 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Jan-29 +# Last Modified: 2026-Jan-30 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.9" -readonly scriptVer_TAG="26012900" +readonly scriptVer_TAG="26013023" scribe_branch="develop" script_branch="$scribe_branch" @@ -196,10 +196,10 @@ readonly syslogNg_ConfName=${syslogNgStr}.conf readonly syslogNg_TopConfig="/opt/etc/$syslogNg_ConfName" readonly syslogNg_WaitnSEM_FPath="${TEMPdir}/scribe_SysLogNg.WAITN.SEM" readonly syslogNg_StartSEM_FPath="${TEMPdir}/scribe_SysLogNg.START.SEM" -readonly syslogD_InitRebootLogFPath="${optVarLogDir}/syslog_init_reboot.LOG" +readonly syslogD_InitRebootLogFPath="${optVarLogDir}/syslogd.ScribeInitReboot.LOG" readonly sysLogLinesMAX=20480 readonly sysLogMsgeSizeMAX=2048 -sysLogFiFoSizeMIN=1024 +sysLogFiFoSizeMIN=1600 # color constants # readonly red="\033[1;31m" @@ -285,7 +285,8 @@ delfr(){ rm -fr "$1"; } same_same(){ if [ "$( md5_file "$1" )" = "$( md5_file "$2" )" ]; then true; else false; fi; } -date_stamp(){ [ -e "$1" ] && mv -f "$1" "$1-$( date -Iseconds | cut -c 1-19 )"; } +AppendDateTimeStamp() +{ [ -e "$1" ] && mv -f "$1" "${1}_$(date +'%Y-%m-%d_T%H%M%S')"; } SyslogNg_Running(){ if [ -n "$( pidof $sng )" ]; then true; else false; fi; } @@ -501,7 +502,7 @@ Create_Config() } ##----------------------------------------## -## Modified by Martinski W. [2025-Nov-29] ## +## Modified by Martinski W. [2026-Jan-30] ## ##----------------------------------------## Read_Config() { @@ -517,6 +518,10 @@ Read_Config() then _Config_Option_Update_ LR_CRONJOB_HOUR 24 fi + if ! _Config_Option_Check_ FILTER_INIT_REBOOT_LOG + then + _Config_Option_Update_ FILTER_INIT_REBOOT_LOG true + fi # Set correct permissions to avoid "world-readable" status # if [ "$action" != "debug" ] && \ @@ -531,7 +536,7 @@ Read_Config() Update_File() { if [ $# -gt 2 ] && [ "$3" = "backup" ] - then date_stamp "$2" + then AppendDateTimeStamp "$2" fi cp -fp "$1" "$2" } @@ -1180,7 +1185,7 @@ SysLogNg_Config_SyntaxCheck() ##----------------------------------------## ## Modified by Martinski W. [2025-Jul-07] ## ##----------------------------------------## -get_vers() +GetScribeVersion() { # only get scribe from github once # script_md5="$( md5_file "$script_loc")" @@ -1200,7 +1205,7 @@ get_vers() delfr "$script_tmp_file" } -prt_vers() +ShowScribeVersion() { printf "\n$white %34s$green %s \n" "$script_name installed version:" "$scriptVer_long" printf "$white %34s$green %s $std\n" "$script_name GitHub version:" "$githubVer_long" @@ -1218,7 +1223,7 @@ prt_vers() printf "$green %40s" "$script_name is up to date!" ;; esac - printf "$std\n\n" + printf "${std}\n\n" } # Install default file in /opt/etc/$1.d # @@ -1534,7 +1539,7 @@ Menu_Status() { Check_SysLogNg SysLogd_Check - printf "\n$magenta checking system for necessary %s hooks ...\n\n" "$script_name" + printf "\n ${magenta}checking system for necessary %s hooks ...\n\n" "$script_name" sed_SysLogNg_Init if SyslogNg_Running then sed_srvcEvent @@ -1546,11 +1551,11 @@ Menu_Status() LogRotate_CronJob_Check Check_Dir_Links fi - printf "\n$magenta checking %s configuration ...\n\n" "$sng" + printf "\n ${magenta}checking %s configuration ...\n\n" "$sng" SysLogNg_Config_Sync SysLogNg_Config_SyntaxCheck - get_vers - prt_vers + GetScribeVersion + ShowScribeVersion } sng_ver_chk() @@ -1566,16 +1571,20 @@ sng_ver_chk() fi } +##----------------------------------------## +## Modified by Martinski W. [2026-Jan-30] ## +##----------------------------------------## Setup_SysLogNG() { - printf "\n$magenta setting up %s ...\n$std" "$sng" + printf "\n ${magenta}setting up %s ...${std}\n" "$sng" Copy_SysLogNg_RcFunc + Copy_LogRotate_Global_Options force sed_SysLogNg_Init sed_srvcEvent sed_unMount if [ "$( md5_file "$sng_share/examples/${sng}.conf-scribe" )" != "$( md5_file "$sng_conf" )" ] then - printf "$white %34s" "updating $( strip_path "$sng_conf" ) ..." + printf " ${white}%34s" "updating $(strip_path "$sng_conf") ..." Update_File "$sng_share/examples/${sng}.conf-scribe" "$sng_conf" "backup" finished fi @@ -1747,7 +1756,7 @@ PreInstall_Check() } ##----------------------------------------## -## Modified by Martinski W. [2026-Jan-25] ## +## Modified by Martinski W. [2026-Jan-30] ## ##----------------------------------------## Menu_Install() { @@ -1762,6 +1771,7 @@ Menu_Install() echo rm -f "$syslogNg_WaitnSEM_FPath" echo '1' > "$syslogNg_StartSEM_FPath" + printf '' > "$syslogD_InitRebootLogFPath" $S01sng_init start if [ ! -e "$lr_loc" ] @@ -1811,18 +1821,12 @@ Menu_Restart() Restart_uiScribe } -##----------------------------------------## -## Modified by Martinski W. [2026-Jan-11] ## -##----------------------------------------## -StopSyslogNg() +##-------------------------------------## +## Added by Martinski W. [2026-Jan-30] ## +##-------------------------------------## +_MoveLogMsgsToSystemLogFile_() { local lastNLines logNumLines logFileSize - local messagesLogSAVED="${optmsg}.SAVED.LOG" - - printf "\n ${white}Stopping %s...\n" "$sng" - $S01sng_init stop - # Remove any syslog links # - Clear_Syslog_Links ## Do NOT move very large files into JFFS/TMPFS ## lastNLines=100 @@ -1842,10 +1846,28 @@ StopSyslogNg() fi fi tail -n $lastNLines "$optmsg" > "$syslog_loc" +} - if "$usbUnmountCaller" - then mv -f "$optmsg" "$messagesLogSAVED" - else rm -f "$messagesLogSAVED" "$syslogD_InitRebootLogFPath" +##----------------------------------------## +## Modified by Martinski W. [2026-Jan-30] ## +##----------------------------------------## +StopSyslogNg() +{ + local messagesLogSAVED="${optmsg}.Scribe_SAVED.LOG" + + printf "\n ${white}Stopping %s...\n" "$sng" + $S01sng_init stop + # Remove any syslog links # + Clear_Syslog_Links + + ##OFF##_MoveLogMsgsToSystemLogFile_ + printf '' > "$syslog_loc" + printf '' > "${syslog_loc}-1" + printf '' > "$syslogD_InitRebootLogFPath" + + if [ -s "$optmsg" ] + then + mv -f "$optmsg" "$messagesLogSAVED" fi ln -snf "$syslog_loc" "$optmsg" @@ -2034,7 +2056,7 @@ Menu_Filters() } ##----------------------------------------## -## Modified by Martinski W. [2026-Jan-25] ## +## Modified by Martinski W. [2026-Jan-30] ## ##----------------------------------------## Menu_Update() { @@ -2069,11 +2091,12 @@ Menu_Update() printf "\n$white %s updated!$std\n" "$script_name" rm -f "$syslogNg_WaitnSEM_FPath" echo '1' > "$syslogNg_StartSEM_FPath" + printf '' > "$syslogD_InitRebootLogFPath" sh "$script_loc" filters gotzip nologo sh "$script_loc" status nologo run_scribe=true else - printf "\n$white *** %s$red not$white updated! *** $std\n\n" "$script_name" + printf "\n$white *** %s ${red}not${white} updated! *** ${std}\n\n" "$script_name" fi } @@ -2084,8 +2107,8 @@ Update_Version() { if SyslogNg_Running then - get_vers - prt_vers + GetScribeVersion + ShowScribeVersion Menu_Update "$@" else not_recog=true @@ -2131,7 +2154,7 @@ Gather_Debug() delfr "$script_debug" "$debugTarball" printf "\n$white gathering debugging information...\n" - get_vers + GetScribeVersion { printf "%s\n" "$debug_sep" @@ -2239,7 +2262,7 @@ Gather_Debug() menu_backup() { printf "\n$white Backing up %s and %s Configurations ... \n" "$sng" "$lr" - date_stamp "$script_bakname" + AppendDateTimeStamp "$script_bakname" tar -zcvf "$script_bakname" "$sng_conf" "$sngd_d" "$lr_conf" "$lrd_d" "$config_d" printf "\n$std Backup data is stored in $cyan%s$std.\n\n" "$script_bakname" } @@ -2305,7 +2328,9 @@ _LogDebugMsg_() then echo "${timeNow}: $1" > "$logFilePath" else echo "${timeNow}: $1" >> "$logFilePath" fi - logger -t "$logTagStr" "$1" + if [ $# -gt 1 ] && [ "$2" != "false" ] + then logger -t "$logTagStr" "$1" + fi } trap '' HUP @@ -2350,24 +2375,23 @@ do then sysLogNg_Param=start else sysLogNg_Param=restart fi - _LogDebugMsg_ "Calling [$S01syslogNg_srvc $sysLogNg_Param]..." rm -f "$syslogNg_WaitnSEM_FPath" + _LogDebugMsg_ "Calling [$S01syslogNg_srvc $sysLogNg_Param]..." true echo "$cntSleepSecs" > "$syslogNg_StartSEM_FPath" - "$S01syslogNg_srvc" "$sysLogNg_Param" - - _LogDebugMsg_ "Exiting Background Loop [$cntSleepSecs][$$]..." + nohup "$S01syslogNg_srvc" "$sysLogNg_Param" & + _LogDebugMsg_ "Exiting Background Loop [$cntSleepSecs][$$]..." true break fi if [ "$cntSleepSecs" -ge "$sleepSecsMAX" ] then rm -f "$syslogNg_WaitnSEM_FPath" - _LogDebugMsg_ "Exiting Background Loop [$cntSleepSecs][$$]..." - break #Escape WITHOUT starting service# + _LogDebugMsg_ "Exiting Background Loop [$cntSleepSecs][$$]..." true + break #Escape WITHOUT starting service??# fi if "$timeCheckStatus" then - _LogDebugMsg_ "Sleeping $checkSecs secs [$cntSleepSecs][$$]..." + _LogDebugMsg_ "Sleeping $checkSecs secs [$cntSleepSecs][$$]..." true fi sleep "$sleepSecs" cntSleepSecs="$((cntSleepSecs + sleepSecs))" @@ -2378,7 +2402,7 @@ do fi done -_LogDebugMsg_ "End of Background Script [$scriptFName][$$]" +_LogDebugMsg_ "End of Background Script [$scriptFName][$$]" false rm -f "$0" #EOF# @@ -2513,7 +2537,6 @@ _Launch_SysLoggerCheck_BGScript_() fi "$bgScript_FPath" & taskPID=$! - logger -st "$logTag" -p 5 "INFO: Background script [$bgScript_FName] started. PID: [$taskPID]" } ##----------------------------------------## @@ -2854,7 +2877,6 @@ SetUpRepoBranchVars ## Increase FIFO queue size if 1GB RAM or more ## if _HasRouterMoreThan512MBtotalRAM_ then sysLogFiFoSizeMIN=2048 -else sysLogFiFoSizeMIN=1024 fi if ! SyslogD_Running && ! SyslogNg_Running && \ diff --git a/syslog-ng.share/README.1ST b/syslog-ng.share/README.1ST index 90993b5..fffa873 100644 --- a/syslog-ng.share/README.1ST +++ b/syslog-ng.share/README.1ST @@ -1,6 +1,6 @@ -### README.1ST --- 22 June 2020 +### README.1ST --- Revised: 2026-Jan-30 -Please READ before copying any of these files to /opt/etc/syslog-ng.d/ +Please READ *BEFORE* copying any of these files to /opt/etc/syslog-ng.d/ **** If you simply copy all of the files in this directory to **** **** /opt/etc/syslog-ng.d/ the next time you try to restart **** @@ -12,18 +12,21 @@ log files. Note that when copying the files, they must be writable by the user only, i.e. chmod 600. If the group or others can write to them, they will not be loaded by syslog-ng. -It is highly recommended to copy the corresponding file of the same name -in /opt/share/logrotate/examples/ to /opt/etc/logroate.d/ to ensure the -log files do not grow too large. If there is not corresponding file in -/opt/share/logrotate/examples, then either the file is not intended to be -used permanently (e.g. expandlog); or should generate no or very few log -entries (e.g. blankmsg, errormsg); or its logs are handled by other -programs (e.g. skynet). +It is NOT required to copy the corresponding file of the same name found +in "/opt/share/logrotate/examples" to "/opt/etc/logrotate.d" directory. +The logrotate configuration files are optional; they are needed ONLY IF +you want to override any of the default global directives already preset +in the "A00global" and "A01global" configuration files. -Notes: 1) All ".log" files will be in /opt/var/log/. +If there's not corresponding file in "/opt/share/logrotate/examples" then +either the file is not intended to be used permanently (e.g. expandlog); +or should generate no or very few log entries (e.g. blankmsg, errormsg); +or its logs are handled by some other programs (e.g. skynet). + +Notes: 1) All ".log" files MUST be in the "/opt/var/log" directory. 2) Unless otherwise noted, all filters are "final", meaning - messages matched by the filter will not be logged in the - default messages file. + messages matched by the filter will NOT be logged in the + default "/opt/var/log/messages" log file. The files in this directory are: A00remote Sends _ALL_ messages to a remote logging facility before diff --git a/syslog-ng.share/syslog-ng.conf-scribe b/syslog-ng.share/syslog-ng.conf-scribe index e00d53e..2dfe320 100644 --- a/syslog-ng.share/syslog-ng.conf-scribe +++ b/syslog-ng.share/syslog-ng.conf-scribe @@ -1,11 +1,14 @@ ############################################################################# # syslog-ng.conf customized for Scribe on Asuswrt-Merlin firmware -# Compare to /opt/share/syslog-ng/examples/syslog-ng.conf-opkg for differences from the Entware distribution +# Last Modified: 2026-Jan-27 +# +# Compare to /opt/share/syslog-ng/examples/syslog-ng.conf-opkg for +# differences from the Entware distribution # # syslog-ng documentation: https://www.syslog-ng.com/technical-documents/list/syslog-ng-open-source-edition # # Release notes: https://github.com/syslog-ng/syslog-ng/releases - +# @version: 4.7 #@include "scl.conf" # uncomment this line to for additional functionality, see syslog-ng documentation @include "/opt/etc/syslog-ng.d/" # Put any customization files in this directory @@ -14,7 +17,7 @@ options { chain_hostnames(no); # Enable or disable the chained hostname format. create_dirs(yes); keep_hostname(yes); # Enable or disable hostname rewriting. - log_fifo_size(1024); # The number of messages that the output queue can store. + log_fifo_size(1600); # The number of messages that the output queue can store. log_msg_size(2048); # Maximum length of a message in bytes. stats(freq(21600)); # The period between two STATS messages sent by syslog-ng, containing statistics about dropped logs in seconds; 0 disables. (21,600 seconds = 6 hours) flush_lines(0); # How many lines are flushed to a destination at a time. @@ -27,8 +30,13 @@ options { source src { unix-dgram("/dev/log" so_rcvbuf(65536) flags(syslog-protocol)); file("/proc/kmsg" program_override("kernel") flags(kernel)); + wildcard_file(base_dir("/opt/var/log") + filename_pattern("syslogd.ScribeInitReboot.LOG") + recursive(no) max-files(1) follow_freq(1) + log_iw_size(1200) log_fetch_limit(1000) flags(syslog-protocol)); internal(); -#OFF# udp(ip(192.168.x.y) port(514)); # uncomment this line to pass all network messages through syslog-ng filters +# uncomment this line to pass all network messages through syslog-ng filters # +#OFF# udp(ip(192.168.x.y) port(514)); }; # if you only want to pass network messages through some syslog-ng filters, uncomment the source line below From 23a4bb9209698e3bdabbbb22dc2621451f7e37ca Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sat, 31 Jan 2026 23:27:19 -0800 Subject: [PATCH 3/5] Code Improvements More code improvements. --- README.md | 2 +- init.d/rc.func.syslog-ng | 4 ++-- scribe.sh | 25 +++++++++++++------------ syslog-ng.share/syslog-ng.conf-scribe | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index e45e460..a98416c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.9 -### Updated on 2026-Jan-30 +### Updated on 2026-Jan-31 ## Getting Started diff --git a/init.d/rc.func.syslog-ng b/init.d/rc.func.syslog-ng index 50a005d..54f977e 100644 --- a/init.d/rc.func.syslog-ng +++ b/init.d/rc.func.syslog-ng @@ -1,7 +1,7 @@ #!/bin/sh - # # NB: rc.func only runs PRECMD on "start" -# Last Modified: 2026-Jan-27 +# Last Modified: 2026-Jan-31 # VERSION="3.1.5" #------------------------------------------- @@ -44,7 +44,7 @@ kill_logger() if [ ! -f "$syslogNG_StartSEM_FPath" ] then $loggerCmd -t "$logTagStr" $logPrioNum "Calling Scribe SysLogNgStartDelay..." - echo "150" > "$syslogNG_WaitnSEM_FPath" + [ ! -f "$syslogNG_WaitnSEM_FPath" ] && echo "150" > "$syslogNG_WaitnSEM_FPath" nohup "$scribeScriptFPath" SysLogNgStartDelay >/dev/null 2>&1 & exit 1 fi diff --git a/scribe.sh b/scribe.sh index 860a9ed..e47379e 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Jan-30 +# Last Modified: 2026-Jan-31 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.9" -readonly scriptVer_TAG="26013023" +readonly scriptVer_TAG="26013123" scribe_branch="develop" script_branch="$scribe_branch" @@ -1817,7 +1817,7 @@ Menu_Restart() printf "\n ${white}%s ${red}NOT${white} running! ${yellow}Starting...${std}\n" "$sng" $S01sng_init start fi - sleep 1 #Allow time to start up# + sleep 2 #Allow time to start up# Restart_uiScribe } @@ -2117,7 +2117,7 @@ Update_Version() menu_forgrnd() { - restrt=false + local doStart=false if SyslogNg_Running then warning_sign @@ -2126,20 +2126,20 @@ menu_forgrnd() printf " Debugging mode is intended for troubleshooting when\n" printf " %s will not start.\n\n" "$sng" printf " Are you certain you wish to start debugging mode [y|n]? $std" - if ! Yes_Or_No; then return; fi - restrt=true + if ! Yes_Or_No; then return 1; fi + doStart=true fi printf "\n$yellow NOTE: If there are no errors, debugging mode will\n" printf " continue indefinitely. If this happens, type\n" printf " to halt debugging mode output.\n\n" PressEnterTo "start:" - if "$restrt" + if "$doStart" then $S01sng_init stop; echo fi trap '' 2 $sng_loc -Fevd trap - 2 - if "$restrt" + if "$doStart" then echo ; $S01sng_init start fi echo @@ -2980,13 +2980,16 @@ case "$action" in then Menu_Restart Menu_Status + cliParamCheck=false fi ;; #Stop syslog-ng & logrotate Cron Job# stop) if SyslogNg_Running || "$usbUnmountCaller" - then Menu_Stop + then + Menu_Stop + cliParamCheck=false fi ;; @@ -3077,9 +3080,7 @@ esac if ! "$scribeInstalled" && "$cliParamCheck" then printf "\n${yellow} %s ${white}is NOT installed, command \"%s\" not valid!${std}\n\n" "$script_name" "$action" -elif ! SyslogNg_Running && \ - "$cliParamCheck" && \ - [ "$action" != "stop" ] +elif ! SyslogNg_Running && "$cliParamCheck" then printf "\n${yellow} %s ${white}is NOT running, command \"%s\" not valid!${std}\n\n" "$sng" "$action" else diff --git a/syslog-ng.share/syslog-ng.conf-scribe b/syslog-ng.share/syslog-ng.conf-scribe index 2dfe320..69de93c 100644 --- a/syslog-ng.share/syslog-ng.conf-scribe +++ b/syslog-ng.share/syslog-ng.conf-scribe @@ -35,24 +35,26 @@ source src { recursive(no) max-files(1) follow_freq(1) log_iw_size(1200) log_fetch_limit(1000) flags(syslog-protocol)); internal(); -# uncomment this line to pass all network messages through syslog-ng filters # -#OFF# udp(ip(192.168.x.y) port(514)); +# uncomment the line below to pass ALL network log messages through syslog-ng filters # +#OFF# udp(port(514) flags(syslog-protocol)); }; # if you only want to pass network messages through some syslog-ng filters, uncomment the source line below -# then add "source(net);" to the log statement in any filter you want to pass network messages through -#OFF# source net { udp(ip(192.168.x.y) port(514)); }; +# then add "source(s_net);" to the log statement in any filter you want to pass network messages through +#OFF# source s_net { udp(port(514) flags(syslog-protocol)); }; -# set the filename for the default log file - anything not filtered out will end up here +# set the filename for the default log file - anything not filtered out will end up here # destination messages { file("/opt/var/log/messages"); }; -# to send log messages to the local network, uncomment the destination line below +# to send log messages to the local network, uncomment the destination line below # # then add "destination(log_server);" to the log statement in any filter you want to pass network messages through #OFF# destination log_server { udp("192.168.x.y" port(514)); }; log { source(src); -#OFF# source(net); # uncomment this and "source net" function above to get udp log messages from local network +# uncomment this and "source s_net" function above to get udp log messages from local network # +#OFF# source(s_net); destination(messages); -#OFF# destination(log_server); # uncomment this and "destination log_server" function above to send udp log messages to local network +# uncomment this and "destination log_server" function above to send udp log messages to local network # +#OFF# destination(log_server); }; From 6b8647722e3d6cc8ae1b5055095c52be64425ba0 Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Mon, 2 Feb 2026 23:11:07 -0800 Subject: [PATCH 4/5] Update syslog-ng.conf-scribe Minor Improvement. --- syslog-ng.share/syslog-ng.conf-scribe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syslog-ng.share/syslog-ng.conf-scribe b/syslog-ng.share/syslog-ng.conf-scribe index 69de93c..2858b5a 100644 --- a/syslog-ng.share/syslog-ng.conf-scribe +++ b/syslog-ng.share/syslog-ng.conf-scribe @@ -1,6 +1,6 @@ ############################################################################# # syslog-ng.conf customized for Scribe on Asuswrt-Merlin firmware -# Last Modified: 2026-Jan-27 +# Last Modified: 2026-Feb-01 # # Compare to /opt/share/syslog-ng/examples/syslog-ng.conf-opkg for # differences from the Entware distribution @@ -17,7 +17,7 @@ options { chain_hostnames(no); # Enable or disable the chained hostname format. create_dirs(yes); keep_hostname(yes); # Enable or disable hostname rewriting. - log_fifo_size(1600); # The number of messages that the output queue can store. + log_fifo_size(1500); # The number of messages that the output queue can store. log_msg_size(2048); # Maximum length of a message in bytes. stats(freq(21600)); # The period between two STATS messages sent by syslog-ng, containing statistics about dropped logs in seconds; 0 disables. (21,600 seconds = 6 hours) flush_lines(0); # How many lines are flushed to a destination at a time. From f248ad6abb3fe7f6bdb794ce7c75615485e8440e Mon Sep 17 00:00:00 2001 From: Martinski4GitHub <119833648+Martinski4GitHub@users.noreply.github.com> Date: Sat, 7 Feb 2026 01:23:53 -0800 Subject: [PATCH 5/5] Code Improvements - Added message to let users know when the syslog-ng configuration file is replaced during an update. - Miscellaneous code improvements. --- README.md | 2 +- scribe.sh | 104 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 65 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index a98416c..f1ca255 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin** ## v3.2.9 -### Updated on 2026-Jan-31 +### Updated on 2026-Feb-07 ## Getting Started diff --git a/scribe.sh b/scribe.sh index e47379e..b15d6a2 100644 --- a/scribe.sh +++ b/scribe.sh @@ -18,7 +18,7 @@ # curl --retry 3 "https://raw.githubusercontent.com/AMTM-OSR/scribe/master/scribe.h" -o "/jffs/scripts/scribe" && chmod 0755 /jffs/scripts/scribe && /jffs/scripts/scribe install # ################################################################## -# Last Modified: 2026-Jan-31 +# Last Modified: 2026-Feb-07 #----------------------------------------------------------------- ################ Shellcheck directives ################ @@ -35,7 +35,7 @@ readonly script_name="scribe" readonly scribe_ver="v3.2.9" -readonly scriptVer_TAG="26013123" +readonly scriptVer_TAG="26020700" scribe_branch="develop" script_branch="$scribe_branch" @@ -277,20 +277,20 @@ PressEnterTo() VersionStrToNum() { echo "$1" | sed 's/v//; s/_/./' | awk -F. '{ printf("%d%03d%02d\n", $1, $2, $3); }'; } -md5_file(){ md5sum "$1" | awk '{ printf( $1 ); }'; } +MD5_Hash(){ md5sum "$1" | awk -F' ' '{print $1}' ; } strip_path(){ basename "$1"; } delfr(){ rm -fr "$1"; } -same_same(){ if [ "$( md5_file "$1" )" = "$( md5_file "$2" )" ]; then true; else false; fi; } +Same_MD5_Hash(){ if [ "$(MD5_Hash "$1")" = "$(MD5_Hash "$2")" ]; then true; else false; fi; } AppendDateTimeStamp() -{ [ -e "$1" ] && mv -f "$1" "${1}_$(date +'%Y-%m-%d_T%H%M%S')"; } +{ [ -e "$1" ] && mv -f "$1" "${1}_$(date +'%Y-%m-%d_T%H%M%S')" ; } -SyslogNg_Running(){ if [ -n "$( pidof $sng )" ]; then true; else false; fi; } +SyslogNg_Running(){ if [ -n "$(pidof "$sng")" ]; then true; else false; fi; } -SyslogD_Running(){ if [ -n "$( pidof $sld )" ]; then true; else false; fi; } +SyslogD_Running(){ if [ -n "$(pidof "$sld")" ]; then true; else false; fi; } ##-------------------------------------## ## Added by Martinski W. [2025-Nov-30] ## @@ -535,7 +535,7 @@ Read_Config() ##----------------------------------------## Update_File() { - if [ $# -gt 2 ] && [ "$3" = "backup" ] + if [ $# -gt 2 ] && [ "$3" = "BACKUP" ] then AppendDateTimeStamp "$2" fi cp -fp "$1" "$2" @@ -652,7 +652,7 @@ Reload_SysLogNg_Config() Copy_SysLogNg_RcFunc() { - printf "$white copying %s to %s ...$std" "$rcfunc_sng" "$init_d" + printf " ${white}copying %s to %s ...$std" "$rcfunc_sng" "$init_d" cp -fp "${unzip_dirPath}/init.d/$rcfunc_sng" "$init_d/" chmod 644 "$rcfunc_loc" finished @@ -664,6 +664,7 @@ Copy_SysLogNg_RcFunc() Copy_SysLogNg_Top_Config() { local forceUpdate=false + local diffFile="/opt/tmp/syslogNG_diffs.TEMP.txt" local srceFile="${unzip_dirPath}/${syslogNgStr}.share/${syslogNg_ConfName}-scribe" [ ! -s "$srceFile" ] && return 1 @@ -674,11 +675,31 @@ Copy_SysLogNg_Top_Config() for destFile in "$syslogNg_TopConfig" "${syslogNg_ExamplesDir}/${syslogNg_ConfName}-scribe" do - if [ ! -s "$destFile" ] || "$forceUpdate" + if [ ! -s "$destFile" ] || [ "$destFile" != "$syslogNg_TopConfig" ] then cp -fp "$srceFile" "$destFile" - chmod 644 "$destFile" + elif "$forceUpdate" || ! Same_MD5_Hash "$srceFile" "$destFile" + then + diff -U0 "$srceFile" "$destFile" 2>/dev/null | \ + grep -Ev "^(\-\-\-|\+\+\+)" | grep -E "^(\-|\+)" | \ + grep -Ev "^(\-|\+)[[:blank:]]+log_fifo_size\(" > "$diffFile" + if [ -s "$diffFile" ] && \ + grep -qE "^(\-|\+)" "$diffFile" && \ + [ "$(wc -l < "$diffFile")" -gt 0 ] + then + printf " ${yellow}updating $destFile ..." + Update_File "$srceFile" "$destFile" "BACKUP" + finished + printf " ${red}------------\n ***NOTICE***\n ------------${std}\n" + printf " ${yellow}The file ${green}/opt/etc/syslog-ng.conf${yellow} has been replaced with" + printf " a newer version.\n This means that any custom configuration options that you may" + printf " have added\n or modified in the previously installed file are now removed.\n A backup" + printf " of the previous file was created in the '${green}/opt/etc${yellow}' directory.${std}\n\n" + PressEnterTo "continue..." + fi + rm -f "$diffFile" fi + chmod 644 "$destFile" done } @@ -1188,7 +1209,7 @@ SysLogNg_Config_SyntaxCheck() GetScribeVersion() { # only get scribe from github once # - script_md5="$( md5_file "$script_loc")" + script_md5="$(MD5_Hash "$script_loc")" delfr "$script_tmp_file" curl -LSs --retry 4 --retry-delay 5 --retry-connrefused "$script_repoFile" -o "$script_tmp_file" [ ! -e "$script_tmp_file" ] && \ @@ -1196,7 +1217,7 @@ GetScribeVersion() github_ver="$( grep -m1 "scribe_ver=" "$script_tmp_file" | grep -oE "$scribeVerRegExp" )" github_branch="$( grep -m1 "scribe_branch=" "$script_tmp_file" | awk -F\" '{ printf ( $2 ); }'; )" githubVer_long="$github_ver ($github_branch)" - github_md5="$( md5_file "$script_tmp_file")" + github_md5="$(MD5_Hash "$script_tmp_file")" new_vers="none" if [ "$( VersionStrToNum "$github_ver" )" -lt "$( VersionStrToNum "$scribe_ver" )" ]; then new_vers="older" elif [ "$( VersionStrToNum "$github_ver" )" -gt "$( VersionStrToNum "$scribe_ver" )" ]; then new_vers="major" @@ -1207,20 +1228,20 @@ GetScribeVersion() ShowScribeVersion() { - printf "\n$white %34s$green %s \n" "$script_name installed version:" "$scriptVer_long" - printf "$white %34s$green %s $std\n" "$script_name GitHub version:" "$githubVer_long" + printf "\n ${white}%34s ${green}%s\n" "$script_name installed version:" "$scriptVer_long" + printf " ${white}%34s ${green}%s${std}\n" "$script_name GitHub version:" "$githubVer_long" case "$new_vers" in older) - printf "$red Local %s version greater than GitHub version!" "$script_name" + printf " ${red}Local %s version GREATER THAN GitHub version!" "$script_name" ;; major) - printf "$yellow %45s" "New version available for $script_name" + printf " ${yellow}%45s" "New version available for $script_name" ;; minor) - printf "$blue %45s" "Minor patch available for $script_name" + printf " ${blue}%45s" "Minor patch available for $script_name" ;; none) - printf "$green %40s" "$script_name is up to date!" + printf " ${green}%40s" "$script_name is up to date!" ;; esac printf "${std}\n\n" @@ -1260,7 +1281,7 @@ setup_exmpls() if [ ! -e "$shrfile" ] || [ "$2" = "ALL" ] then Update_File "$exmpl" "$shrfile" - elif ! same_same "$exmpl" "$shrfile" + elif ! Same_MD5_Hash "$exmpl" "$shrfile" then printf " updating %s\n" "$shrfile" Update_File "$exmpl" "$shrfile" @@ -1269,7 +1290,7 @@ setup_exmpls() if [ -e "$conf_opkg" ] then - Update_File "$conf_opkg" "$share/examples/$opkg" "backup" + Update_File "$conf_opkg" "$share/examples/$opkg" "BACKUP" delfr "$conf_opkg" elif [ ! -e "$share/examples/$opkg" ] then @@ -1582,10 +1603,10 @@ Setup_SysLogNG() sed_SysLogNg_Init sed_srvcEvent sed_unMount - if [ "$( md5_file "$sng_share/examples/${sng}.conf-scribe" )" != "$( md5_file "$sng_conf" )" ] + if ! Same_MD5_Hash "$sng_share/examples/${sng}.conf-scribe" "$sng_conf" then printf " ${white}%34s" "updating $(strip_path "$sng_conf") ..." - Update_File "$sng_share/examples/${sng}.conf-scribe" "$sng_conf" "backup" + Update_File "$sng_share/examples/${sng}.conf-scribe" "$sng_conf" "BACKUP" finished fi SysLogNg_Config_Sync @@ -1594,7 +1615,7 @@ Setup_SysLogNG() Setup_LogRotate() { # Assumes since Entware is required/installed, post-mount exists and is properly executable # - printf "\n$magenta setting up %s ...\n" "$lr" + printf "\n ${magenta}setting up %s ...\n" "$lr" LogRotate_CronJob_PostMount_Check LogRotate_CronJob_Check } @@ -1622,7 +1643,7 @@ Do_Install() ##----------------------------------------## Setup_Scribe() { - printf "\n$white setting up %s ...\n" "$script_name" + printf "\n ${white}setting up %s ...\n" "$script_name" cp -fp "$unzip_dirPath/${script_name}.sh" "$script_loc" chmod 0755 "$script_loc" [ ! -e "/opt/bin/$script_name" ] && ln -s "$script_loc" /opt/bin @@ -2017,7 +2038,7 @@ Menu_Filters() for upd_file in "$check_dir"/* do comp_file="$comp_dir/$( strip_path "$upd_file" )" - if [ -e "$comp_file" ] && ! same_same "$upd_file" "$comp_file" + if [ -e "$comp_file" ] && ! Same_MD5_Hash "$upd_file" "$comp_file" then processed=false printf "\n$white Update available for$yellow %s$white.\n" "$upd_file" @@ -2028,11 +2049,11 @@ Menu_Filters() case "$dispo" in a) Update_File "$comp_file" "$upd_file" - printf "\n$green %s updated!$std\n" "$upd_file" + printf "\n ${green}%s updated!${std}\n" "$upd_file" processed=true ;; r) - printf "\n$magenta %s not updated!$std\n" "$upd_file" + printf "\n ${magenta}%s not updated!${std}\n" "$upd_file" processed=true ;; v) @@ -2060,35 +2081,38 @@ Menu_Filters() ##----------------------------------------## Menu_Update() { + local doUpdate=false + if [ $# -eq 0 ] || [ -z "$1" ] then if [ "$new_vers" = "major" ] || [ "$new_vers" = "minor" ] then if [ "$new_vers" = "major" ] - then printf "\n$green New version" - else printf "\n$cyan Minor patch" + then printf "\n ${green}New version" + else printf "\n ${cyan}Minor patch" fi - printf "$white available!\n" - printf " Do you wish to upgrade? [y|n]$std " + printf " ${white}available!\n" + printf " Do you wish to upgrade? [y|n]${std} " else - printf "\n$white No new version available. (GitHub version" + printf "\n ${white}No new version available. GitHub version" if [ "$new_vers" = "none" ] - then printf " equal to " - else printf "$red LESS THAN $white" + then printf " equal to" + else printf " ${red}LESS THAN$white" fi - printf "local version)\n" - printf " Do you wish to force re-installation of %s script? [y|n]$std " "$script_name" + printf " local version.\n" + printf " Do you wish to force re-installation of %s? [y|n]${std} " "$script_name" fi + Yes_Or_No && doUpdate=true || doUpdate=false fi - if { [ $# -gt 0 ] && [ "$1" = "force" ] ; } || Yes_Or_No + if { [ $# -gt 0 ] && [ "$1" = "force" ] ; } || "$doUpdate" then Get_ZIP_File Setup_Scribe "NEWER" Copy_SysLogNg_RcFunc Copy_SysLogNg_Top_Config "$@" Copy_LogRotate_Global_Options "$@" - printf "\n$white %s updated!$std\n" "$script_name" + printf "\n ${white}%s updated!${std}\n" "$script_name" rm -f "$syslogNg_WaitnSEM_FPath" echo '1' > "$syslogNg_StartSEM_FPath" printf '' > "$syslogD_InitRebootLogFPath" @@ -2096,7 +2120,7 @@ Menu_Update() sh "$script_loc" status nologo run_scribe=true else - printf "\n$white *** %s ${red}not${white} updated! *** ${std}\n\n" "$script_name" + printf "\n ${white}*** %s ${red}NOT${white} updated! *** ${std}\n\n" "$script_name" fi }