summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core/LinHES-system/linhes_update.sh74
-rw-r--r--abs/core/LinHES-system/linhes_update2.sh52
-rw-r--r--abs/core/LinHES-system/linhes_update3.sh28
-rwxr-xr-xabs/core/LinHES-system/mythwelcome-config.py27
-rwxr-xr-xabs/core/LinHES-system/mythwelcome-set-alarm.sh23
-rwxr-xr-xabs/core/LinHES-system/mythwelcome-test-wakeup.sh16
6 files changed, 220 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/linhes_update.sh b/abs/core/LinHES-system/linhes_update.sh
new file mode 100644
index 0000000..e5dd2ad
--- /dev/null
+++ b/abs/core/LinHES-system/linhes_update.sh
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+#----------------------------------------------------------------------------
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
+#----------------------------------------------------------------------------
+dsply () {
+ if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
+ then
+ killall -9 osd_cat
+ echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ exit
+ else
+ killall -9 osd_cat
+ echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ fi
+}
+chck () {
+ sudo pacman -Sy
+ sudo pacman -Qu > /tmp/to_be_upgraded
+ if [[ ! -s /tmp/to_be_upgraded ]]
+ then
+ killall -9 osd_cat
+ echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ else
+ mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
+ sed -e '/\#Check/,/\#Check/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml
+ mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp
+ grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp
+ echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
+ echo " <button>" >> /tmp/linhes.xml.tmp
+ echo " <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
+ echo " <text>Updates Available</text>" >> /tmp/linhes.xml.tmp
+ echo " <action>MENU update2.xml</action>" >> /tmp/linhes.xml.tmp
+ echo " </button>" >> /tmp/linhes.xml.tmp
+ echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp
+ echo "</mythmenu>" >> /tmp/linhes.xml.tmp
+ mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
+
+ echo "<mythmenu name=\"LinHES\">" > /tmp/update3.xml.tmp
+ if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
+ then
+ echo "" >> /tmp/update3.xml.tmp
+ echo " <button>" >> /tmp/update3.xml.tmp
+ echo " <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
+ echo " <text>REBOOT REQUIRED</text>" >> /tmp/update3.xml.tmp
+ echo " <action>NONE</action>" >> /tmp/update3.xml.tmp
+ echo " </button>" >> /tmp/update3.xml.tmp
+ fi
+
+ while read line; do
+ echo "" >> /tmp/update3.xml.tmp
+ echo " <button>" >> /tmp/update3.xml.tmp
+ echo " <type>UPGRADE</type>" >> /tmp/update3.xml.tmp
+ echo " <text>$line</text>" >> /tmp/update3.xml.tmp
+ echo " <action>NONE</action>" >> /tmp/update3.xml.tmp
+ echo " </button>" >> /tmp/update3.xml.tmp
+ done < "/tmp/to_be_upgraded"
+ echo "</mythmenu>" >> /tmp/update3.xml.tmp
+ mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml
+ dsply
+ fi
+ }
+dsply
+chck
diff --git a/abs/core/LinHES-system/linhes_update2.sh b/abs/core/LinHES-system/linhes_update2.sh
new file mode 100644
index 0000000..d6984ed
--- /dev/null
+++ b/abs/core/LinHES-system/linhes_update2.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#----------------------------------------------------------------------------
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
+#----------------------------------------------------------------------------
+
+if [[ "$1" = "install" ]]
+then
+ killall -9 osd_cat
+ echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ sudo pacman -Suf --noconfirm && sudo killall -9 osd_cat
+ killall -9 osd_cat
+ echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded
+ then
+ echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ fi
+else
+ killall -9 osd_cat
+ echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+fi
+
+rm -fr /tmp/to_be_upgraded
+
+if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml
+then
+ mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp
+ sed -e '/\#UpdatesAv/,/\#UpdatesAv/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml
+ mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp
+ grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp
+ echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
+ echo " <button>" >> /tmp/linhes.xml.tmp
+ echo " <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp
+ echo " <text>Update LinHES</text>" >> /tmp/linhes.xml.tmp
+ echo " <action>MENU update.xml</action>" >> /tmp/linhes.xml.tmp
+ echo " </button>" >> /tmp/linhes.xml.tmp
+ echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp
+ echo "" >> /tmp/linhes.xml.tmp
+ echo "</mythmenu>" >> /tmp/linhes.xml.tmp
+ mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml
+fi
diff --git a/abs/core/LinHES-system/linhes_update3.sh b/abs/core/LinHES-system/linhes_update3.sh
new file mode 100644
index 0000000..72641db
--- /dev/null
+++ b/abs/core/LinHES-system/linhes_update3.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+#----------------------------------------------------------------------------
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
+#----------------------------------------------------------------------------
+
+sudo killall osd_cat
+cat /tmp/to_be_upgraded | sed 's/ /\n/g' | sed '/^$/d' | grep - > /tmp/to_be_upgraded2
+COUNT=$(wc -l /tmp/to_be_upgraded2 | awk '{print $1}')
+if [ $COUNT -lt 20 ]
+ then
+ cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=12 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+ else
+ cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=1 --wait --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+fi
+if grep kernel26 /tmp/to_be_upgraded2
+then
+ killall -9 osd_cat
+ echo -e "Please note:\The kernel will be upgraded.\nThis will require a reboot.\nPlease do so when no jobs are running." | osd_cat --pos=middle --align=center --delay=10 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
+else
+ exit
+fi
diff --git a/abs/core/LinHES-system/mythwelcome-config.py b/abs/core/LinHES-system/mythwelcome-config.py
new file mode 100755
index 0000000..5ab24b0
--- /dev/null
+++ b/abs/core/LinHES-system/mythwelcome-config.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python2
+
+# This script will configure the myth db to allow MythWelcome to wake and shutdown the system.
+
+from socket import gethostname
+from MythTV import MythDB
+mythdb = MythDB()
+localhostname = gethostname()
+
+# mythwelcome --setup
+mythdb.settings[localhostname].MythShutdownNvramCmd = u'sudo sh -c \"/usr/LH/bin/mythwelcome-set-alarm.sh $time\"'
+mythdb.settings[localhostname].MythShutdownWakeupTimeFmt = u'time_t'
+mythdb.settings[localhostname].MythShutdownNvramRestartCmd = u''
+mythdb.settings[localhostname].MythShutdownReboot = u'sudo /sbin/reboot'
+mythdb.settings[localhostname].MythShutdownPowerOff = u'sudo /sbin/poweroff'
+mythdb.settings[localhostname].MythShutdownXTermCmd = u'xterm'
+mythdb.settings[localhostname].MythWelcomeStartFECmd = u'/usr/LH/bin/mythfrontend-start'
+
+
+# mythtv-setup Shutdown/Wakeup options
+if mythdb.settings[localhostname].idleTimeoutSecs == u'0':
+ mythdb.settings[localhostname].idleTimeoutSecs = u'40'
+
+mythdb.settings.NULL.WakeupTimeFormat = u'yyyy-MM-ddThh:mm:ss'
+mythdb.settings.NULL.SetWakeuptimeCommand = u'/usr/bin/mythshutdown --setwakeup $time'
+mythdb.settings.NULL.ServerHaltCommand = u'/usr/bin/mythshutdown --shutdown'
+mythdb.settings.NULL.preSDWUCheckCommand = u'/usr/LH/bin/idle.sh -s -m -r'
diff --git a/abs/core/LinHES-system/mythwelcome-set-alarm.sh b/abs/core/LinHES-system/mythwelcome-set-alarm.sh
new file mode 100755
index 0000000..990adf7
--- /dev/null
+++ b/abs/core/LinHES-system/mythwelcome-set-alarm.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+#$1 is the first argument to the script. It is the time in seconds since 1970
+#This is defined in mythwelcome with the time_t argument
+
+# Configure mythwelcome --setup page:
+# Command to Set Wakeup Time: sudo sh -c "/usr/LH/bin/mythwelcome-set-alarm.sh $time"
+# Wakeup Time Format: time_t
+# nvram-wakeup Restart Command: Leave this blank
+# Command to reboot: sudo /sbin/reboot
+# Command to shutdown: sudo /sbin/poweroff
+# Command to run Xterm: xterm
+# Command to start the Frontend: /usr/bin/mythfrontend -l /var/log/mythtv/mythfrontend.log
+
+# Configure mythtv-setup Shutdown/Wakeup Options page:
+# Idletimeout (secs): any value greater that 0
+# Wakeup time format: yyyy-MM-ddThh:mm:ss
+# Set wakeup time command: /usr/bin/mythshutdown --setwakeup $time
+# Server Halt command: /usr/bin/mythshutdown --shutdown
+# Pre shutdown check command: /usr/bin/mythshutdown --check
+
+echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm
+echo $1 > /sys/class/rtc/rtc0/wakealarm #this writes your alarm
+cat /proc/driver/rtc > /var/log/wake_alarm
diff --git a/abs/core/LinHES-system/mythwelcome-test-wakeup.sh b/abs/core/LinHES-system/mythwelcome-test-wakeup.sh
new file mode 100755
index 0000000..4aadf6d
--- /dev/null
+++ b/abs/core/LinHES-system/mythwelcome-test-wakeup.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" #this clears your alarm
+sudo sh -c "echo `date '+%s' -d '+ 4 minutes'` > /sys/class/rtc/rtc0/wakealarm" #this writes your alarm
+cat /proc/driver/rtc
+cat /proc/driver/rtc > /var/log/wake_alarm
+echo "Your computer is set to start up in 4 minutes using ACPI."
+echo -n "Do you want to shutdown the computer now? (y/n): "
+read -n 1 shutdown
+if [ "$shutdown" == "y" ]; then
+ echo -e "\nShutting down now..."
+ sudo shutdown -t 5 -h now
+else
+ echo -e "\nTo shutdown execute the following:"
+ echo " sudo shutdown -t 5 -h now"
+fi