Skip to content

Commit 4e4eaab

Browse files
Merge pull request #63 from Martinski4GitHub/develop
Improvements to UI Messages
2 parents 42da2a9 + ad74bc6 commit 4e4eaab

2 files changed

Lines changed: 62 additions & 37 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
**scribe** is a **syslog-ng** and **logrotate** installer for ASUS routers running **Asuswrt-Merlin**
44

5-
## v3.2.8
6-
### Updated on 2026-Jan-25
5+
## v3.2.9
6+
### Updated on 2026-Jan-29
77

88
## Getting Started
99

scribe.sh

Lines changed: 60 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# 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
1919
#
2020
##################################################################
21-
# Last Modified: 2026-Jan-25
21+
# Last Modified: 2026-Jan-29
2222
#-----------------------------------------------------------------
2323

2424
################ Shellcheck directives ################
@@ -34,8 +34,8 @@
3434
#################################################################
3535

3636
readonly script_name="scribe"
37-
readonly scribe_ver="v3.2.8"
38-
readonly scriptVer_TAG="26012523"
37+
readonly scribe_ver="v3.2.9"
38+
readonly scriptVer_TAG="26012900"
3939
scribe_branch="develop"
4040
script_branch="$scribe_branch"
4141

@@ -196,6 +196,7 @@ readonly syslogNg_ConfName=${syslogNgStr}.conf
196196
readonly syslogNg_TopConfig="/opt/etc/$syslogNg_ConfName"
197197
readonly syslogNg_WaitnSEM_FPath="${TEMPdir}/scribe_SysLogNg.WAITN.SEM"
198198
readonly syslogNg_StartSEM_FPath="${TEMPdir}/scribe_SysLogNg.START.SEM"
199+
readonly syslogD_InitRebootLogFPath="${optVarLogDir}/syslog_init_reboot.LOG"
199200
readonly sysLogLinesMAX=20480
200201
readonly sysLogMsgeSizeMAX=2048
201202
sysLogFiFoSizeMIN=1024
@@ -1064,15 +1065,20 @@ _SysLogMsgSizeFromConfig_()
10641065
if [ -n "$msgSizeNum" ] && [ "$msgSizeNum" -gt "$sysLogMsgeSizeMAX" ]
10651066
then msgSizeOK=false
10661067
fi
1067-
"$msgSizeOK" && return 0
10681068

1069-
if [ "$1" = "check" ]
1070-
then return 1
1071-
elif [ "$1" = "update" ]
1072-
then
1073-
sed -i "s/log_msg_size($msgSizeNum)/log_msg_size($sysLogMsgeSizeMAX)/g" "$sng_conf"
1074-
return 0
1075-
fi
1069+
case "$1" in
1070+
check)
1071+
"$msgSizeOK" && return 0 || return 1
1072+
;;
1073+
update)
1074+
"$msgSizeOK" && return 1 #NO Change#
1075+
sed -i "s/log_msg_size($msgSizeNum)/log_msg_size($sysLogMsgeSizeMAX)/g" "$sng_conf"
1076+
return 0
1077+
;;
1078+
*)
1079+
return 1
1080+
;;
1081+
esac
10761082
}
10771083

10781084
##-------------------------------------##
@@ -1089,25 +1095,30 @@ _SysLogFiFoSizeFromConfig_()
10891095
if [ -n "$fifoSizeNum" ] && [ "$fifoSizeNum" -lt "$sysLogFiFoSizeMIN" ]
10901096
then fifoSizeOK=false
10911097
fi
1092-
"$fifoSizeOK" && return 0
10931098

1094-
if [ "$1" = "check" ]
1095-
then return 1
1096-
elif [ "$1" = "update" ]
1097-
then
1098-
sed -i "s/log_fifo_size($fifoSizeNum)/log_fifo_size($sysLogFiFoSizeMIN)/g" "$sng_conf"
1099-
return 0
1100-
fi
1099+
case "$1" in
1100+
check)
1101+
"$fifoSizeOK" && return 0 || return 1
1102+
;;
1103+
update)
1104+
"$fifoSizeOK" && return 1 #NO Change#
1105+
sed -i "s/log_fifo_size($fifoSizeNum)/log_fifo_size($sysLogFiFoSizeMIN)/g" "$sng_conf"
1106+
return 0
1107+
;;
1108+
*)
1109+
return 1
1110+
;;
1111+
esac
11011112
}
11021113

