View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 109 posts ] 
Go to page 1, 2, 3, 4, 5 ... 8  Next

Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Tue Oct 03, 2006 4:18 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Hello everyone. I made a script that downloads MythTV from SVN, compiles it, and installs it.
I just thought I might share it with everyone and maybe get some feedback about it.
So without further a due, I present my script.
[url=HTTP://Watto.HomeIP.net/mythsvn.sh]MythTV from SVN[/url]
Usage:
mythsvn.sh [head|fixes] [pause]
Selecting head will compile from the SVN head, fixes will compile the fixes branch, and pause will pause before MythTV installation so you can finish up anything your doing before it gets shutdown.
This script has three simple stages:
First, it downloads all of the source code, compiles MythTV with nice so you can still use your Knoppmyth box during this stage (not something I recommend for most users), and performs a backup.
Second, it automatically shuts down MythTV and installs it with the themes.
Last, it starts up the new MythTV and compiles MythPlugins with nice so you can try out the new MythTV during this step and at the end it closes the Frontend, installs the Plugins, and reloads the Frontend.

I think you need about 500MB of free space on the partition that you run this on and you must be root.
If anyone has any enhancements or suggestions for my script please let me know. ;)
*Added misterflibble's suggestions
*Added Greg Frost's enhancements
*Added tjc's suggestion
*Added more suggestions from tjc and mrshark
*10-9-06 Added more enhancements from tjc and comments.
*10-15-06 Added "pause" option that pauses before mythtv installation /w help from tjc.
*11-16-06 Fixed Athlon64 compile problem thanks to tjc.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Last edited by WattoToydarian on Thu Nov 16, 2006 7:04 pm, edited 13 times in total.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 03, 2006 8:03 pm 
Offline
Joined: Mon Aug 01, 2005 10:18 am
Posts: 84
Very nice set of scripts 8)

Just a few suggestions:
1)mythsvnfixes.sh should probably be called myth-0.20fixes.sh or something similar because it's actually the release 0.20 (and any backported fixes) not to be confused with the current svn.
2)I think line 31 (sleep 5; irexec...) is unnecessary. Don't most people start irexec when their window manager starts?
3)Why disable mythflix, mythnews, mythbrowser, and mythphone? I think these should all compile with what's provided in Knoppmyth, and are listed in the menus. Also, since you don't move the old myth directories out of the way, they would still have the old versions of these plugins installed, which would then fail. Also a lot of the config options for mythplugins are unnecessary. Most of them are turned on by default, check ./configure --help, any that say [yes] will.
4)Does line 38 (copying mythweb) result in the proper permissions for the directories, so it can run under apache? Also, apache should be restarted after this.
5)I'd suggest doing a dump of mythconverg, since the upgrade will change the schema and every user should have this done since things can get hosed and there's not really any going back on the database.
6)Running the make while gdm and everything's running is perfectly fine. But the make installs should occur after stopping mythbackend and gdm because overwriting the files often results in crashes in a running system and database errors.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 2:22 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Ok, I made the changes for numbers 1, 3, and 5.
#2 I have because I use my remote to restart gdm whenever theres a crash so it needs root privileges.
#4 It works for me, if anyone has a problem with it and a solution let me know.
#6 If you look closely, you'll see that it actually stops everything just before it installs and doesn't the plugIns only effect the frontend?

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 3:30 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
I wouldn't have 2 scripts that do essentially the same thing. It would be better to pass an argument to tell it whether you wanted to compile svn head or fixes. Then you only need to maintain one script.

Also, you may wish to check the status of the builds and exit if they fail. There is no gaurentee that the changeset that you happen to get actually compiles, and you probably don't want to continue if it doesn't.

Nice work. The Knoppmyth community could really do with this.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 3:32 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
That would be nice to have in the script but I dont know how to do that.
Could you post some lines that would do that?

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 3:43 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
WattoToydarian wrote:
That would be nice to have in the script but I dont know how to do that.
Could you post some lines that would do that?


Arguments done something like this:

Code:
if [ "$1" = fixes ] ; then
  TARGET=branches/release-0-20-fixes
elif [ "$1" = fixes ] ; then
  TARGET=trunk
elif [ -z "$1" ] ; then
  echo "\
Usage:
  mythsvn.sh [head|fixes]
Selecting head will compile from the SVN head, fixes will compile the fixes branch."
  exit
fi

svn co http://svn.mythtv.org/svn/$TARGET/mythtv
etc...



to abort if the build fails, something like this would probably work:
Code:
if ! nice -n17 make ; then
  echo "The build failed!"
  exit
fi


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 3:54 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Great! I added those lines to the mythsvn.sh script. Can you check it to see if I put them in the right place?
Thanks a BUNCH! :D

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 4:34 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
oops/ it is checking for "fixes" in both ifs. one should check for "head".


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 5:00 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Greg Frost wrote:
oops/ it is checking for "fixes" in both ifs. one should check for "head".
ok I changed:
Code:
elif [ "$1" = fixes ] ; then
  TARGET=trunk

