Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/etc Add optional release info in /etc/motd
details: https://anonhg.NetBSD.org/src/rev/c81195f360ba
branches: trunk
changeset: 954805:c81195f360ba
user: kim <kim%NetBSD.org@localhost>
date: Fri Sep 11 09:59:35 2020 +0000
description:
Add optional release info in /etc/motd
My personal preferencese for /etc/rc.conf:
update_motd_release=YES
motd_release_tag='Binaries: '
This provides an explanation to users about the second version in motd.
diffstat:
etc/defaults/rc.conf | 3 ++-
etc/rc.d/motd | 15 ++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diffs (55 lines):
diff -r 57632a8d6081 -r c81195f360ba etc/defaults/rc.conf
--- a/etc/defaults/rc.conf Fri Sep 11 09:08:47 2020 +0000
+++ b/etc/defaults/rc.conf Fri Sep 11 09:59:35 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: rc.conf,v 1.158 2020/06/15 01:57:30 christos Exp $
+# $NetBSD: rc.conf,v 1.159 2020/09/11 09:59:35 kim Exp $
#
# /etc/defaults/rc.conf --
# default configuration of /etc/rc.conf
@@ -133,6 +133,7 @@
per_user_tmp_dir="/private/tmp" # real storage for /tmp
clear_tmp=YES # clear /tmp after reboot
update_motd=YES # updates /etc/motd
+update_motd_release=NO motd_release_tag="" # release info in /etc/motd
dmesg=YES dmesg_flags="-t" # write /var/run/dmesg.boot
accounting=NO # uses /var/account/acct
newsyslog=NO newsyslog_flags="" # trim log files
diff -r 57632a8d6081 -r c81195f360ba etc/rc.d/motd
--- a/etc/rc.d/motd Fri Sep 11 09:08:47 2020 +0000
+++ b/etc/rc.d/motd Fri Sep 11 09:59:35 2020 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: motd,v 1.9 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: motd,v 1.10 2020/09/11 09:59:35 kim Exp $
#
# PROVIDE: motd
@@ -16,7 +16,7 @@
motd_start()
{
- # Update kernel info in /etc/motd
+ # Update kernel and release info in /etc/motd
# Must be done *before* interactive logins are possible
# to prevent possible race conditions.
#
@@ -27,7 +27,16 @@
( umask 022
T=/etc/_motd
sysctl -n kern.version | while read i; do echo $i; break; done > $T
- sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
+ if checkyesno update_motd_release; then
+ local t="${motd_release_tag}"
+ sed -En '1{/^NetBSD/{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;};};' \
+ < /etc/motd >> $T
+ else
+ sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
+ fi
cmp -s $T /etc/motd || cp $T /etc/motd
rm -f $T
)
Home |
Main Index |
Thread Index |
Old Index