Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177540294
D3781.1794667481.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D3781.1794667481.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()
{
@@ -24,23 +25,22 @@
#
check_startmsgs && echo -n 'Updating motd:'
if [ ! -f /etc/motd ]; then
- install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
+ 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
Sat, Nov 14, 2:44 PM (4 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41725524
Default Alt Text
D3781.1794667481.diff (1 KB)
Attached To
Mode
D3781: simplify the motd updating script
Attached
Detach File
Event Timeline