Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153099123
D3781.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D3781.diff
View Options
Index: etc/rc.d/motd
===================================================================
--- etc/rc.d/motd
+++ etc/rc.d/motd
@@ -15,6 +15,7 @@
stop_cmd=":"
PERMS="644"
+MOTD_FILE="/etc/motd"
motd_start()
{
@@ -23,24 +24,23 @@
# to prevent possible race conditions.
#
check_startmsgs && echo -n 'Updating motd:'
- if [ ! -f /etc/motd ]; then
- install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
+ if [ ! -f ${MOTD_FILE} ]; then
+ install -c -o root -g wheel -m ${PERMS} /dev/null ${MOTD_FILE}
fi
- if [ ! -w /etc/motd ]; then
+ if [ ! -w ${MOTD_FILE} ]; then
echo ' /etc/motd is not writable, update failed.'
return
fi
T=`mktemp -t motd`
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
- awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
+ awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < ${MOTD_FILE} >> ${T}
- cmp -s $T /etc/motd || {
- cp $T /etc/motd
- chmod ${PERMS} /etc/motd
- }
- rm -f $T
+ if ! cmp -s ${T} ${MOTD_FILE}; then
+ install -c -o root -g wheel -m ${PERMS} ${T} ${MOTD_FILE}
+ fi
+ rm -f ${T}
check_startmsgs && echo '.'
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 20, 3:30 AM (16 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31817884
Default Alt Text
D3781.diff (1 KB)
Attached To
Mode
D3781: simplify the motd updating script
Attached
Detach File
Event Timeline
Log In to Comment