to
Code:
elif [ "$1" = head ] ; then
  TARGET=trunk

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 6:44 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
For misterflibble's #5 above why not just run the mythbackup script. It's well behaved and intended to be callable from other scripts. Not only that, but then you can use mythrestore to revert the DB if needed.

With a bit of cleverness with the backup.list and restore.list, you can have it backup the currently installed version of MythTV as well. Being able to test updates to MythTV (debs, locally compiled, ...) and restore the previous version easily was actually one of the things that inspired adding the supplemental lists after all...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 04, 2006 9:54 pm 
Offline
Joined: Thu Jun 16, 2005 2:37 pm
Posts: 116
Location: St. Louis MO.
Thanks for the input tjc, I made the change do it runs mythbackup just before the install.
Though, I don't know anything about the backup.list and restore.list.

_________________
Backend: HP NetServer LT 6000r U3; 6 700Mhz Xeon CPUs; 3GB PC133 ECC; LSI Ultra160 SCSI 4 18GB 10kRPM striped system; 7200RPM 160GB recordings; Ubuntu-server 7.04; HDHomeRun box.
Frontend: A64 3000+; 512MB DDR; Hauppauge grey; knoppmyth PXE/NFS.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 6:03 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Easily remedied. See this posting - http://mysettopbox.tv/phpBB2/viewtopic.php?t=10117 Basically all you need to do is creatre a text file that lists the directories or files you want it to include. Say for example "./usr/share/mythtv" ;)

A few other code reveiew comments:

- Missing #! magic at the beginning. Make the first line of the file say either:
Code:
#!/bin/bash

or:
Code:
#!/bin/sh


- I'm guessing the lines that just say "y" don't do what you intended. ;-) and instead produces a message like this:
Code:
-bash: y: command not found

To get rid of the interactive prompting by cp/mv/rm either unalias them at the start of the script or go directly to the real binaries using "/bin/cp", "/bin/mv", and "/bin/rm".

- I think you can dispense with the use of nice. If you're trying to recompile the backend and frontend with other acticvity on the system you're going to disrupt it pretty seriously no matter what. At the very least when you do the backup and the installs. ;-)

- I would add some more success/failure checks along the way. For example use "&&" between the "make" and the "make install", or create a fatal_error function and use it to bomb out anything goes all pear shaped. For example:
Code:
fatal_error () {
    echo 1>&2 "Fatal error - $*, exiting."
    exit 1
}

Then later:
Code:
make || fatal_error "failed to make mytthemes"
make install || fatal_error "failed to install mytthemes"

This is a very useful idiom for a script that should stop as soon as something goes wrong to avoid compounding any damage.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 7:02 pm 
Offline
Joined: Mon May 10, 2004 8:08 pm
Posts: 1891
Location: Adelaide, Australia
tjc wrote:
- I think you can dispense with the use of nice. If you're trying to recompile the backend and frontend with other acticvity on the system you're going to disrupt it pretty seriously no matter what. At the very least when you do the backup and the installs. ;-)
I disagree with this. It may take hours to complete the compile stage (depending on hardware) during which time, the nice will help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 11:02 pm 
Offline
Joined: Wed Aug 09, 2006 2:47 am
Posts: 21
tjc wrote:
To get rid of the interactive prompting by cp/mv/rm either unalias them at the start of the script or go directly to the real binaries using "/bin/cp", "/bin/mv", and "/bin/rm".

use absolute paths to binaries in scripts is always needed: you don't know if they're in the path, or if their path is equal to yours...

aliases could be temporarily overridden prepending them with a backslash: \cp is like an unaliased cp...

interactive mode for cp/rm/mv could be turned off with che -f switch (force), as opposed to -i (interactive).

my 2c... :wink:

_________________
Mobo: Asus M2NPV-VM (Nvidia 430/6150 + HDTVout), bios 0405
CPU: Sempron 3GHz - 512MB Ram
TV: Asus MyCinema P7131H Hybrid + Ati Remote Wonder USB
KnoppMyth R5D1 upg. to MythTV 0.20


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 7:46 am 
Offline
Joined: Tue Aug 01, 2006 1:23 pm
Posts: 40
Location: E-Town, PA - USA
:D Hey, thanks for the script. It makes it easy. I am hoping that it makes my mythcenter run a bit smoother. Maybe even XvMC will work again. But anyways, the script works great. Nice job. And thanks to all who helped make it easy.

:D

_________________
Knoppmyth R5D1 - Mythtv .20svn-fixes
HD Frontend/Master Backend
AMD64 3200+-1GB Corsair-800GB LVM PATA/SATA
Biostar GeForce 6100 Motherboard M109
1x Air2Pc rev.2 1x PVR150MCE
Maddog DVD/RW-DL Drive


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 109 posts ] 
Go to page 1, 2, 3, 4, 5 ... 8  Next



All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu