Noob-Friendly Customized install.sh for compiling from source

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 00:56, 15 July 2007 (edit)
RvrS2a (Talk | contribs)
m
← Previous diff
Revision as of 12:26, 16 July 2007 (edit) (undo)
Smaugy (Talk | contribs)
(Revert to latest non-spam version by Wildblue)
Next diff →
Line 1: Line 1:
-[http://wc1.worldcrossing.com/WebX/.1de60a04 free sonyericsson ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=115 phentermine online] [http://library.cshl.edu/wp/vb/member.php?u=1387 alltel ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a05 sprint ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=167 clonazepam online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30283 didrex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=157 ultram online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=230 verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30309 celexa online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=348 cheap norco] [http://wc1.worldcrossing.com/WebX/.1de60a11 diethylpropion online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=188 cheap tenuate] [http://news.engin.brown.edu/forums/thread-view.asp?tid=212 verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30308 lipitor online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=82 diazepam online] [http://library.cshl.edu/wp/vb/member.php?u=1380 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=163 adipex online] [http://students.hsc.unt.edu/housing/item.cfm?type=2859 meridia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=209 samsung ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=170 free cingular ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=78 clomid] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30298 lisinopril online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=74 carisoprodol online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=352 paxil online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=227 ericsson ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1386 free mono ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=69 cheap albuterol] [http://wc1.worldcrossing.com/WebX/.1de60a12 free ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=171 order ambien] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=188 levitra online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=83 didrex online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30358 midi ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2879 clomid online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=186 lipitor online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=215 sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=346 meridia online] [http://students.hsc.unt.edu/housing/item.cfm?type=2923 sony ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30237 cheap valium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=171 clomid online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=184 hoodia] [http://wc1.worldcrossing.com/WebX/.1de60a1b music ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30264 hydrocodone] [http://wc1.worldcrossing.com/WebX/.1de609db but adipex] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30321 cheap hgh] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=90 cheap hgh] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30263 order levitra] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=133 tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=226 free sony ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=117 propecia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=165 vicodin online] [http://library.cshl.edu/wp/vb/member.php?u=1340 cheap soma] [http://students.hsc.unt.edu/housing/item.cfm?type=2909 verizon ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30252 buy meridia] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=221 cheap vicodin] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30347 free verizon ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1354 cheap alprazolam] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30330 nokia ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2903 qwest ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a26 free sharp ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30348 polyphonic ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=345 cheap viagra] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=239 cheap sildenafil] [http://students.hsc.unt.edu/housing/item.cfm?type=2876 didrex online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=142 wellbutrin] [http://students.hsc.unt.edu/housing/item.cfm?type=2872 cyclobenzaprine] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30333 free funny ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a00 cheap rivotril] [http://library.cshl.edu/wp/vb/member.php?u=1356 order paxil] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30357 free sharp ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=123 free sagem ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30268 xenical online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=92 hydrocodone online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=100 cheap lortab] [http://students.hsc.unt.edu/housing/item.cfm?type=2850 cheap phentermine] [http://students.hsc.unt.edu/housing/item.cfm?type=2869 lorazepam online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=116 polyphonic ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1361 order xenical] [http://library.cshl.edu/wp/vb/member.php?u=1362 buy wellbutrin] [http://wc1.worldcrossing.com/WebX/.1de60a2b but ultracet] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=113 paxil online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30279 cheap ultracet] [http://news.engin.brown.edu/forums/thread-view.asp?tid=229 jazz ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2863 buy alprazolam] [http://wc1.worldcrossing.com/WebX/.1de609f4 mono ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1353 vicodin online] [http://students.hsc.unt.edu/housing/item.cfm?type=2880 cheap albuterol] [http://wc1.worldcrossing.com/WebX/.1de609eb free funny ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=181 free free ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2887 cheap pharmacy online] [http://library.cshl.edu/wp/vb/member.php?u=1364 nexium online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=222 cheap vigrx] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=166 ativan online] [http://library.cshl.edu/wp/vb/member.php?u=1381 polyphonic ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=180 flexeril online] [http://wc1.worldcrossing.com/WebX/.1de609fd punk ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=102 midi ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a2c ultram] [http://students.hsc.unt.edu/housing/item.cfm?type=2853 fioricet online] [http://students.hsc.unt.edu/housing/item.cfm?type=2899 free tracfone ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=185 hydrocodone online] [http://library.cshl.edu/wp/vb/member.php?u=1378 free sprint ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1350 meridia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=152 cheap valium] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=208 cheap phentermine] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=349 cheap vicodin] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=77 free cingular ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a0c buy wellbutrin] [http://students.hsc.unt.edu/housing/item.cfm?type=2860 adipex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=223 free midi ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=126 sildenafil online] [http://library.cshl.edu/wp/vb/member.php?u=1383 free sagem ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=197 cheap flexeril] [http://students.hsc.unt.edu/housing/item.cfm?type=2898 free free ringtones] [http://wc1.worldcrossing.com/WebX/.1de609ff free real ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30336 qwest ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=343 cialis online] [http://students.hsc.unt.edu/housing/item.cfm?type=2924 ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=183 albuterol] [http://library.cshl.edu/wp/vb/member.php?u=1342 cheap phentermine] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=220 real ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2883 lipitor online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=203 free funny ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=73 cheap ativan] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=218 free qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=202 tracfone ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=96 cheap levitra] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=105 free mp3 ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1375 free real ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30238 phentermine online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30355 free punk ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30349 cingular ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=199 free music ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2914 sony ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de609e7 cheap diazepam] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30315 buy lortab] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=143 wwe ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2906 samsung ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=174 cyclobenzaprine online] [http://wc1.worldcrossing.com/WebX/.1de60a03 sony ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2857 ativan online] [http://wc1.worldcrossing.com/WebX/.1de60a2d valium online] [http://students.hsc.unt.edu/housing/item.cfm?type=2856 cheap cialis] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30242 fioricet online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=160 order adipex] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=232 sony ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2900 free funny ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2870 cheap xenical] [http://news.engin.brown.edu/forums/thread-view.asp?tid=150 tramadol online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30332 tracfone ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30354 free alltel ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=202 nokia ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=134 tramadol online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=167 carisoprodol online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30269 cheap wellbutrin] [http://students.hsc.unt.edu/housing/item.cfm?type=2893 hgh online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=219 cheap viagra] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30240 carisoprodol online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30316 vigrx online] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30351 free sonyericsson ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30350 sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=332 order tramadol] [http://students.hsc.unt.edu/housing/item.cfm?type=2925 free mtv ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2915 mono ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30359 free wwe ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2849 cheap valium] [http://students.hsc.unt.edu/housing/item.cfm?type=2867 hydrocodone online] [http://wc1.worldcrossing.com/WebX/.1de60a16 levitra online] [http://library.cshl.edu/wp/vb/member.php?u=1379 free music ringtones] [http://students.hsc.unt.edu/housing/item.cfm?type=2919 free sharp ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30338 free motorola ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=174 wellbutrin online] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=84 diethylpropion online] [http://students.hsc.unt.edu/housing/item.cfm?type=2882 cheap zoloft] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=217 free punk ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=220 free punk ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=86 cheap fioricet] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=186 free jazz ringtones] [http://www.e.kth.se/cgi-bin/esekt/discussion?command=read&discussionid=4&id=30253 norco online] [http://students.hsc.unt.edu/housing/item.cfm?type=2920 midi ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=164 buy alprazolam] [http://students.hsc.unt.edu/housing/item.cfm?type=2884 cheap celexa] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=240 soma online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=347 adipex] [http://news.engin.brown.edu/forums/thread-view.asp?tid=180 prozac online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=353 online levitra] [http://wc1.worldcrossing.com/WebX/.1de60a33 prozac online] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=179 fioricet online] [http://students.hsc.unt.edu/housing/item.cfm?type=2926 free jazz ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1384 sonyericsson ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=213 cheap prozac] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=233 free sonyericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de609de cheap alprazolam] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=183 hgh online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=160 ativan online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=217 free mono ringtones] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=226 cheap tramadol] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=148 cheap zyban] [http://itcweb.ecsu.edu/portal/forums.asp?ForumId=13&TopicId=225 free wwe ringtones] [http://library.cshl.edu/wp/vb/member.php?u=1385 sony ericsson ringtones] [http://www.ees.ufl.edu/alumni/forums.asp?ForumId=5&TopicId=108 cheap nexium] I have heavily modified the original install.sh so that it is more useful and flexible. This script is not 100% complete but it is functional and will simplify the initial process of compiling from source. Because it is still in development, I would recommend that you first follow the steps here [[Compiling DD-WRT Sources]] to lay out the necessary directory structure and required files. You don't have to use install.sh, instead you can use this script to compile the distribution you want. Before copying my script please read and understand its purpose and limitations.+I have heavily modified the original install.sh so that it is more useful and flexible. This script is not 100% complete but it is functional and will simplify the initial process of compiling from source. Because it is still in development, I would recommend that you first follow the steps here [[Compiling DD-WRT Sources]] to lay out the necessary directory structure and required files. You don't have to use install.sh, instead you can use this script to compile the distribution you want. Before copying my script please read and understand its purpose and limitations.
<<WARNING>> This is still under development. Some features do not work as expected. <<WARNING>> <<WARNING>> This is still under development. Some features do not work as expected. <<WARNING>>

Revision as of 12:26, 16 July 2007

I have heavily modified the original install.sh so that it is more useful and flexible. This script is not 100% complete but it is functional and will simplify the initial process of compiling from source. Because it is still in development, I would recommend that you first follow the steps here Compiling DD-WRT Sources to lay out the necessary directory structure and required files. You don't have to use install.sh, instead you can use this script to compile the distribution you want. Before copying my script please read and understand its purpose and limitations.

<<WARNING>> This is still under development. Some features do not work as expected. <<WARNING>>

What this script will allow you to do:

- Compile a single distribution, eg. builddwrt mini
- Compile a combination of distributions, eg. builddwrt micro mini
- Create your build environment from scratch, eg. builddwrt -nd
- Download and update the source using subversion, eg. builddwrt -s

When you use the -d option, the script will automatically generate the correct filename based on the current date, then it will use wget to grab the file. If this attempt fails, the script will automatically try to download the previous day's snapshot. It will attempt to grab only the first snapshot it finds from the last 7 days. If it cannot find a snapshot by this method then you are asked to supply the date of the snapshot you want to grab.

You can name this script whatever you like and the help menu will reflect this so it appears personalized. It can also be placed most anywhere in your local path, but it's best placed directly in your home directory (~). Don't forget to issue chmod x to make this script executable.

You can combine some of the options, for example, builddwrt -ndp2 mini normal voip. This will create the directory structure for your build environment, download the latest snapshot, pause the output for 2 seconds between stages (in case you're watching), then build the image files for mini, normal and voip distributions. If you specify "all", this will expand to "micro mini normal voip openvpn".

What this script does NOT do:

This script only changes the interface for compiling your source, that is, you can consider this as install.sh on steroids. I did not make any attempts to change the actual scripts which perform the compilation, for example, install_mini.sh. Assuming we have the correct directory structure (as per the wiki), if install.sh does not properly compile your source then neither will my script.

Unless I have made a terrible mistake, if the original install.sh works for you then this script will do the same. You just have better control over the initial process.

The usual disclaimer applies here. I wrote this for my own edification and enjoyment and make no guarantees of any kind. I'm sharing this in case someone in this forum has the same interest and curiosity as myself, and may find some uses for it. I'm sure this script is rather trivial to the more experienced and technical individuals visiting this forum, but it works for me and I like it.

Copy the script below and save as builddwrt or something else you prefer.

#!/bin/sh

#####################################################
# Custom install.sh script for DD-WRT v23 SP1
# version 0.1b, Apr 20 2006 --jayC
#
# Based on the original install.sh script and ideas
# from http://forum.bsr-clan.de/ftopic7326.html
#
# License:  GPL2
#####################################################

####################################
## Declaration and Initialization ##
####################################

hr="-----------------------------------------------------------------"
debug=0
## Use hidden option "-G" to enable debug mode for this script.
## No actions will be committed while in debug mode.  This is only
## useful if you intend to modify this script and run some tests.

## Display usage information
usage() {
cat <<MENU
$hr

Compile DD-WRT v23 SP1 with your choice of distribution(s).

Syntax: `basename $0` -[ndfshC] [-p<seconds>] distribution

Distributions:  micro, mini, normal, openvpn, voip, all

Options:
-n			Prepare a new build environment
-d			Download latest source from snapshot
-f			Force overwrite of previous files
-s			Use subversion to grab latest source
-p <seconds>		Add pause to screen output
-h			Display this information
-C			Check build environment

Examples of Proper Use:
			`basename $0` mini
			`basename $0` -p 5 micro
			`basename $0` normal voip
			`basename $0` -df all
			`basename $0` -ndp3 openvpn

To troubleshoot your build you can log all output by doing one of
the following examples:

`basename $0` voip | tee build.log    #View and log output at same time
`basename $0` voip > build.log        #No output, just create log file

You can find your log file in the same directory as your script.
$hr
MENU
exit
}

## This is our debug message
debug_script() {
cat <<DEBUG
$hr
Debug Mode (-G) Enabled
No actions will be committed.

Number of arguments passed to `basename $0` 	= $arg
Parameters passed				= $params
Distribution(s) selected			= $@
Number of seconds to pause screen output	= $delay
$hr
DEBUG
}

## Initialize variables
arg=$#				## number of arguments
params="$@"			## parameter list
dist=""
opt="no"
new="no"
dl="no"
force="no"
svn="no"
delay=0
proceed="no"
build_all="micro mini normal openvpn voip"
env="no"
startdir=`pwd`
ddroot="/home/dd-wrt"
snaproot="$ddroot/snapshot"
buildroot="$snaproot/DD-WRT"
site="http://www.dd-wrt.com/dd-wrtv2/downloads/sourcecode"
chainfile="toolchains.x86.debian.sp1.tar.bz2"
toolchain_url="$site/$chainfile"
chainroot="$ddroot/toolchains"
tc3_full="3.4.6-uclibc-0.9.28"
tc3_short="3.4.6"
tc4_full="4.1.0-uclibc-0.9.28"
tc4_short="4.1.0"

## Looks like we need some help
need_help() {
  echo "Please use \"`basename $0 `-h\" to get help."
  exit
}

## Check for proper build environment
check_env() {
  if [ -d $buildroot ]; then
    env="yes"
  fi
}

## Check if any arguments passed
if [ $arg -eq 0 ]; then
  echo -e "\nNo arguments passed.  See below for usage."
  usage
fi

## Parse the options first, exit if unknown
## Using getopts is more efficient than shift alone
while getopts ndfsp:hG option
do
  case $option in
    n) new="yes"
      opt="yes" ;;
    d) dl="yes"
      opt="yes" ;;
    f) force="yes"
      opt="yes" ;;
    s) svn="yes"
      opt="yes" ;;
    p) delay=$OPTARG
      case $delay in
        0|1|2|3|4|5) opt="yes" ;;
        *) echo -e "\nSyntax error.  -p value must be between 0 - 5."
          need_help ;;
      esac ;;
    h) usage ;;
    G) debug=1
      opt="yes" ;;
    C) ;; ## Check default build environment
    \?) echo -e "\nSyntax error.  Unknown option in \"$params\"."
    	need_help ;;
  esac
done

## Process the distributions next by dropping the options
if [ "$opt" = "yes" ]; then
  shift `expr $OPTIND - 1`
fi

## Optional debugging output
if [ $debug -eq 1 ]; then
  debug_script
fi

## Now validate the distributions
## Update these two variables with our new values
params="$@"
arg="$#"

## Exit immediately if distribution is unknown
if [ $arg -eq 1 ]; then
  if [ "$params" = "all" ]; then
    dist="$build_all"
    proceed="yes"
  else
    case $params in
      micro|mini|normal|voip|openvpn)
        dist="$params"
        proceed="yes" ;;
      *) echo -e "\nSyntax error.  Unknown distribution \"$params\"."
        need_help ;;
    esac
  fi
else  ## multiple distributions
  for each in $params; do
    if [ "$each" = "all" ]; then
      echo -e "\nSyntax error in \"$params\".  Cannot use \"all\" this way."
      need_help
    else
      case $each in
        micro|mini|normal|voip|openvpn)
          dist=$dist" $each"
          proceed="yes" ;;
      *) echo -e "\nSyntax error.  Unknown distribution in \"$params\"."
        need_help ;;       
      esac
    fi
  done 
fi

## Construct url for previous snapshot
## I haven't fully tested this routine, so it may
## not handle transitioning between months.  In that
## case you will have to enter the date manually for
## the snapshot you want to download.
back_one_day() {
  days=`expr $days   1`
  monthday=`expr $(date  %d) - $days`
  snapday="$(date  %m)$monthday-$(date  %Y)"
  snapshot="$snapday-snapshot.tar.bz2"
  url=$site"/$snapshot" 
}

## Extract snapshot into current location
extract_snapshot() {
  echo -e "\nExtracting files..."
  tar -xjvf $snapshot
}

## Download latest snapshot based on current date,
## and work backwards until we find the most current
## file.  Check only within the last seven days.  You
## can change the number of attempts, if you want to.
download_snapshot() {
  attempts=6
  success="no"
  days=0
  snapday=$(date  %m%d-%Y)
  snapshot="$snapday-snapshot.tar.bz2"
  url="$site/$snapshot"
  cd $snaproot
  while [ "$success" = "no" ]