Changeset View
Changeset View
Standalone View
Standalone View
etc/rc.d/motd
Context not available. | |||||
stop_cmd=":" | stop_cmd=":" | ||||
PERMS="644" | PERMS="644" | ||||
MOTD_FILE="/etc/motd" | |||||
bdrewery: What benefit is there to this? Is it solving something you ran into? | |||||
opAuthorUnsubmitted Not Done Inline ActionsJust a refactor. op: Just a refactor. | |||||
bdreweryUnsubmitted Not Done Inline ActionsLine 32 missed ${MOTD_FILE}. I don't really see the benefit in changing this; I don't like changing things for no good reason. If MOTD_FILE was in etc/defaults/rc.conf and had some reason to be moved I would be more inclined to consider this, but I don't see a great benefit in that either. bdrewery: Line 32 missed ${MOTD_FILE}.
I don't really see the benefit in changing this; I don't like… | |||||
motd_start() | motd_start() | ||||
{ | { | ||||
Context not available. | |||||
# to prevent possible race conditions. | # to prevent possible race conditions. | ||||
# | # | ||||
check_startmsgs && echo -n 'Updating motd:' | check_startmsgs && echo -n 'Updating motd:' | ||||
if [ ! -f /etc/motd ]; then | if [ ! -f ${MOTD_FILE} ]; 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 | fi | ||||
if [ ! -w /etc/motd ]; then | if [ ! -w ${MOTD_FILE} ]; then | ||||
echo ' /etc/motd is not writable, update failed.' | echo ' /etc/motd is not writable, update failed.' | ||||
return | return | ||||
fi | fi | ||||
T=`mktemp -t motd` | T=`mktemp -t motd` | ||||
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} | 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 || { | if ! cmp -s ${T} ${MOTD_FILE}; then | ||||
cp $T /etc/motd | install -c -o root -g wheel -m ${PERMS} ${T} ${MOTD_FILE} | ||||
chmod ${PERMS} /etc/motd | fi | ||||
} | rm -f ${T} | ||||
rm -f $T | |||||
check_startmsgs && echo '.' | check_startmsgs && echo '.' | ||||
} | } | ||||
Context not available. |
What benefit is there to this? Is it solving something you ran into?