Skip to content

Commit 263701b

Browse files
committed
Use /var/lib/update-motd instead of /var/run
JIRA AL-1717
1 parent e6896b0 commit 263701b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

srpm/sbin_update-motd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ then
4545
fi
4646

4747
if [ -d /etc/update-motd.d ]; then
48-
TMPFILE=$(mktemp -p /var/run motd.XXXXX)
48+
TMPFILE=$(mktemp -p /var/tmp motd.XXXXX)
4949
if [ -f /etc/motd.head ]; then
5050
cat /etc/motd.head >> $TMPFILE
5151
fi
@@ -70,7 +70,7 @@ if [ -d /etc/update-motd.d ]; then
7070
if [ -s $TMPFILE ]; then
7171
# mktemp creates files with only user read-write permissions
7272
chmod go+r $TMPFILE
73-
mv $TMPFILE /var/run/motd
73+
mv $TMPFILE /var/lib/update-motd/motd
7474
else
7575
# Don't leave temp files
7676
rm -f $TMPFILE

srpm/update-motd.spec

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ install -D -m 0444 %{SOURCE2} %{buildroot}/etc/init/update-motd.conf
2828
install -D -m 0444 %{SOURCE3} %{buildroot}/usr/lib/yum-plugins/update-motd.py
2929
install -D -m 0444 %{SOURCE4} %{buildroot}/etc/yum/pluginconf.d/update-motd.conf
3030
# for %ghost
31-
install -d %{buildroot}/var/run
32-
touch %{buildroot}/var/run/motd
31+
install -d %{buildroot}/var/lib/update-motd
32+
touch %{buildroot}/var/lib/update-motd/motd
3333

3434
%clean
3535
rm -rf %{buildroot}
@@ -38,12 +38,12 @@ rm -rf %{buildroot}
3838
# Only run this on initial install
3939
if [ "$1" = "1" ]; then
4040
# Backup the current MOTD
41-
if [ -e /etc/motd ] && [ "$(readlink /etc/motd)" != "/var/run/motd" ]; then
42-
cp /etc/motd /etc/motd.rpmsave
41+
if [ -e /etc/motd ] && [ "$(readlink /etc/motd)" != "/var/lib/update-motd/motd" ]; then
42+
mv /etc/motd /etc/motd.rpmsave
4343
# And let it be the MOTD until update-motd gets run
44-
mv /etc/motd /var/run/motd
44+
cp -L /etc/motd.rpmsave /var/lib/update-motd/motd
4545
fi
46-
ln -snf /var/run/motd /etc/motd
46+
ln -snf /var/lib/update-motd/motd /etc/motd
4747
fi
4848
# We don't run update-motd on install because the various update-motd.d scripts
4949
# are not installed yet (since their packages will depend on this one).
@@ -52,11 +52,12 @@ fi
5252
%files
5353
%defattr(-,root,root,-)
5454
%dir /etc/update-motd.d
55+
%dir /var/lib/update-motd
5556
%config /etc/cron.daily/update-motd
5657
%config /etc/init/update-motd.conf
5758
%config /etc/yum/pluginconf.d/update-motd.conf
5859
/usr/sbin/update-motd
5960
/usr/lib/yum-plugins/update-motd.py*
60-
%ghost /var/run/motd
61+
%ghost /var/lib/update-motd/motd
6162

6263
%changelog

0 commit comments

Comments
 (0)