11031114
##----------------------------------------##
1104-
## Modified by Martinski W. [2026-Jan-03] ##
1115+
## Modified by Martinski W. [2026-Jan-29] ##
11051116
##----------------------------------------##
11061117
SysLogNg_Config_Sync()
11071118
{
11081119
local sng_conf_vtag1 sng_conf_vtag2 sng_version_str sng_conf_verstr
11091120

1110-
printf "$white %34s" "$( strip_path "$sng_conf" ) version check ..."
1121+
printf " ${white}%34s" "$(strip_path "$sng_conf") options check ..."
11111122
sng_conf_vtag1="@version:"
11121123
sng_conf_vtag2="${sng_conf_vtag1}[[:blank:]]*"
11131124
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()
11181129
! _SysLogFiFoSizeFromConfig_ check || \
11191130
[ "$sng_version_str" != "$sng_conf_verstr" ]
11201131
then
1121-
printf "$red out of sync! (%s) $std\n" "$sng_conf_verstr"
1122-
printf "$cyan *** Updating %s and restarting %s *** $std\n" "$( strip_path "$sng_conf" )" "$sng"
1132+
printf " ${red}out of sync!${std}\n"
1133+
printf " ${cyan}*** Updating %s and restarting %s ***${std}\n" "$(strip_path "$sng_conf")" "$sng"
11231134
$S01sng_init stop
11241135
old_doc="doc\/syslog-ng-open"
11251136
new_doc="list\/syslog-ng-open-source-edition"
11261137
sed -i "s/$old_doc.*/$new_doc/" "$sng_conf"
11271138
stats_freq="$( grep -m1 'stats_freq(' "$sng_conf" | cut -d ';' -f 1 | grep -oE '[0-9]*' )"
11281139
[ -n "$stats_freq" ] && sed -i "s/stats_freq($stats_freq)/stats(freq($stats_freq))/g" "$sng_conf"
1140+
11291141
if [ -n "$sng_version_str" ] && \
11301142
[ -n "$sng_conf_verstr" ] && \
11311143
[ "$sng_version_str" != "$sng_conf_verstr" ]
11321144
then
1145+
printf "\n ${red}%34s${std}\n" "version number out of sync!"
11331146
sed -i "s/^${sng_conf_vtag2}${sng_conf_verstr}.*/$sng_conf_vtag1 $sng_version_str/" "$sng_conf"
1147+
printf " ${white}%34s" "$(strip_path "$sng_conf") version ..."
1148+
printf " ${yellow}updated! (%s)${std}\n" "$sng_version_str"
1149+
logger -t "$script_name" "$(strip_path "$sng_conf") version number updated ($sng_version_str)!"
1150+
fi
1151+
if _SysLogMsgSizeFromConfig_ update
1152+
then
1153+
printf "\n ${red}%34s${std}\n" "Log message size out of sync!"
1154+
printf " ${white}%34s" "$(strip_path "$sng_conf") log message size ..."
1155+
printf " ${yellow}updated! (%d)${std}\n" "$sysLogMsgeSizeMAX"
1156+
fi
1157+
if _SysLogFiFoSizeFromConfig_ update
1158+
then
1159+
printf "\n ${red}%34s${std}\n" "Log FIFO size out of sync!"
1160+
printf " ${white}%34s" "$(strip_path "$sng_conf") log FIFO size ..."
1161+
printf " ${yellow}updated! (%d)${std}\n" "$sysLogFiFoSizeMIN"
11341162
fi
1135-
_SysLogMsgSizeFromConfig_ update
1136-
_SysLogFiFoSizeFromConfig_ update
1163+
echo
11371164
$S01sng_init start
11381165
Restart_uiScribe
1139-
printf "$white %34s" "$( strip_path "$sng_conf" ) version ..."
1140-
printf "$yellow updated! (%s) $std\n" "$sng_version_str"
1141-
logger -t "$script_name" "$( strip_path "$sng_conf" ) version number updated ($sng_version_str)!"
11421166
else
1143-
printf "$green in sync. (%s) $std\n" "$sng_version_str"
1167+
printf " ${green}in sync. (v%s)${std}\n" "$sng_version_str"
11441168
fi
11451169
}
11461170

@@ -1737,7 +1761,7 @@ Menu_Install()
17371761
fi
17381762
echo
17391763
rm -f "$syslogNg_WaitnSEM_FPath"
1740-
echo "1" > "$syslogNg_StartSEM_FPath"
1764+
echo '1' > "$syslogNg_StartSEM_FPath"
17411765
$S01sng_init start
17421766

17431767
if [ ! -e "$lr_loc" ]
@@ -1819,9 +1843,9 @@ StopSyslogNg()
18191843
fi
18201844
tail -n $lastNLines "$optmsg" > "$syslog_loc"
18211845

1822-
if ! "$usbUnmountCaller"
1823-
then rm -f "$messagesLogSAVED"
1824-
else mv -f "$optmsg" "$messagesLogSAVED"
1846+
if "$usbUnmountCaller"
1847+
then mv -f "$optmsg" "$messagesLogSAVED"
1848+
else rm -f "$messagesLogSAVED" "$syslogD_InitRebootLogFPath"
18251849
fi
18261850
ln -snf "$syslog_loc" "$optmsg"
18271851

@@ -2044,7 +2068,7 @@ Menu_Update()
20442068
Copy_LogRotate_Global_Options "$@"
20452069
printf "\n$white %s updated!$std\n" "$script_name"
20462070
rm -f "$syslogNg_WaitnSEM_FPath"
2047-
echo "1" > "$syslogNg_StartSEM_FPath"
2071+
echo '1' > "$syslogNg_StartSEM_FPath"
20482072
sh "$script_loc" filters gotzip nologo
20492073
sh "$script_loc" status nologo
20502074
run_scribe=true
@@ -2842,7 +2866,8 @@ then
28422866
fi
28432867

28442868
if [ "$action" != "help" ] && \
2845-
[ "$action" != "about" ]
2869+
[ "$action" != "about" ] && \
2870+
[ "$action" != "install" ]
28462871
then
28472872
# Read or create config file #
28482873
Read_Config

0 commit comments

Comments
 (0)