Make a ": " suffix a fixed part of the release info tag
This results in correct updates to /etc/motd even when the value of motd_release_tag is changed (a likely event). Add safe quoting to outputting the read kernel version. Thanks to kre@ for the feedback.
This commit is contained in:
parent
d7913f1566
commit
390227bdf6
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: motd,v 1.10 2020/09/11 09:59:35 kim Exp $
|
||||
# $NetBSD: motd,v 1.11 2020/09/11 12:50:14 kim Exp $
|
||||
#
|
||||
|
||||
# PROVIDE: motd
|
||||
@ -26,13 +26,13 @@ motd_start()
|
||||
fi
|
||||
( umask 022
|
||||
T=/etc/_motd
|
||||
sysctl -n kern.version | while read i; do echo $i; break; done > $T
|
||||
sysctl -n kern.version | while read i; do echo "$i"; break; done > $T
|
||||
if checkyesno update_motd_release; then
|
||||
local t="${motd_release_tag}"
|
||||
sed -En '1{/^NetBSD/{s/^/'"$t"'/;h;d;};q;}
|
||||
local t=$(echo "${motd_release_tag%%:*}" | tr -d /)
|
||||
sed -En '1{/^NetBSD/{'"${t:+s/^/${t}: /;}"'h;d;};q;}
|
||||
/^ *Build ID */{s//(/;s/$/)/;H;g;y/\n/ /;p;q;}
|
||||
${g;p;}' < /etc/release >> $T
|
||||
sed -E '1,2{/^'"${t+(${t})?}"'NetBSD/{d;};};' \
|
||||
sed -E '1,2{/^([^:]*: )?NetBSD/{d;};};' \
|
||||
< /etc/motd >> $T
|
||||
else
|
||||
sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
|
||||
|
Loading…
Reference in New Issue
Block a user