summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2010-08-30 22:24:02 (GMT)
committerJames Meyer <james.meyer@operamail.com>2010-08-30 22:24:02 (GMT)
commitc4bd4457b5d640e1c8f5afbca7cd54c53691e5fc (patch)
treef4e4f7a91e1d9d90033fd99d89e5e26a2c144528 /abs/core/LinHES-system
parent0e7b327a1ae444233f1308a95420f70540ad74a3 (diff)
downloadlinhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.zip
linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.gz
linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.bz2
RSYNC CORE:
resync core-testing -> core Signed-off-by: James Meyer <james.meyer@operamail.com>
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-x[-rw-r--r--]abs/core/LinHES-system/LinHES-run44
-rw-r--r--abs/core/LinHES-system/LinHES.install10
-rwxr-xr-x[-rw-r--r--]abs/core/LinHES-system/PKGBUILD62
-rwxr-xr-xabs/core/LinHES-system/bin/mythbackup42
-rwxr-xr-xabs/core/LinHES-system/bin/mythrestore45
-rwxr-xr-xabs/core/LinHES-system/firstboot.sh33
-rwxr-xr-xabs/core/LinHES-system/mythfrontend-start22
-rw-r--r--abs/core/LinHES-system/smolt.cron11
-rwxr-xr-xabs/core/LinHES-system/tvterm.sh25
-rw-r--r--abs/core/LinHES-system/unclutter-toggle.sh5
10 files changed, 251 insertions, 48 deletions
diff --git a/abs/core/LinHES-system/LinHES-run b/abs/core/LinHES-system/LinHES-run
index 1b91def..d5a3a15 100644..100755
--- a/abs/core/LinHES-system/LinHES-run
+++ b/abs/core/LinHES-system/LinHES-run
@@ -1,13 +1,28 @@
#!/bin/sh
+function msg(){
+ echo -e "$1" | osd_cat --pos=middle --align=center --offset=200 --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+}
+
. /etc/profile
. /etc/systemconfig
-
+. /etc/unclutter.cfg || {
+ idle=1
+ jitter=200
+}
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
#keylaunch &
#/usr/bin/tilda &
#move mouse to corner
-xdotool mousemove -10 -10
-/usr/X11R6/bin/unclutter -root -idle 1 -jitter 200 -noevents &
+xdotool mousemove 0 0
+/usr/X11R6/bin/unclutter -root -idle $idle -jitter $jitter -noevents &
if [ x"$Screensavertype" = "xgscreensaver" ]
then
gnome-screensaver &
@@ -23,7 +38,7 @@ mtd &
if [ x$ShowTips = "x1" ]
then
- echo "Alt+h for help" | osd_cat --font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" --shadow=3 --pos=middle --align=centre --offset=200 --color=yellow --delay=5 &
+ msg "Alt+h for help" &
fi
# Run any scripting that applies to special hardware. These brand-specific commands that run
@@ -46,6 +61,13 @@ SpecialHardwareCommands() {
esac
}
+#update apple trailers
+if [[ x$RunFrontend = x1 && -f ~/.configure ]]
+then
+ /usr/bin/php -q /usr/bin/myth_trailers_grabber > /home/mythtv/appletrailer.xml && /usr/bin/fix_aple_url.sh 2>/dev/null &
+fi
+
+
if [ ! $SystemType = "Frontend_only" ]
then
if [ -f ~/.configure ]
@@ -60,12 +82,16 @@ then
else
rm -f ~/.no_meth
fi
- sudo sv stop mythbackend
- xterm -fn *18* -e sudo taskset -c 0 /usr/bin/mythtv-setup
- sudo sv start mythbackend
+ sudo pacman -R myth2ipod myt2xvid3
+ sudo pacman -S --noconfirm myth2ipod myt2xvid3
+ sudo sv stop mythbackend
+ cat /data/database/dvd_transcode_r6.sql | mysql -u root mythconverg
+ xterm -fn *18* -e sudo taskset -c 0 /usr/bin/mythtv-setup
+ sudo sv start mythbackend
sudo chown -R mythtv.mythtv /home/mythtv
- nice -n 19 mythfilldatabase --quiet &
- rm ~/.configure
+ nice -n 19 mythfilldatabase --quiet &
+ msg "Guide data is being loaded. \n Until this completes\n some shows will appear as unknown \n in the program guide."
+ rm ~/.configure
fi
fi
diff --git a/abs/core/LinHES-system/LinHES.install b/abs/core/LinHES-system/LinHES.install
index 2d2bdf2..0f6689e 100644
--- a/abs/core/LinHES-system/LinHES.install
+++ b/abs/core/LinHES-system/LinHES.install
@@ -12,7 +12,10 @@ MVDIR=/usr/LH/bin
# ln -s $MVDIR/backup_job /etc/cron.daily/backup_cron
# ln -s $MVDIR/update_system /etc/cron.daily/xupdate_system_cron
# ln -s $MVDIR/repo_sync.sh /etc/cron.daily/zrepo_sync.sh
- ln -s $MVDIR/myth_mtc.sh /etc/cron.daily/myth_mtc.sh
+ if [ ! -e /etc/cron.daily/myth_mtc.sh ]
+ then
+ ln -s $MVDIR/myth_mtc.sh /etc/cron.daily/myth_mtc.sh
+ fi
#LINE="mythtv ALL = NOPASSWD: /sbin/sv stop mythbackend"
LINE="mythtv ALL=(ALL) NOPASSWD: ALL"
@@ -45,7 +48,12 @@ grep -q "pam_limits.so" /etc/pam.d/su
fi
+# Update mythtv's fluxbox keys files to use the tvterm.sh script to get
+# an xterm. Then signal fluxbox to re-read the keys file.
+sed -i.orig 's/^Mod1 x :.*xterm.*$/Mod1 x :ExecCommand tvterm.sh/g' \
+ ~mythtv/.fluxbox/keys
+pkill -HUP fluxbox
}
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 2a10fe0..0e699f4 100644..100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
-pkgver=1.0
-pkgrel=69
+pkgver=1.1
+pkgrel=32
arch=('i686')
MVDIR=$startdir/pkg/usr/LH
BINDIR=$startdir/pkg/usr/bin
@@ -8,35 +8,49 @@ install=LinHES.install
pkgdesc="scripts and things related to having a automated system"
depends=(linhes-sounds xdotool)
backup=(etc/modprobe.d/alsa-base)
-binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh myth_mtc.lr"
+binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run firstboot.sh load-modules-mythvantage.sh unclutter-toggle.sh tvterm.sh myth_mtc.lr smolt.cron mythfrontend-start"
source=(LinHES-session LinHES-profile.sh $binfiles alsa-base)
build() {
cd $startdir/src
install -m755 -D LinHES-session $startdir/pkg/etc/X11/Sessions/LinHES
- install -m755 -D LinHES-profile.sh $startdir/pkg/etc/profile.d/LinHES-profile.sh
-####### install to /usr/LH/bin
-#mkdir -p $BINDIR
+ install -m755 -D LinHES-profile.sh $startdir/pkg/etc/profile.d/LinHES-profile.sh
+ ####### install to /usr/LH/bin
+ for i in $binfiles
+ do
+ item=$i
+ install -m755 -D $item $MVDIR/bin/$item
+ echo $item
+ done
-for i in $binfiles
-do
- item=$i
- install -m755 -D $item $MVDIR/bin/$item
- echo $item
+ cd $startdir/bin
+ for i in *
+ do
+ item=$i
+ install -m755 -D $item $MVDIR/bin/$item
+ echo $item
+ done
-done
-
-cd $startdir/bin
-for i in *
-do
- item=$i
- install -m755 -D $item $MVDIR/bin/$item
- echo $item
-
-done
-install -m755 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base
-mkdir $startdir/pkg/etc/logrotate.d
-cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
+ install -m755 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base
+ install -m755 -D $startdir/src/smolt.cron $startdir/pkg/etc/cron.weekly/smolt.cron
+ mkdir $startdir/pkg/etc/logrotate.d
+ cp $startdir/myth_mtc.lr $startdir/pkg/etc/logrotate.d
}
+
+md5sums=('19934a456d0e112298b8aac3279f9a16'
+ '5881bdb43d578ec3a79d1f77ea58a3db'
+ 'a875ee97f86e46f34a741c2bc455f894'
+ 'cdcbc530224215f8fcf7ebcd93d7eb0b'
+ 'c60b6c66f498809a6e5ca18a8c97d336'
+ 'ccae1296ef248fa52ec3a7cb820a476e'
+ 'b58b59c05faeefd4acbbb7876215c875'
+ '18a884a73344ff6eb74f63b49745e0f5'
+ 'dc3eef2a624754e16805d72bbe488b67'
+ 'dc0be354ce77ba2b89868fc29b942c43'
+ '542e670e78d117657f93141e9689f54d'
+ 'f1870a9522c79e6b248fcbf81dec3280'
+ 'abe887472a170bd1a8e6da6a7b7e93e4'
+ '752488eb8bfb672ce0e4c924f7faf3d1'
+ 'eb879fee9603a05d5420d4ce8ed9e450')
diff --git a/abs/core/LinHES-system/bin/mythbackup b/abs/core/LinHES-system/bin/mythbackup
index d0d028d..3b4edd4 100755
--- a/abs/core/LinHES-system/bin/mythbackup
+++ b/abs/core/LinHES-system/bin/mythbackup
@@ -5,8 +5,32 @@
echo 1>&2 "Can not load common settings!"
exit 1
}
+
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
#----------------------------------------------------------------------------
+# Function to display status onscreen
+osd()
+# Arg_1 = display text Arg_2 = delay time Arg_3 = line num
+{
+ TEXT=$1
+ killall -9 osd_cat
+ if [ $3 -gt 1 ]; then
+ for ((i=2; i <= $3 ; i++))
+ do
+ TEXT="\n"$TEXT
+ done
+ fi
+ printf "$TEXT" | osd_cat --lines=6 --pos=middle --align=center --delay=$2 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+}
+
# Prevent mythshutdown from shutting down the system in the middle...
lock_myth
@@ -14,12 +38,15 @@ lock_myth
play_sound init.wav
# Keep a chain of recent backups,
+export DISPLAY=:0.0
+osd "Rolling over old backups..." 0 1
echo "Starting rollover of old backups, this may take a while..."
[ -f "$BACKUP_SQL" ] && shrink $BACKUP_SQL
[ -f "$BACKUP_TAR" ] && shrink $BACKUP_TAR
backup_roller .19 .18 .17 .16 .15 .14 .13 .12 .11 .10 .9 .8 .7 .6 .5 .4 .3 .2 .1 ''
echo "Rollover completed."
+osd "Checking the database..." 0 2
# Start with the database backup, first we make sure it's healthy, and
# then we can dump it.
# Doing this while the backend is active would be BAD.
@@ -31,10 +58,12 @@ cd $DATABASE_DIR
$MYISAMCHK -f *.MYI
start_mysqld
+osd "Backing up database..." 0 3
# Dumps the $DATABASE database
$MYSQLDUMP -v -c -u root $DATABASE > $BACKUP_SQL
shrink $BACKUP_SQL
+osd "Backing up files..." 0 4
# Now to backup the other files, no fooling around, grab everything in the
# list because you never know what you'll want, and we can always get clever
# about what to restore later...
@@ -49,19 +78,32 @@ shrink $BACKUP_TAR
$CHOWN root:root $BACKUP_TAR* $BACKUP_SQL*
$CHMOD go-rwx $BACKUP_TAR* $BACKUP_SQL*
+osd "Testing backup..." 0 5
echo "Sanity checking your backup..."
play_sound testing.wav
# Play a sound to let you know the outcome.
if check_files_and_tables $BACKUP_LIST ; then
+ osd "Backup completed successfully." 5 6
echo "Backup passes all checks."
+ COMPLETE_MSG="Last backup completed on `date '+%D @ %-I:%M %p'`"
play_sound complete.wav
STATUS=0
else
+ osd "Backup FAILED." 5 6
echo "The backup is bad or already out of date!"
+ COMPLETE_MSG="Last backup FAILED on `date '+%D @ %-I:%M %p'`"
play_sound fail.wav
STATUS=1
fi
+# Add Last backup status to menu item
+if grep "<description>" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml >/dev/null 2>&1
+then
+ sed -i "s_\<description\>.*\<description\>_description\>$COMPLETE_MSG\<\/description_" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml
+else
+ sed -i.orig " /NONE/ i\ \<description\>$COMPLETE_MSG\<\/description\>" /usr/share/mythtv/themes/defaultmenu/mythbackup.xml
+fi
+
# Now we can restart the backend.
start_mythbackend
diff --git a/abs/core/LinHES-system/bin/mythrestore b/abs/core/LinHES-system/bin/mythrestore
index 7fce371..447b0b8 100755
--- a/abs/core/LinHES-system/bin/mythrestore
+++ b/abs/core/LinHES-system/bin/mythrestore
@@ -5,8 +5,32 @@
echo 1>&2 "Can not load common settings!"
exit 1
}
+
+. /etc/osd_cat.cfg || {
+ color=yellow
+ outline=2
+ outlinecolour=black
+ shadow=0
+ shadowcolour=black
+ font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
+}
#----------------------------------------------------------------------------
+# Function to display status onscreen
+osd()
+# Arg_1 = display text Arg_2 = delay time Arg_3 = line num
+{
+ TEXT=$1
+ killall -9 osd_cat
+ if [ $3 -gt 1 ]; then
+ for ((i=2; i <= $3 ; i++))
+ do
+ TEXT="\n"$TEXT
+ done
+ fi
+ printf "$TEXT" | osd_cat --lines=6 --pos=middle --align=center --delay=$2 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+}
+
do_file_updates() { # A function because we need to do this in two places
echo "Doing any needed file updates..."
[ -n "$UPDATE_FILES" -a -f "$UPDATE_FILES" -a -x "$UPDATE_FILES" ] &&
@@ -39,6 +63,7 @@ lock_myth
# Play a sound to let you know I'm starting.
play_sound restore.wav
+export DISPLAY=:0.0
# Doing this while the backend is active could be BAD.
stop_mythbackend
@@ -46,6 +71,7 @@ stop_mythbackend
# If the standard backup file exists we try to restore the files based
# on our restore list.
if compression=$(compression_type "$BACKUP_TAR") ; then
+ osd "Restoring files..." 0 1
echo "Starting the restore of files..."
cd /
expand -c $BACKUP_TAR$compression |
@@ -59,8 +85,11 @@ if compression=$(compression_type "$BACKUP_SQL") ; then
echo "Starting the DB restore, this can take a while..."
echo "Clearing out the existing skeleton..."
#mysql_stdin < $DROP_SQL
+ osd "Recreating database..." 0 2
echo "Recreating the db..."
+ sleep 1
$MYSQLADMIN -u root create $DATABASE
+ osd "Restoring database..." 0 3
echo "Restoring the data (long)..."
expand -c $BACKUP_SQL$compression | mysql_stdin
echo "Doing any needed db updates..."
@@ -69,23 +98,39 @@ if compression=$(compression_type "$BACKUP_SQL") ; then
echo "Completed the DB restore."
fi
+osd "Testing restore..." 0 4
echo "Sanity checking your restore..."
play_sound vr.wav
# Play a sound to let you know the outcome.
if check_files_and_tables $RESTORE_LIST ; then
+ osd "Restore completed successfully." 5 5
echo "Restore passes all checks."
+ COMPLETE_MSG="Last restore completed on `date '+%D @ %-I:%M %p'`"
play_sound restored.wav
STATUS=0
else
+ osd "Restore FAILED." 5 5
echo "The restore failed or was already modified!"
+ COMPLETE_MSG="Last restore FAILED on `date '+%D @ %-I:%M %p'`"
play_sound rf.wav
STATUS=1
fi
+# Add Last restore status to menu item
+if grep "<description>" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml >/dev/null 2>&1
+then
+ sed -i "s_\<description\>.*\<description\>_description\>$COMPLETE_MSG\<\/description_" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml
+else
+ sed -i.orig " /NONE/ i\ \<description\>$COMPLETE_MSG\<\/description\>" /usr/share/mythtv/themes/defaultmenu/mythrestore.xml
+fi
+
# Make any updates _after_ we verify the backup...
do_db_updates
do_file_updates
+#post restore fixup for sshd
+/usr/MythVantage/bin/systemconfig.py -m user
+
# Now it's more or less safe to restart the backend.
start_mythbackend
diff --git a/abs/core/LinHES-system/firstboot.sh b/abs/core/LinHES-system/firstboot.sh
index 47aa0f9..7e2f603 100755
--- a/abs/core/LinHES-system/firstboot.sh
+++ b/abs/core/LinHES-system/firstboot.sh
@@ -1,22 +1,29 @@
#!/bin/bash
. ~/.configured
ATTEMPT=0
+
function try_smolt {
- ((ATTEMPT=ATTEMPT+1))
- status=$(echo "jump mythsmolt" | telnet localhost 6546 2>&1)
- echo $status|grep -q refused
- status=$?
- if [ $status != 0 ]
- then
- fb_status=0
- echo "FB=NO" > ~/.configured
- fi
- if [ $ATTEMPT = 200 ]
- then
- fb_status=0
- fi
+ ((ATTEMPT=ATTEMPT+1))
+ WID=`xdotool search "mythfrontend" | head -1`
+ xdotool windowfocus $WID
+ status=$?
+ if [ $status = 0 ]
+ then
+ sleep 2
+ xdotool key "ctrl+alt+p"
+ xdotool key "ctrl+alt+p"
+ fb_status=0
+ echo "FB=NO" > ~/.configured
+ fi
+
+ if [ $ATTEMPT = 200 ]
+ then
+ fb_status=0
+ fi
+
}
+
if [ ! -e /tmp/debug ]
then
if [ ! -e /tmp/nomfe ]
diff --git a/abs/core/LinHES-system/mythfrontend-start b/abs/core/LinHES-system/mythfrontend-start
new file mode 100755
index 0000000..c92d024
--- /dev/null
+++ b/abs/core/LinHES-system/mythfrontend-start
@@ -0,0 +1,22 @@
+#!/bin/bash
+PIDS=$(pidof mythfrontend)
+P_array=( $PIDS )
+let "instances = ${#P_array[*]}" # Count elements.
+
+if [ $instances -gt 0 ];
+then
+ if [ $instances -eq 1 ]; then
+ diagtext="is already a MythFrontend"
+ else
+ diagtext="are already $instances MythFrontends"
+ fi
+
+ question="There $diagtext running. Do you really want to start another one?"
+ mythvantage -q "${question}"
+ if [ $? = 16 ]
+ then
+ mythfrontend --logfile /var/log/mythtv/mythfrontend.log
+ fi
+else
+ mythfrontend --logfile /var/log/mythtv/mythfrontend.log
+fi
diff --git a/abs/core/LinHES-system/smolt.cron b/abs/core/LinHES-system/smolt.cron
new file mode 100644
index 0000000..f418df1
--- /dev/null
+++ b/abs/core/LinHES-system/smolt.cron
@@ -0,0 +1,11 @@
+#!/bin/bash
+. /etc/profile
+if [ -f /home/mythtv/.mythtv/MythSmolt/hw-uuid ]
+then
+ cd /usr/share/mythtv/mythsmolt/scripts
+ touch /var/log/smolt.update
+ chown mythtv /var/log/smolt.update
+ random=$((RANDOM%2000))
+ sleep $random
+ su mythtv -c "./sendProfile.py -a" > /var/log/smolt.update
+fi
diff --git a/abs/core/LinHES-system/tvterm.sh b/abs/core/LinHES-system/tvterm.sh
new file mode 100755
index 0000000..dfd116b
--- /dev/null
+++ b/abs/core/LinHES-system/tvterm.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Create a terminal with a font that mostly fills the width of the screen.
+
+width=$(echo $(xdpyinfo | grep dimensions:) | cut -d' ' -f2 | cut -dx -f1)
+
+if [ -z "$width" ] ; then
+ width=1024
+fi
+
+if [ $width -ge 1920 ] ; then
+ fontsize=24
+elif [ $width -ge 1440 ] ; then
+ fontsize=21
+elif [ $width -ge 1280 ] ; then
+ fontsize=18
+elif [ $width -ge 1024 ] ; then
+ fontsize=14
+elif [ $width -ge 800 ] ; then
+ fontsize=11
+elif [ $width -ge 640 ] ; then
+ fontsize=8
+fi
+
+xterm -fa 'DejaVu Sans Mono' -fs $fontsize
diff --git a/abs/core/LinHES-system/unclutter-toggle.sh b/abs/core/LinHES-system/unclutter-toggle.sh
index 0ead751..aadce50 100644
--- a/abs/core/LinHES-system/unclutter-toggle.sh
+++ b/abs/core/LinHES-system/unclutter-toggle.sh
@@ -1,8 +1,11 @@
#!/bin/bash
PIDUNC=`pidof unclutter`
+jitter=200
+idle=1
+. /etc/unclutter.cfg
if [ -n "${PIDUNC}" ];
then
killall -9 unclutter
else
- /usr/X11R6/bin/unclutter -root -idle 1 -jitter 200 -noevents &
+ /usr/X11R6/bin/unclutter -root -idle $idle -jitter $jitter -noevents &
fi