forked from rpmfusion/mythtv-status
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmythtv-status-update-motd.patch
37 lines (33 loc) · 1.08 KB
/
mythtv-status-update-motd.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- mythtv-status-0.10.4/bin/mythtv-update-motd.orig 2013-10-28 10:39:56.000000000 +0100
+++ mythtv-status-0.10.4/bin/mythtv-update-motd 2016-03-07 22:10:12.000000000 +0100
@@ -1,17 +1,28 @@
#!/bin/bash
-. /etc/default/mythtv-status
+. /etc/sysconfig/mythtv-status
-if [ x$RUN != xyes ]
+if [ x$UPDATEMOTD != xyes ]
then
exit
fi
-[ ! -f /var/run/motd.orig ] && cp /var/run/motd /var/run/motd.orig
+# Check if stub exists. If not, assume motd is OK to use as stub
+if [ ! -f /etc/motd.stub ]; then
+ if [ -f /etc/motd ]; then
+ cp -a /etc/motd /etc/motd.stub
+ else # No motd exists, create empty stub file
+ touch /etc/motd.stub
+ fi
+fi
+
+# Update motd:
-cp /var/run/motd.orig /var/run/motd.new
+# Insert stub
+cp /etc/motd.stub /tmp/motd.new
+# Add mythtv status to end of stub
ret=0
-mythtv-status $ARGS -h $HOST >> /var/run/motd.new 2> /dev/null || ret=$?
+mythtv-status $ARGS -h $HOST >> /tmp/motd.new || ret=$?
if [ $ret -eq 0 -o $ret -eq 1 ]; then
- [ -f /var/run/motd.new ] && mv /var/run/motd.new /var/run/motd
+ [ -f /tmp/motd.new ] && mv /tmp/motd.new /etc/motd
fi