List of reports associated

Test name:
Version: 5.4.1



Goto: PHPInfo     Build environment

PHPInfo

phpinfo()
PHP Version => 5.4.1

System => Linux tw0001 3.2.6 #1 SMP Tue Apr 24 12:56:11 MDT 2012 i686
Build Date => Apr 28 2012 19:10:05
Configure Command =>  './configure'  '--prefix=/usr' '--with-config-file-path=/usr' '--with-config-file-scan-dir=/etc' '--with-openssl' '--with-zlib' '--with-gdbm'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr
Loaded Configuration File => (none)
Scan this dir for additional .ini files => /etc
Additional .ini files parsed => (none)
PHP API => 20100412
PHP Extension => 20100525
Zend Extension => 220100525
Zend Extension Build => API220100525,NTS
PHP Extension Build => API20100525,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies


 _______________________________________________________________________


Configuration

Core

PHP Version => 5.4.1

Directive => Local Value => Master Value
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => STDERR => STDERR
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
enable_post_data_reading => On => On
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => no value => no value
exit_on_timeout => Off => Off
expose_php => On => On
extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20100525 => /usr/lib/php/extensions/no-debug-non-zts-20100525
file_uploads => On => On
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style="color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style="color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style="color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .:/usr/lib/php => .:/usr/lib/php
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
mail.add_x_header => Off => Off
mail.force_extra_parameters => no value => no value
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 20 => 20
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
max_input_vars => 1000 => 1000
memory_limit => 128M => 128M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 16K => 16K
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
request_order => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i  => /usr/sbin/sendmail -t -i 
serialize_precision => 17 => 17
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
zend.detect_unicode => On => On
zend.enable_gc => On => On
zend.multibyte => Off => Off
zend.script_encoding => no value => no value

ctype

ctype functions => enabled

date

date/time support => enabled
"Olson" Timezone Database Version => 2012.2
Timezone Database => internal
Default timezone => UTC

Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => no value => no value

dba

DBA support => enabled
Supported handlers => gdbm cdb cdb_make inifile flatfile 

Directive => Local Value => Master Value
dba.default_handler => flatfile => flatfile

dom

DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.7.8
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled

ereg

Regex Library => Bundled library enabled

fileinfo

fileinfo support => enabled
version => 1.0.5

filter

Input Validation and Filtering => enabled
Revision => $Id: e523cdc8829892d1b4f9cb7c3c57b2ba1c36b9ea $

Directive => Local Value => Master Value
filter.default => unsafe_raw => unsafe_raw
filter.default_flags => no value => no value

hash

hash support => enabled
Hashing Engines => md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b fnv132 fnv164 joaat haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5 

iconv

iconv support => enabled
iconv implementation => glibc
iconv library version => 2.14.1

Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1

json

json support => enabled
json version => 1.2.1

libxml

libXML support => active
libXML Compiled Version => 2.7.8
libXML Loaded Version => 20708
libXML streams => enabled

openssl

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1a 19 Apr 2012
OpenSSL Header Version => OpenSSL 1.0.1a 19 Apr 2012

pcre

PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 8.12 2011-01-15

Directive => Local Value => Master Value
pcre.backtrack_limit => 1000000 => 1000000
pcre.recursion_limit => 100000 => 100000

PDO

PDO support => enabled
PDO drivers => sqlite

pdo_sqlite

PDO Driver for SQLite 3.x => enabled
SQLite Library => 3.7.7.1

Phar

Phar: PHP Archive support => enabled
Phar EXT version => 2.0.1
Phar API version => 1.1.1
SVN revision => $Id: 2a47d3d0354109d8077e34d59f1228ccfd021d59 $
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
gzip compression => enabled
bzip2 compression => disabled (install pecl/bz2)
Native OpenSSL support => enabled


Phar based on pear/PHP_Archive, original concept by Davey Shafik.
Phar fully realized by Gregory Beaver and Marcus Boerger.
Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.
Directive => Local Value => Master Value
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On

posix

Revision => $Id: 967584c6fadb3467f31abe8e13caa8764df85867 $

Reflection

Reflection => enabled
Version => $Id: 1cf65cee164ed57874ce2d29e5c46b82f6139524 $

session

Session Support => enabled
Registered save handlers => files user 
Registered serializer handlers => php php_binary 

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => /dev/urandom => /dev/urandom
session.entropy_length => 32 => 32
session.gc_divisor => 100 => 100
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 4 => 4
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_trans_sid => 0 => 0

SimpleXML

Simplexml support => enabled
Revision => $Id: 455280fc74f9f002b7314def7a456f6c3080eb92 $
Schema support => enabled

SPL

SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

sqlite3

SQLite3 support => enabled
SQLite3 module version => 0.7
SQLite Library => 3.7.7.1

Directive => Local Value => Master Value
sqlite3.extension_dir => no value => no value

standard

Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i 

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
from => no value => no value
url_rewriter.tags => a=href,area=href,frame=src,form=,fieldset= => a=href,area=href,frame=src,form=,fieldset=
user_agent => no value => no value

tokenizer

Tokenizer Support => enabled

xml

XML Support => active
XML Namespace Support => active
libxml2 Version => 2.7.8

xmlreader

XMLReader => enabled

xmlwriter

XMLWriter => enabled

zlib

ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.6
Linked Version => 1.2.6

Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Additional Modules

Module Name

Environment

Variable => Value
grep => /bin/grep
kill => /bin/kill
printf => /usr/bin/printf
HZ => 100
out_chroot_install_dir => /usr/src
basename => /usr/bin/basename
sources_dir => /home/yp58t/Sources
XORG_CONFIG => --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var
TEST_PHP_SRCDIR => /usr/src/php-5.4.1
no_patch_dialog => 1
SHELL => /bin/bash
chroot_flag => 1
batch_sec => 21
tail => /usr/bin/tail
TERM => screen.linux
MAKEFLAGS =>  
chown => /bin/chown
HISTSIZE => 1000
SSH_CLIENT => deleted
please_wait_pid => 31351
install_dir => /usr/src
patch => /usr/bin/patch
HUSHLOGIN => FALSE
no_script_dialog => 1
fail_on_shasum => 1
SSH_TTY => deleted
etc_dir => /etc/takenset
return_val => 0
prog_src_dir => /home/yp58t/Sources/prog
release_dir => /usr/src
total_sec => 522
reqd_dir =>  
prog_dir => /etc/takenset/blfs/data/php-5.4.1
got_level => 0
USER => yp58t
batch_file => /tmp/lfs_script.eKp3FNW7
xz => /usr/bin/xz
LS_COLORS => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
shasum => /usr/bin/shasum
global_time_file => /tmp/lfs_script.gRls6AQe
batch_hour => 0
SSH_AUTH_SOCK => deleted
head => /bin/head
TERMCAP => SC|screen.linux|VT 100/ANSI X3.64 virtual terminal:\
	:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
	:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
	:do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
	:le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
	:li#64:co#160:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
	:cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
	:im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
	:ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
	:ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
	:se=\E[23m:mb=\E[5m:md=\E[1m:mh=\E[2m:mr=\E[7m:\
	:me=\E[m:ms:\
	:Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
	:vb=\Eg:as=\E(0:ae=\E(B:\
	:ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
	:k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
	:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
	:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
	:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:kb=:\
	:K2=\E[G:kB=\E[Z:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:\
	:kN=\E[6~:kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:\
	:kr=\EOC:kl=\EOD:
run_dir => /etc/takenset/blfs/data/php-5.4.1/1
run => 1
prompt_value =>  
MAKELEVEL => 1
height => 35
selection =>  
MFLAGS =>  
rm => /bin/rm
chmod => /bin/chmod
echo => /bin/echo
dirname => /usr/bin/dirname
batch_dir => /etc/takenset/blfs/batch
connect_pid => 16438
cat => /bin/cat
touch => /usr/bin/touch
PATH => /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/X11R6/bin
lib_dir => /usr/lib/takenset
MAIL => /var/mail/yp58t
tarball_is_local => 0
wget => /usr/bin/wget
STY => 23215.tty1.lfs
_ => /usr/src/php-5.4.1/sapi/cli/php
mount => /bin/mount
check_signature => 1
sed => /bin/sed
main_title => Ta-Kenset - Profile: /etc/takenset/blfs+++++++++++++++++++++++++++++++++++++++++++++++++++++Releasing php-5.4.1.tar.bz2 (Started on April 28, 2012 @ 19:07:37)
sleep => /bin/sleep
PWD => /usr/src/php-5.4.1
lfs_user => yp58t
mv => /bin/mv
INPUTRC => /etc/inputrc
LIBXCB_ALLOW_SLOPPY_LOCK => 1
install_log => /etc/takenset/log/log_install
ps => /bin/ps
scripts_dir => /etc/takenset/blfs/scripts
width => 150
LANG => en_US
TEST_PHP_EXECUTABLE => /usr/src/php-5.4.1/sapi/cli/php
XORG_PREFIX => /usr
global_remove_ext_tb => 1
mktemp => /usr/bin/mktemp
sec => 21
profile => /etc/takenset/blfs
global_temp_file5 => /tmp/lfs_script.qH0DiJm4
ping => /bin/ping
in_chroot_install_dir => /usr/src
mkdir => /bin/mkdir
cp => /bin/cp
global_temp_file4 => /tmp/lfs_script.rXVIqxve
return_string =>  
file_name_path => /home/yp58t/Sources/prog/php-5.4.1.tar.bz2
HISTIGNORE => &:[bf]g:exit
vi => /usr/bin/vi
global_temp_file6 => /tmp/lfs_script.GJ53mnIW
global_temp_file1 => /tmp/lfs_script.eseAAyNr
shasum_file => /etc/takenset/SHASUM
data_dir => /etc/takenset/blfs/data
HOME => /home/yp58t
SHLVL => 6
batch_flag => 1
chroot_dir => /mnt/lfs
batch_min => 4
tr => /usr/bin/tr
global_temp_file3 => /tmp/lfs_script.9YDLo2Mg
global_temp_file2 => /tmp/lfs_script.EPaFl0SK
cut => /usr/bin/cut
no_dialog => 0
dialog => /usr/bin/dialog
start_time => Started on April 28, 2012 @ 19:07:37
global_list =>  
success => 1
sha_alg => 1
hour => 0
LOGNAME => yp58t
G_FILENAME_ENCODING => @locale
screen_fail => 0
min => 4
WINDOW => 2
tarball_base_name => php-5.4.1
SSH_CONNECTION => deleted
tar => /bin/tar
unzip => /usr/bin/unzip
PKG_CONFIG_PATH => :/usr/X11R6/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
global_no_dialog => 0
find => /bin/find
run_all_as_root => 1
CC => cc
gunzip => /bin/gunzip
return_val_file => /tmp/lfs_script.1PFeK9xp
init_user => yp58t
su => /bin/su
patch_src_dir => /home/yp58t/Sources/patch
gen_title => Ta-Kenset - Profile: /etc/takenset/blfs
md5sum => /usr/bin/md5sum
prog_list => php-5.4.1
clear => /usr/bin/clear
times_file => /etc/takenset/blfs/prog_times
single_program_listing => () {  program_selection "Select a program to install" "single" "Select" $@ || return 1
}
check_structure => () {  if [ $# -ne 1 ]; then
 message "Usage: check_structure <path to program directory>" "check_structure";
 fi;
 local parent_dir=`${dirname} ${1}`;
 local bn=`${basename} ${1}`;
 local directory;
 local file;
 for directory in ${1} ${1}/log;
 do
 if ! check_for_directory ${directory}; then
 message "Missing directory: ${directory}" "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 if ! check_for_file ${1}/${file}; then
 message "Missing file: ${file}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for j in mstr_conf df purl;
 do
 if [ ! -f "${parent_dir}/${j}" ]; then
 message "Missing file: ${j}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 return 0
}
check_connection => () {  if `${cat} /tmp/con_status* | ${grep} -q "u" -`; then
 return 0;
 else
 message "Your internet connection is down.  Aborting the installation" "Internet Connection Down";
 return 1;
 fi
}
save_log => () {  if [ $# -ne 2 ]; then
 message "Usage: save_log <prefix> <file to save>" "save_log";
 return 1;
 fi;
 if [ -z "${run_dir}" ] || [ ! -d "${run_dir}" ]; then
 message "Run directory for ${tarball_base_name} empty.  Logs for ${1} will not be saved." "Log Save Error";
 return;
 fi;
 if ! make_dir "${run_dir}/log"; then
 message "There was an error creating the log directory for ${tarball_base_name}!" "Log Directory Creation Error";
 return;
 fi;
 if ! make_file ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 ${echo} "Linux From Scratch, version ${profile}, log created on `date`." > ${run_dir}/log/${1};
 ${echo} "Created by user `whoami` (session initiated by ${init_user})" >> ${run_dir}/log/${1};
 ${echo} "" >> ${run_dir}/log/${1};
 if ! ${cat} ${2} >> ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 return
}
directory_writable => () {  if [ $# -ne 1 ]; then
 message "Usage: directory_writable <directory>" "directory_writable";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 if ${touch} ${1}/test 2> /dev/null; then
 remove_file ${1}/test;
 return 0;
 else
 message "Your permissions do not allow you to write to directory '${1}'." "Directory Not Writable";
 return 1;
 fi
}
remove_run_level => () {  if [ $# -ne 2 ]; then
 message "Usage: remove_run_level <tarball base name> <run level>" "remove_run_level";
 return 1;
 fi;
 local count=0;
 local list1="";
 local list2="";
 local scs=0;
 local dir1="" && export dir1;
 [ ! -d "${data_dir}/${1}" ] && return 0;
 list1="`ls ${data_dir}/${1}`";
 for i in ${list1};
 do
 [ "${i}" == "count" ] && continue;
 if are_digits ${i}; then
 count=$(( ++count ));
 fi;
 done;
 if [ ${count} -eq 0 ]; then
 message "There are no run-levels to display." "No Run-Levels";
 return 0;
 fi;
 while :; do
 if [ ${count} -eq 1 ]; then
 dir1="${data_dir}/${1}";
 if yesno_inquiry "Removal Of Data Directory: ${1}" "There is, at max, one run level for ${1}.  Delete the entire data directory?"; then
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${1}.\n\n";
 ${su} -c '(
              if ! remove_dir ${dir1}; then
                message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
                exit 5
              fi

              exit 0
            )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No data directory will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 else
 dir1="${data_dir}/${1}/${2}";
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${dir1}.\n\n";
 ${su} -c '(
            if ! remove_dir ${dir1}; then
              message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
              exit 5
            fi

            exit 0
          )';
 return_val=$?;
 if [ ${error_in_chroot} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No run level will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 break 1;
 done;
 unset dir1;
 return 0
}
remove_dups => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 var1_rd="";
 var2_rd="";
 global_list="";
 for i in $@;
 do
 var2_rd=0;
 var1_rd="`${echo} ${i} | cut -d: -f1`";
 for j in ${global_list};
 do
 if [ "${var1_rd}" == "`${echo} ${j} | cut -d: -f1`" ]; then
 var2_rd=1;
 break 1;
 fi;
 done;
 [ ${var2_rd} -eq 0 ] && global_list="${global_list} ${i}";
 done;
 [ -z "${global_list}" ] && return 1;
 return 0
}
create_structure => () {  if [ $# -lt 1 ]; then
 message "Usage: create_structure <path to tarball> [run level]" "create_structure";
 fi;
 run=1;
 [ ! -z "${2}" ] && run=${2};
 [ -z "${tarball_name}" ] && tarball_name=`${basename} ${1}`;
 [ -z "${tarball_base_name}" ] && return 1;
 local sub_pid1;
 height=15;
 width=90;
 calculate_dimensions;
 ${echo} "Creating file structure for ${tarball_base_name}..." > ${global_temp_file1};
 make_title "Create Program Structure";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 success=1;
 while :; do
 for dir in "${tarball_base_name}" "${tarball_base_name}/${run}" "${tarball_base_name}/${run}/log";
 do
 if ! check_for_directory "${data_dir}/${dir}"; then
 if ! make_dir "${data_dir}/${dir}"; then
 break 2;
 fi;
 fi;
 done;
 ${touch} "${data_dir}/${tarball_base_name}/mstr_conf" || break 1;
 move ${1} ${prog_src_dir} || break 1;
 for file in "df" "tb_name" "purl" "checksum";
 do
 make_file "${data_dir}/${tarball_base_name}/${file}" || break 2;
 [ "${file}" == "tb_name" ] && ${echo} "${tarball_name}" > ${data_dir}/${tarball_base_name}/${file};
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 make_file "${data_dir}/${tarball_base_name}/${run}/${file}" || break 2;
 done;
 success=0;
 ${echo} "Successfully created structure for ${tarball_base_name}." >> ${global_temp_file1};
 break 1;
 done;
 if [ ${success} -eq 1 ]; then
 ${echo} "There was an error creating the structure for ${tarball_base_name}." >> ${global_temp_file1};
 fi;
 sleep 2;
 while file_empty ${global_temp_file2}; do
 sleep 1;
 done;
 sub_pid1=`${cat} ${global_temp_file2}`;
 kill_proc ${sub_pid1} || return 1;
 return ${success}
}
verify_tarball_url => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_tarball_url <url1>" "verify_tarball_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\|https\)://.*\(bz2\|zip\|gz\|tgz\|zip\|xz\)$"; then
 return 0;
 else
 message "The supplied URL is invalid." "Invalid Program URL";
 return 1;
 fi
}
compress_log => () {  [ ! -f "${1}" ] && return;
 local file="`${basename} ${1}`";
 local dir="`${dirname} ${1}`";
 cd ${dir};
 [ -f "${file}.tar.bz2" ] && remove_file "${file}.tar.bz2" &>/dev/null;
 ${tar} -cjf "${file}.tar.bz2" --remove-files ${file} &>/dev/null;
 return $?
}
sec_to_time => () {  if [ $# -ne 1 ]; then
 message "Usage: sec_to_time <seconds>" "sec_to_time";
 return 1;
 fi;
 local var1="";
 local t_sec=0;
 total_sec=${1};
 batch_hour=0;
 batch_min=0;
 batch_sec=0;
 total_min=$(${echo} "scale=5; ${total_sec}/60" | bc);
 batch_min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${batch_min}" ] && batch_min=0;
 t1="`${echo} ${batch_min}*60 | bc`";
 batch_sec="$(${echo} ${total_sec}-${t1} | bc)";
 if [ ${batch_min} -ge 60 ]; then
 batch_hour=`${echo} "scale=5; ${batch_min}/60" | bc`;
 batch_hour=`${echo} ${batch_hour} | cut -d"." -f1`;
 t1=`${echo} "${batch_hour}*60" | bc`;
 batch_min=`${echo} "${batch_min}-${t1}" | bc`;
 fi;
 return 0
}
chg_dir => () {  if cd ${1}; then
 return 0;
 else
 message "Unable to change to directory ${1}" "Change Directory";
 return 1;
 fi
}
check_sig_patch => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_patch <file list>" "check_sig_patch";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 tb_name="`${echo} ${line} | ${cut} -d: -f1`";
 run="`${echo} ${line} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${tb_name}/${run}/patch_list && continue;
 if [ ${flag} -eq 0 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Patch" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 flag=$(( ++flag ));
 fi;
 for base_name in `${cat} ${data_dir}/${tb_name}/${run}/patch_list`;
 do
 `${echo} ${base_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 if ! find_file ${base_name} ${patch_src_dir}; then
 ${echo} "Unable to find patch, ${base_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 2;
 fi;
 ${echo} "Checking signature for patch ${base_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${grep} -m1 ${base_name} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 3;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 ${echo} "MD5: signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 break 1;
 done;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
release_tarball => () {  if [ $# -lt 3 ]; then
 message "Usage: release_tarball <path to tarball source> <install dir> <removal flag> [append commands]" "release_tarball";
 return 1;
 fi;
 local sub_pid1;
 local command;
 local scs=1;
 local location="${2}/${tarball_base_name}";
 export location;
 return_val=0;
 if [ -d "${location}" ]; then
 remove_dir ${location};
 if [ $? -ne 0 ]; then
 if yesno_inquiry "Base-Directory Deletion" "Would you like to escalate your privileges and remove the base-directory '${tarball_base_name}'?"; then
 while true; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed with directory removal ***\n";
 ${su} -c '(
            remove_dir ${location} || exit 5

            exit 0
          )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 message "Removal of the directory, ${tarball_base_name}, was unsuccessful.  Aborting install." "Directory Removal Error";
 return 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 ontinue;
 else
 message "Privilege escalation was necessary to delete directory ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 else
 scs=0;
 fi;
 fi;
 break 1;
 done;
 else
 message "You elected not to delete the base-directory for ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 fi;
 fi;
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.bz2$"`; then
 command="${tar} --directory=${2} -xvjf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.gz$" -e "^.*\.tgz$"`; then
 command="${tar} --directory=${2} -xvzf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.lzma$"`; then
 command="${tar} --directory=${2} --lzma -xvf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.xz$"`; then
 xz_file="`${basename} ${1}`";
 tar_file="`${echo} ${xz_file} | ${sed} -e 's;\.xz;;g'`";
 command="copy ${1} ${2} && cd ${2} && ${xz} -d ${xz_file} && tar -xvf ${tar_file} && remove_file ${tar_file}";
 unset xz_file tar_file;
 else
 if `${echo} ${1} | ${grep} -q "^.*\.zip$"`; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 command="${unzip} -d ${2} ${1}";
 else
 command="${unzip} -d ${2}/${tarball_base_name} ${1}";
 fi;
 else
 message "Unable determine how to uncompress package, ${1}" "Uncompress Failure";
 return 1;
 fi;
 fi;
 fi;
 fi;
 fi;
 height=35;
 width=150;
 calculate_dimensions;
 eval ${command} > ${global_temp_file1} 2>&1 & sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Releasing ${tarball_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Releasing ${tarball_name} ($start_time)";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Unpacking ${tarball_base_name} into \Z1${2}\Zn... - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 kill_proc `${cat} ${global_temp_file2}`;
 ${sleep} 1;
 if [ ${return_val} -ne 0 ]; then
 message "Error uncompressing ${tarball_base_name}" "Uncompress Failure";
 return 1;
 fi;
 return 0
}
check_remote_file_exists => () {  if [ $# -ne 1 ]; then
 message "check_remote_file_exists <url>" "check_remote_file_exists";
 return 1;
 fi;
 local pid1;
 check_connection || return 1;
 ${wget} -v --tries 2 --timeout=40 --spider ${1} &>${global_temp_file3} & pid1=$!;
 wait ${pid1};
 return_val=$?;
 [ ${return_val} -ne 0 ] && return 1;
 ${grep} -iq -e "No such file" -e "unable to resolve" -e "HTTP_NOT_FOUND" -e "Invalid PORT" -e "Remote file does not exist" -e "not retrieving" ${global_temp_file3};
 return_val=$?;
 [ ${return_val} -eq 0 ] && return 1;
 return 0
}
chg_file_owner => () {  if [ $# -ne 2 ]; then
 message "Usage: chg_file_owner <new owner> <file>" "chg_file_owner";
 return 1;
 fi;
 if ! ${chown} "${1}:${1}" "${2}"; then
 message "There was an error changing ownership of file ${2} to ${1}." "Message";
 fi
}
display_batch_list => () {  if [ $# -eq 0 ]; then
 make_title "Batch List Display";
 ${dialog} --backtitle "${main_title}" --colors --infobox "\Z1Batch list is empty.\Zn" 8 60 1>&0;
 sleep 2;
 return 0;
 fi;
 local command;
 local file2_dbl;
 local description_dbl;
 local count=0;
 height=20;
 width=130;
 calculate_dimensions;
 make_title "Batch List Display";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"Remove\" --cancel-label \"Prev\"     --extra-button --extra-label \"Clear\" --menu \"Current batch list\" ${height} ${width} ${height} ";
 for i in $@;
 do
 count=$(( ++count ));
 if `${echo} ${i} | ${grep} -iq "script:"`; then
 file2_dbl="`${echo} ${i} | cut -d: -f2 | ${sed} -e 's;^\s+;;g'`";
 description_dbl="`${cat} ${file2_dbl} | ${grep} -i "^#Desc:.*" | ${sed} -e 's;^#Desc:;;g'`";
 [ -z "${description_dbl}" ] && description_dbl="No description";
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  `${basename} ${i}`\" \"SCRIPT: ${description_dbl}\" ";
 else
 file2_dbl="${data_dir}/${i}/df";
 if ! file_empty ${file2_dbl}; then
 description_dbl=`${cat} ${file2_dbl}`;
 else
 description_dbl="No description";
 fi;
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  ${i}\" \"${description_dbl}\" ";
 fi;
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return $?
}
main_window => () {  height=35;
 width=100;
 calculate_dimensions;
 make_title "Main Selection Window";
 command="${dialog} --backtitle \"${main_title}\" --cancel-label \"Exit\" ";
 command="${command} --menu \"What would you like to do?\n\" ${height} ${width} 50 \"Install\" \"Configure & Install A Program\" ";
 command="${command} \"Check Config\" \"Review Program Configuration\" ";
 command="${command} \"Get Program\" \"Download New Program & Create Directory Structure\" ";
 command="${command} \"Create Batch\" \"Create A Batch File\" ";
 command="${command} \"Edit Batch\" \"Edit A Batch File\" ";
 command="${command} \"Run Batch\" \"Load An Existing Batch File\" ";
 command="${command} \"Edit MD5/SHA Checksum\" \"Edit File Signatures\" ";
 if [ -f "${profile}/requisites" ]; then
 command="${command} \"Version Check\" \"Host System Program Requirement Versions\" ";
 fi;
 command="${command} \"Variables\" \"View & Set Variables\" ";
 command="${command} \"Scripts\" \"Run & Edit Scripts\" ";
 command="${command} \"Shell\" \"Run shell\"";
 command="${command} \"About\" \"\"";
 eval ${command} 2> ${global_temp_file5};
 return $?
}
script_options => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options <file>" "script_options";
 return 1;
 fi;
 local command;
 selection="";
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Options";
 get_time "`${basename} ${1}`" "-";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '${1}' Options (Run Time: ${hour}h ${min}m ${sec}s)\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Execute\" \"\" off";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"Move File\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
copy => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 if [ -d "${1}" ]; then
 ${cp} -r "${1}" "${2}";
 else
 if [ -f "${1}" ]; then
 ${cp} "${1}" "${2}";
 fi;
 fi;
 if [ $? -eq 1 ]; then
 message "Unable to copy ${1} to ${2}." "Copy Error";
 return 1;
 fi;
 return 0
}
retrieve_pkg => () {  if [ $# -ne 2 ]; then
 message "Usage: retrieve_pkg <url> <install dir>" "retrieve_pkg";
 return 1;
 fi;
 height=20;
 width=135;
 calculate_dimensions;
 local sub_pid1;
 clear_global_files;
 ${echo} "Retrieving file ${1}..." > ${global_temp_file3};
 ${echo} "" >> ${global_temp_file3};
 make_title "Retrieving ${1}";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Retrieval Of ${1}" --no-kill --tailboxbg "${global_temp_file3}" ${height} ${width} 2> ${global_temp_file4};
 while file_empty ${global_temp_file4}; do
 ${sleep} 1;
 done;
 fi;
 ${wget} -v --timeout=30 --directory-prefix=${2} -o /dev/null ${1} & sub_pid1=$!;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file4}`;
 if [ ${return_val} -ne 0 ]; then
 message "Failed to download `${basename} ${1}` at ${1}" "Download Failure";
 fi;
 return 0
}
get_time => () {  if [ $# -ne 2 ]; then
 message "Usage: get_time <search-for name> <run level or '-' for script>" "get_time";
 return 1;
 fi;
 local t1=0;
 local total_min=0;
 local t_sec=0;
 local line;
 hour=0;
 min=0;
 sec=0;
 [ ! -f "${times_file}" ] && return 0;
 if [ "${2}" == "-" ]; then
 line=`${grep} "^${1}:-.*" ${times_file}`;
 else
 if [ "${2}" != "-" ]; then
 line=`${grep} "^${1}:${2}.*" ${times_file}`;
 else
 return;
 fi;
 fi;
 [ -z "${line}" ] && return 0;
 t_sec="`${echo} ${line} | cut -d: -f3`";
 total_sec=$(( total_sec + t_sec ));
 [ ${total_sec} -eq 0 ] && return;
 total_min=$(${echo} "scale=5; ${t_sec}/60" | bc);
 min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${min}" ] && min=0;
 t1="`${echo} ${min}*60 | bc`";
 sec="$(${echo} ${t_sec}-${t1} | bc)";
 if [ ${min} -ge 60 ]; then
 hour=`${echo} "scale=5; ${min}/60" | bc`;
 hour=`${echo} ${hour} | cut -d"." -f1`;
 t1=`${echo} "${hour}*60" | bc`;
 min=`${echo} "${min}-${t1}" | bc`;
 fi;
 return
}
global_script_run_root => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run_root <path to script> <title>" "global_script_run_root";
 return 1;
 fi;
 local scs=0;
 local return_val=0;
 export path=${1};
 export title=${2};
 if ! root; then
 while :; do
 ${clear};
 ${echo} "*** Enter root password to proceed with installation of ${title} ***";
 ${su} -c '(
        global_script_run "${path}" "${title}" || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 if ! global_script_run "${path}" "${title}"; then
 return_val=1;
 fi;
 fi;
 export -n path title error_in_chroot;
 return ${return_val}
}
yesno_inquiry => () {  if [ $# -ne 2 ]; then
 message "Usage: yesno_inquiry <title> <prompt>" "yesno_inquiry";
 return 1;
 fi;
 make_title "Inquiry";
 ${dialog} --backtitle "${main_title}" --colors --title "${1}" --yesno "${2}" 15 100;
 [ $? -eq 1 ] && return 1;
 return 0
}
global_script_run => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run <path to script> <title>" "global_script_run";
 return 1;
 fi;
 declare -i j=0;
 local var1;
 local sub_pid1;
 local sub_pid2;
 local env_cmd="";
 var1=${2};
 check_for_directory "${release_dir}/${tarball_base_name}" || return 1;
 make_executable_file ${global_temp_file2} || return 1;
 if `${grep} -q "#build" ${prog_dir}/mstr_conf`; then
 if ! check_for_directory "${release_dir}/${tarball_base_name}/build"; then
 make_dir "${release_dir}/${tarball_base_name}/build" || return 1;
 fi;
 ${echo} -e "cd ${install_dir}/${tarball_base_name}/build\n" > ${global_temp_file2};
 else
 ${echo} -e "cd ${install_dir}/${tarball_base_name}\n" > ${global_temp_file2};
 fi;
 ${cat} ${1} >> ${global_temp_file2};
 height=35;
 width=150;
 calculate_dimensions;
 if `${grep} -m1 -q "^#pre_lfs" ${run_dir}/conf`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 ${clear};
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 else
 ${clear};
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 fi;
 kill ${tail_pid};
 else
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} | tee ${global_temp_file1} &
 else
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} &
 fi;
 else
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${global_temp_file2} | tee ${global_temp_file1} &
 else
 ${global_temp_file2} &>${global_temp_file1} &
 fi;
 fi;
 sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "${var1} Of ${tarball_base_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "${var1} Of ${tarball_base_name} (${start_time})";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Run level ${run} - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file3};
 while file_empty ${global_temp_file3}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 ${sleep} 2;
 return_val=$?;
 kill_proc `${cat} ${global_temp_file3}`;
 fi;
 if [ ${return_val} -eq 0 ]; then
 ${sleep} 2;
 else
 ${sleep} 3;
 fi;
 ${rm} -f ${chroot_dir}/tmp/lfs* &>/dev/null;
 if [ ${return_val} -ne 0 ]; then
 return 1;
 else
 return 0;
 fi
}
are_digits => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 if `${echo} ${1} | ${grep} -q -e "\." -e "[^0-9]"`; then
 return 1;
 else
 return 0;
 fi
}
calculate_dimensions => () {  local value;
 local max_ht=0;
 local max_wd=0;
 value=`stty size`;
 max_ht=`${echo} ${value} | cut -d" " -f1`;
 max_wd=`${echo} ${value} | cut -d" " -f2`;
 max_ht=$(( max_ht - 10 ));
 max_wd=$(( max_wd - 10 ));
 [ ${height} -le ${max_ht} ] || height=${max_ht};
 [ ${width} -le ${max_wd} ] || width=${max_wd};
 return 0
}
check_sig_rpkg => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_rpkg <file list>" "check_sig_rpkg";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local rp_name;
 local sig1;
 local sig2;
 local list;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 run="`${echo} ${line} | ${cut} -d: -f2`";
 prog="`${echo} ${line} | ${cut} -d: -f1`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Required Tarballs For ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 list="`${cat} ${data_dir}/${prog}/${run}/rpkg`";
 for rp_name in ${list};
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 if ! find_file ${rp_name} ${prog_src_dir}; then
 ${echo} "Unable to find required package ${rp_name}..." > ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Checking ${rp_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} -m1 ${rp_name} ${data_dir}/${prog}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${rp_name}\" ${data_dir}/${prog}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 ${sleep} 2;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 flag=0;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 [ ${error} -eq 0 ] && break 1;
 done;
 ${sleep} 1;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
get_tarball_base_from_tb => () {  if [ $# -gt 2 ]; then
 message "Usage: get_tarball_base_from_tb <path to tarball> [remove tmp file]" "get_tarball_base_from_tb";
 return 1;
 fi;
 rm_file=${2:-0};
 local sub_pid1;
 if [ ! -e "${1}" ]; then
 message "Unable to find tarball `${basename} ${1}`." "Tarball Find Failure";
 return 1;
 fi;
 local scs=0;
 while :; do
 if ${echo} "${1}" | ${grep} -q -e "^.*xz$"; then
 bn="`${basename} ${1}`";
 bu="${bn}.bk";
 [ ! -f "/tmp/${bn}" ] && copy ${1} /tmp;
 copy "${1}" "/tmp/${bu}";
 ${xz} -d "/tmp/${bn}";
 bn="`${echo} ${bn} | ${sed} -e 's;\.xz$;;g'`";
 ${tar} -t -f /tmp/${bn} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 remove_file "/tmp/${bn}";
 if [ ${rm_file} -eq 0 ]; then
 remove_file "/tmp/${bu}" || return 1;
 else
 move "/tmp/${bu}" "/tmp/${bn}.xz" || return 1;
 fi;
 else
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 ${unzip} -l ${1} &>${global_temp_file1};
 else
 ${tar} -t -f ${1} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 fi;
 fi;
 if `file_empty ${global_temp_file1}`; then
 message "Unable to get tarball base name from temporary file for `${basename} ${1}`." "Tarball Base Name Retrieval";
 scs=1;
 break 1;
 fi;
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 tarball_base_name="`${echo} ${temp_name} | ${sed} -e 's;\(^.*\)\/;\1;g'`";
 else
 tarball_base_name="`${basename} ${1} | ${sed} -e 's;\(^.*\)\.zip;\1;g'`";
 fi;
 else
 tarball_base_name=`${grep} -m1 "\(^[^/]\+\)\/.*$" ${global_temp_file1} | ${sed} -e 's;\(^[^/]\+\)\/.*$;\1;g'`;
 fi;
 tarball_base_name="`${echo} ${tarball_base_name} | tr ' ' '_'`";
 break 1;
 done;
 return ${scs}
}
batch_program_and_script_screen => () {  if [ $# -lt 1 ]; then
 message "Usage: batch_program_and_script_screen <prog_list>" "batch_program_and_script_screen";
 return 1;
 fi;
 prog_list="";
 old_prog_list="";
 local count_bp=0;
 local selection_bpss;
 while :; do
 height=10;
 width=65;
 calculate_dimensions;
 make_title "Batch Script Selection";
 ${dialog} --backtitle "${main_title}" --no-cancel --radiolist "Select either programs or scripts to add to the batch list" ${height} ${width} ${height} "Add program(s)" "" off "Add script(s)" "" off "View Current List" "" off 2> ${global_temp_file4};
 return_val=$?;
 selection_bpss="`${cat} ${global_temp_file4}`";
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && [ -z "${selection_bpss}" ] && return 0;
 case ${selection_bpss} in 
 "Add program(s)")
 while :; do
 please_wait;
 old_prog_list=${prog_list};
 batch_program_listing $@;
 return_val=$?;
 if [ ! -z "${prog_list}" ]; then
 prog_list="${old_prog_list} ${prog_list}";
 else
 prog_list="${old_prog_list}";
 fi;
 kill_please_wait;
 [ $return_val -eq 1 ] && break 1;
 done
 ;;
 "Add script(s)")
 local y;
 local directory_bpss="";
 local scripts_bpss="";
 local script_bpss="";
 y=`ls ${scripts_dir}`;
 if [ ! -z "$y" ]; then
 while :; do
 select_from_list "Select a script directory" `ls ${scripts_dir}` || break 1;
 directory_bpss=${selection};
 scripts_bpss=`ls ${scripts_dir}/${directory_bpss}`;
 if [ -z "${scripts_bpss}" ]; then
 message "No scripts to select!" "No Scripts Found";
 continue;
 fi;
 select_from_list "Select a script" ${scripts_bpss} || continue;
 script_bpss=${selection};
 [ -z "${script_bpss}" ] && continue;
 ${echo} "script:${scripts_dir}/${directory_bpss}/${script_bpss}" >> ${batch_file};
 prog_list="${prog_list} script:${scripts_dir}/${directory_bpss}/${script_bpss}";
 break 1;
 done;
 else
 message "No script directories to select!" "No Script Directories Found";
 fi;
 unset y
 ;;
 "View Current List")
 display_batch_list ${prog_list};
 case $? in 
 0)
 if [ ! -z "${prog_list}" ]; then
 remove_prog=`${cat} ${global_temp_file1}`;
 [ -z "remove_prog" ] && continue;
 line_no=${remove_prog:0:1};
 remove_prog=`${echo} ${remove_prog} | cut -d" " -f2`;
 if yesno_inquiry "Confirm Removal" "Are you sure that you want to remove the entry '${remove_prog}'?"; then
 old_prog_list=${prog_list};
 prog_list="";
 count_bp=1;
 for j in ${old_prog_list};
 do
 [ $(( count_bp++ )) -eq ${line_no} ] && continue;
 prog_list="${prog_list} ${j}";
 done;
 if [ -f "${batch_file}" ]; then
 eval ${sed} -i "${line_no}d" ${batch_file};
 else
 message "Unable to locate the batch file!" "Batch File Error";
 return 1;
 fi;
 fi;
 unset remove_prog old_prog_list;
 fi
 ;;
 3)
 if yesno_inquiry "Confirm Clearing Of List" "Are you sure that you want to clear the batch list?"; then
 prog_list="";
 clear_file "${global_temp_file1}" || return 1;
 clear_file "${batch_file}" || return 1;
 fi
 ;;
 esac
 ;;
 esac;
 done
}
download_prog => () {  if [ $# -lt 1 ]; then
 message "Usage: download_prog <program list>" "download_prog ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local scs;
 local found;
 local list1="";
 local list2="";
 local command="";
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 scs=1;
 found=1;
 tarball_name="";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 if ! file_empty ${data_dir}/${prog}/tb_name; then
 tarball_name=`${cat} ${data_dir}/${prog}/tb_name`;
 if [ ! -z "${tarball_name}" ]; then
 tarball_in_string ${tarball_name};
 scs=0;
 fi;
 fi;
 if [ ${scs} -eq 1 ]; then
 list1="`${grep} ${prog} ${shasum_file}`";
 z=0;
 for i in ${list1};
 do
 if `${echo} ${i} | ${grep} -q "${prog}\.\(tar\|tzg\|zip\|xz\|lzma\).*"`; then
 list2="${list2} ${i}";
 else
 continue;
 fi;
 z=$(( ++z ));
 done;
 if [ ${z} -gt 1 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Choose A Tarball For Installation";
 command="${dialog} --backtitle \"${main_title}\" --menu \"Select the tarball to use\" ${height} ${width} ${height}";
 z=1;
 for i in ${list};
 do
 command="${command} \"${z}. ${i}\" \"\"";
 z=$(( ++z ));
 done;
 eval ${command} 2> ${global_temp_file1};
 tarball_name="`${cat} ${global_temp_file1} | ${cut} -d\" \" -f2`";
 else
 tarball_name="${list2}";
 fi;
 unset z;
 if [ ! -z "${tarball_name}" ]; then
 [ ! -f "${data_dir}/${prog}/tb_name" ] && ${touch} "${data_dir}/${prog}/tb_name";
 ${echo} "${tarball_name}" > "${data_dir}/${prog}/tb_name";
 fi;
 fi;
 if [ -z "${tarball_name}" ]; then
 message "Unable to set tarball name for ${prog}." "Unable To Set Tarball Name";
 return 1;
 fi;
 tarball_name="`trim_spaces ${tarball_name}`";
 if find_file ${tarball_name} ${prog_src_dir}; then
 path="${file_name_path}";
 [ ! -z "${path}" ] && found=0;
 fi;
 if [ ${found} -eq 1 ]; then
 if ! file_empty "${profile}/mstr_urls"; then
 scs=1;
 height=20;
 width=120;
 list1="";
 calculate_dimensions;
 check_connection || return 1;
 ${echo} "Searching for ${tarball_name}..." > ${global_temp_file1};
 make_title "Tarball Search For ${tarball_name}";
 ${dialog} --backtitle "${main_title}" --title "Tarball Search For ${tarball_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;\(^.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 for line in ${list1};
 do
 `${echo} ${line} | ${grep} -iq -e "^#.*$" -e "^$" -` && continue;
 url="`${echo} ${line}/${tarball_name}`";
 if verify_tarball_url "${url}"; then
 ${echo} "Searching at ${line}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Found at ${url}..." >> ${global_temp_file1};
 ${sleep} 2;
 found=0;
 ${echo} "${line}" > "${data_dir}/${prog}/purl";
 break 1;
 fi;
 fi;
 done;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 else
 scs=0;
 fi;
 if [ ${scs} -eq 1 ] && [ ${found} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${line}/${tarball_name}" /tmp; then
 message "Unable to download ${name} from ${line}" "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 while :; do
 prompt_for_value "Program URL" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${tarball_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 return 1;
 fi;
 fi;
 break 1;
 done;
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 if check_remote_file_exists "${prompt_value}"; then
 located=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 tarball_name=`${basename} ${prompt_value}`;
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && ${echo} "${url_dir}" >> ${profile}/mstr_urls;
 ${echo} "${url_dir}" > "${data_dir}/${prog}/purl";
 fi;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 if [ ${located} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${prompt_value}" /tmp; then
 message "Unable to download ${tarball_name} from ${url_dir}." "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 fi;
 done;
 return 0
}
log_viewer => () {  if [ $# -ne 2 ]; then
 message "Usage: log_viewer <tarball base name> <run level>" "log_viewer";
 return 1;
 fi;
 local scs=0;
 while :; do
 [ ! -d "${data_dir}/${1}/${2}/log" ] && message "Unable to find log directory for ${1}." "No Log Directory" && return 1;
 local list1="`ls ${data_dir}/${1}/${2}/log`";
 if [ -z "${list1}" ]; then
 message "There are no log files to view for ${1} (run level ${2})." "No Log Files";
 break 1;
 fi;
 local command="";
 make_title "Log File Viewer";
 command="${dialog} --colors --backtitle \"${main_title}\" --title \"${1} - run level: ${run}\" --cancel-label \"Prev\"       --radiolist \"Log files for ${1}\" 20 90 20";
 for i in ${list1};
 do
 command="${command} \"${i}\" \"\" \"off\"";
 done;
 eval ${command} 2> ${global_temp_file2};
 return_val=$?;
 if [ ${return_val} -ne 0 ] || file_empty ${global_temp_file2}; then
 break 1;
 else
 local file="`${cat} ${global_temp_file2}`";
 local file2="";
 [ -z "${file}" ] && return 1;
 if ! check_for_file "${data_dir}/${1}/${2}/log/${file}"; then
 message "Unable to find log file '${file}'." "Log File Not Found";
 scs=1;
 break 1;
 fi;
 if `${echo} $file | ${grep} -q ".*bz2$"`; then
 file2="`${echo} $file | ${sed} -e 's;\.tar\.bz2;;g' -e 's;\.old;;g'`";
 ${tar} -C /tmp -xjf "${data_dir}/${1}/${2}/log/${file}";
 else
 message "Unknown extension; unable to extract log data for ${1}." "Extraction Error";
 scs=1;
 break 1;
 fi;
 if [ ! -f "/tmp/${file2}" ]; then
 message "Failed to locate the uncompressed log file in the tmp directory." "Log File Not Found";
 scs=1;
 break 1;
 else
 if ! edit_file "/tmp/${file2}" "1"; then
 message "There was an error editing the file, '${file}', for ${1}." "File Edit Error";
 fi;
 fi;
 remove_file "/tmp/${file2}";
 fi;
 done;
 return ${scs}
}
file_empty => () {  if [ $# -ne 1 ]; then
 message "Usage: file_empty <path to file>" "file_empty";
 return 1;
 fi;
 local var1;
 [ ! -e "${1}" ] && return 0;
 var1=`${cat} ${1}`;
 [ -z "${var1}" ] && return 0;
 unset var1;
 return 1
}
update_time => () {  if [ $# -ne 3 ]; then
 message "Usage: update_time <tarball base name or script name> <run level (or - for script)> <new_time>" "update_time";
 return 1;
 fi;
 local sec=${3};
 [ ! -f "${times_file}" ] && ${touch} ${times_file};
 sec=$(( sec + 0 ));
 if [ "${2}" == "-" ]; then
 if `${grep} -q ${1}:-:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:-:.*$;${1}:-:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:-:${sec}" >> ${times_file} || return 1;
 fi;
 else
 if `${grep} -q ${1}:${2}:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:${2}:.*$;${1}:${2}:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:${2}:${sec}" >> ${times_file} || return 1;
 fi;
 fi;
 return 0
}
get_run_level => () {  if [ $# -ne 1 ]; then
 message "Usage: get_run_level <program name>" "get_run_level";
 return 1;
 fi;
 local var1_grl=${1};
 local list1_grl="";
 local list2_grl="";
 local command="";
 local count=0;
 local desc="";
 list1_grl=`ls ${data_dir}/${var1_grl}`;
 for i in ${list1_grl};
 do
 [ "${i}" == "list1_grl" ] && continue;
 ! are_digits "${i}" && continue;
 list2_grl="${list2_grl} ${i}" && count=$(( ++count ));
 done;
 [ -z "${list2_grl}" ] && return 1;
 if [ ${count} -le 1 ]; then
 run=1;
 return 0;
 else
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 command="${dialog} --backtitle \"${gen_title}\" --no-cancel --ok-label \"Submit\" --title \"Multiple run levels found for ${var1_grl}\"         --radiolist \"Select a run level\" ${height} ${width} 20 ";
 for i in ${list2_grl};
 do
 desc="`${grep} '^#Desc:.*$' ${data_dir}/${var1_grl}/${i}/conf`";
 if [ ! -z "${desc}" ]; then
 desc="`${echo} ${desc} | ${sed} -e 's;^#Desc:\ *\(.*$\);\1;g'`";
 else
 desc="No Description Found";
 fi;
 desc="${desc:0:255}";
 command="${command} \"${i}\" \"${desc}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && file_empty ${global_temp_file1} && break 1;
 if ! file_empty ${global_temp_file1}; then
 run=`${cat} ${global_temp_file1}`;
 break 1;
 fi;
 done;
 [ -z "${run}" ] && run=1;
 return 0;
 fi
}
add_addl_run_dir => () {  if [ $# -ne 1 ]; then
 message "Usage: add_addl_run_dir <program base name>" "add_addl_run_dir";
 fi;
 yesno_inquiry "Add Run Directory" "You chose to add an additional run-level.  Is this correct?" || return 1;
 local success=1;
 local make_copy=0;
 local next=0;
 current=0 && export current;
 highest_run_level ${1} || return 1;
 next=$((current+1));
 if yesno_inquiry "Copy Directory" "Would you like to copy the most recent run level (${current}) to the new run level (${next})?"; then
 make_copy=0;
 else
 make_copy=1;
 fi;
 height=20;
 width=120;
 calculate_dimensions;
 case ${make_copy} in 
 "0")
 ${echo} "Copying file structure for ${tarball_base_name}..." > ${global_temp_file1}
 ;;
 "1")
 ${echo} "Creating file structure for ${tarball_base_name}, run-level ${next}..." > ${global_temp_file1}
 ;;
 esac;
 ${echo} "" >> ${global_temp_file1};
 make_title "Additional Run Level";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 case ${make_copy} in 
 "0")
 if ! copy "${prog_dir}/${current}" "${prog_dir}/${next}"; then
 ${echo} "An error occurred copying data to the new run level!" >> ${global_temp_file1};
 else
 ${echo} "Copied run level ${current} to new run level ${next} for ${1}..." >> ${global_temp_file1};
 success=0;
 fi
 ;;
 "1")
 while :; do
 for dir in "${prog_dir}/${next}" "${prog_dir}/${next}/ef" "${prog_dir}/${next}/log";
 do
 if ! check_for_directory "${dir}"; then
 make_dir "${dir}" || break 2;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "ip" "mf" "mi" "make_check_test" "pf" "rpkg" "patch_list" "conf";
 do
 make_file "${prog_dir}/${next}/${file}" || break 2;
 done;
 success=0;
 break 1;
 done;
 if [ ${success} -eq 0 ]; then
 ${echo} "Creation of run-level ${next} for ${tarball_base_name} successful..." >> ${global_temp_file1};
 else
 if [ ${success} -eq 1 ]; then
 ${echo} "An error occurred in the creation of run-level ${next} for ${tarball_base_name}!" >> ${global_temp_file1};
 fi;
 fi
 ;;
 esac;
 ${sleep} 3;
 kill_proc `${cat} ${global_temp_file2}` || exit 1;
 export -n current;
 return ${success}
}
check_for_file => () {  if [ $# -ne 1 ]; then
 message "Usage: check_for_file <file path>" "check_for_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 1;
 return 0
}
create_directory_listing => () {  if [ $# -ne 1 ]; then
 message "Usage: create_program_list <directory>" "create_program_list";
 return 1;
 else
 if [ ! -d "${1}" ]; then
 message "Argument ${1} is not a directory." "create_program_list";
 return 1;
 fi;
 fi;
 prog_list="";
 for i in `ls ${1}`;
 do
 [ -z "${i}" ] && break 1;
 [ ! -d "${1}/${i}" ] && continue;
 prog_list="${prog_list} ${i}";
 done;
 if [ -z "${prog_list}" ]; then
 message "Empty program listing!" "Directory Listing Creation";
 return 1;
 else
 return 0;
 fi
}
trim_spaces => () {  if [ $# -lt 1 ]; then
 message "Usage: trim_spaces <string(s)>" "trim_space";
 return 1;
 fi;
 ${echo} ${1} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"
}
make_dir => () {  if [ $# -ne 1 ]; then
 message "Usage: make_dir <path>" "make_dir";
 return 1;
 fi;
 [ -d "${1}" ] && return 0;
 if ! ${mkdir} -p ${1} &>/dev/null; then
 message "Unable to make directory ${1}" "Make directory";
 return 1;
 fi;
 if ! eval ${chmod} 775 ${1} || ! eval ${chmod} ug+s ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 return 0
}
download_patch => () {  if [ $# -lt 1 ]; then
 message "Usage: download_patch <program list>" "download_patch";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local list1="";
 local list2="";
 local found;
 local patch_name;
 for line in $@;
 do
 `${echo} ${line} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 error=0;
 prog="`${echo} ${line} | cut -d: -f1`";
 run="`${echo} ${line} | cut -d: -f2`";
 file_empty "${data_dir}/${prog}/${run}/patch_list" && continue;
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Patch Search For ${prog}";
 IFS=$(${echo} -e "\n\r");
 for patch_name in `${cat} ${data_dir}/${prog}/${run}/patch_list`;
 do
 `${echo} ${patch_name} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 found=1;
 scs=1;
 unset IFS;
 find_file ${patch_name} ${patch_src_dir} && continue;
 IFS=$(${echo} -e "\n\r");
 ${dialog} --backtitle "${main_title}" --title "Patch Search - ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ${echo} "Searching for patch, ${patch_name}..." > ${global_temp_file1};
 ${echo} "" >> ${global_temp_file1};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`head -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 for h in `${cat} "${profile}/mstr_urls"`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 `${echo} ${url} | ${grep} -iq -e '^#.*' -e '^$' -` && continue;
 ${echo} "Searching at ${url}..." >> ${global_temp_file1};
 url="${url}/${patch_name}";
 url="${url:0:255}";
 ! verify_url ${url} && continue;
 if ! check_connection; then
 ${echo} "Network connection failed...please check." >> ${global_temp_file1};
 error=1;
 break 1;
 fi;
 check_remote_file_exists ${url};
 rt=$?;
 if [ ${rt} -eq 0 ]; then
 ${echo} "" >> ${global_temp_file1};
 ${echo} "Patch ${patch_name} found at ${url}." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 [ ${error} -eq 1 ] && break 1;
 clear_global_files;
 if [ ${found} -ne 0 ]; then
 while :; do
 if ! prompt_for_value "Patch URL" "Enter URL for patch '${patch_name}'" "URL"; then
 return 1;
 fi;
 if [ -z "${prompt_value}" ]; then
 if yesno_inquiry "Try Again?" "No URL was entered.  Would you like to try again?"; then
 continue;
 else
 error=1;
 break 3;
 fi;
 fi;
 break 1;
 done;
 if ! verify_url ${prompt_value}; then
 message "Unable to verify URL for patch, ${patch_name}." "Failed URL Verification";
 error=1;
 break 2;
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=0;
 break 2;
 fi;
 clear_global_files;
 if ! check_remote_file_exists ${prompt_value}; then
 message "Patch, ${patch_name}, does not exist at the supplied URL, ${url}...exiting." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 url="${prompt_value:0:255}";
 fi;
 if ! ${grep} -iq "`${dirname} ${url}`" "${profile}/mstr_urls"; then
 ${echo} "`${dirname} ${url}`" >> "${profile}/mstr_urls";
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 clear_global_files;
 if ! retrieve_pkg ${url} /tmp; then
 message "Unable to retrieve required tarball, ${patch_name}." "Patch Tarball Retrieval Error";
 error=1;
 break 2;
 fi;
 if [ ! -f "/tmp/${patch_name}" ]; then
 message "Unable to find the patch, ${patch_name}, in the /tmp directory.";
 error=1;
 break 1;
 fi;
 if ! move "/tmp/${patch_name}" "${patch_src_dir}"; then
 message "There was an error moving patch ${patch_name} to the source directory." "File Move Error";
 error=1;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 1 ] && break 1;
 done;
 return ${error}
}
make_file => () {  if [ $# -ne 1 ]; then
 message "Usage: make_file <file path>" "make_file";
 return 1;
 fi;
 check_for_file "${1}" && return 0;
 err=1;
 while :; do
 if ! ${touch} ${1}; then
 err=0;
 break 1;
 fi;
 ${chmod} 775 ${1} || err=0;
 break 1;
 done;
 if [ ${err} -eq 0 ]; then
 message "Error creating file ${1}." "File Creation" && return 1;
 return 1;
 fi;
 return 0
}
chroot_mounted => () {  `${mount} -l | cut -d' ' -f3 | ${grep} -q "${chroot_dir}"` || return 1;
 return 0
}
execute_script_root => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script_root <path to script>" "execute_script_root";
 return 1;
 fi;
 local script_esr="${1}";
 export script_esr;
 local return_val=0;
 if ! root; then
 while :; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed ***\n";
 ${su} -c '(
        execute_script ${script_esr} || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 execute_script ${script_esr} || return_val=1;
 fi;
 unset script_esr;
 return ${return_val}
}
tarball_in_string => () {  if [ $# -ne 1 ]; then
 message "Usage: tarball_in_string <string>" "tarball_in_string";
 return 1;
 fi;
 if ${echo} ${1} | ${grep} -iq -e ".*tgz$" -e ".*gz$" -e ".*bz2$" -e ".*zip$" -e ".*xz$" -e ".*lzma$"; then
 return 0;
 else
 return 1;
 fi
}
new_dir_name => () {  prompt_for_value "Script Directory Name" "Enter new directory name" "Name" || return 1;
 return 0
}
edit_file => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: edit_file <path to file> [save flag]" "edit_file";
 return 1;
 fi;
 local scs=1;
 local save_flag="${2:-0}";
 EDITOR="vi";
 if [ ! -f "${1}" ]; then
 make_file ${1} || return 1;
 fi;
 find_file "`${basename} ${EDITOR}`";
 if [ ! -z "${file_name_path}" ] && [ -f "${file_name_path}" ]; then
 ${cat} ${1} > ${global_temp_file3};
 ${file_name_path} ${global_temp_file3};
 if [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 else
 return_val=0;
 fi;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 local command="";
 height=35;
 width=150;
 calculate_dimensions;
 make_title "File Edit";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Save\"       --cancel-label \"Do Not Save\" --cr-wrap --editbox \"${1}\" ${height} ${width}";
 eval ${command} 2> ${global_temp_file3};
 return_val=$?;
 if [ ${return_val} -eq 0 ] && [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 fi;
 fi;
 fi;
 return ${return_val}
}
new_batch_name => () {  prompt_for_value "Batch File Name" "Enter new batch file name" "Name" || return 1;
 return 0
}
clear_global_files => () {  for i in ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4};
 do
 clear_file "${i}" || return 1;
 ${touch} ${i} || return 1;
 done;
 return 0
}
move => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 ${mv} -f "${1}" "${2}";
 if [ $? -eq 1 ]; then
 message "There was an error moving file ${1} --> ${2}." "File Move";
 return 1;
 fi;
 return 0
}
save_file => () {  if [ $# -ne 2 ]; then
 message "Usage: save_file <file name> <file to copy>" "save_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 make_file ${1} || return 1;
 else
 if [ ! -e "${2}" ]; then
 message "File to copy is missing or empty.  No save will be done." "Missing Save-From File";
 return 0;
 fi;
 fi;
 if ! copy "${2}" "${1}"; then
 message "Error saving file." "File Save";
 return 1;
 fi;
 if [ -O ${1} ]; then
 if ! ${chmod} 775 ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 fi;
 return 0
}
check_for_directory => () {  if [ -d "${1}" ]; then
 return 0;
 else
 return 1;
 fi
}
prompt_for_value => () {  if [ $# -ne 3 ]; then
 message "Usage: prompt_for_value <title> <tag> <prompt>" "prompt_for_value";
 return 1;
 fi;
 height=20;
 width=120;
 p_lgth=${#3};
 local command;
 calculate_dimensions;
 make_title "Prompt";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Submit\"     --form \"${2}\" ${height} ${width} 1 \"${3}:\" 1 1 \"\" 1 $(( p_lgth + 2 )) ${width} 200";
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 prompt_value=`${cat} ${global_temp_file1}`;
 if [ ${#prompt_value} -gt 200 ]; then
 prompt_value=${prompt_value:0:255};
 fi;
 if [ ${return_val} -ne 0 ] || [ -z "${prompt_value}" ]; then
 prompt_value="";
 return 1;
 else
 prompt_value="`${echo} ${prompt_value} | tr ' ' '_'`";
 return 0;
 fi
}
execute_script => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script <path to script file>" "execute_script";
 return 1;
 fi;
 if [ ! -f "${1}" ]; then
 message "No script found!" "Script Find Error";
 return 1;
 fi;
 if `${grep} -m 1 -q "^#chroot_flag" ${1}` && ! check_for_directory ${chroot_dir}/tmp; then
 if ! make_dir ${chroot_dir}/tmp; then
 message "Unable to make chroot temporary directory." "Chroot Tmp Directory Creation Error";
 return 1;
 fi;
 fi;
 if [ ${global_no_dialog} -eq 1 ]; then
 `${grep} -m 1 -q "^#no_dialog" "${1}"` && no_dialog=0;
 fi;
 base_script_name="`${basename} ${1}`";
 make_executable_file "${global_temp_file3}";
 ${cat} ${1} > ${global_temp_file3};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 if ! copy ${global_temp_file3} "${chroot_dir}/tmp/"; then
 message "There was an error copying the script, '${1}', to the chroot temporary directory." "Script Copy Error";
 return 1;
 fi;
 fi;
 get_time ${base_script_name} "-";
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} $calc > ${global_time_file} && ${sleep} 1;
 done & sub_pid2=$!;
 if `${grep} -m 1 -q "^#pre_lfs" ${global_temp_file3}`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host directory." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 ${clear};
 ${echo} "Running script...";
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} | tee ${global_temp_file4};
 else
 ${global_temp_file3} | tee ${global_temp_file4};
 fi;
 return_val=$?;
 ${sleep} 5;
 else
 height=35;
 width=150;
 calculate_dimensions;
 local sub_pid1;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Running script ${base_script_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Running script ${base_script_name} (${start_time})";
 fi;
 ${echo} "Running script..." > ${global_temp_file4};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} &>>${global_temp_file4} &
 else
 ${global_temp_file3} &>>${global_temp_file4} &
 fi;
 sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Running Script: ${base_script_name} (Est. Completion Time: ${hour}h ${min}m ${sec}s)" --no-kill --tailboxbg ${global_temp_file4} ${height} ${width} 2> ${global_temp_file5};
 while file_empty ${global_temp_file5}; do
 ${sleep} .5;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 5;
 kill_proc `${cat} ${global_temp_file5}`;
 fi;
 disown ${sub_pid2};
 kill ${sub_pid2};
 ${rm} -f ${chroot_dir}/tmp/lfs_script* &>/dev/null;
 if ! update_time ${base_script_name} "-" `${cat} ${global_time_file}`; then
 message "Warning: There was an error updating the time file for (script) ${base_script_name}...continuing." "Update Time File Error";
 fi;
 if [ ${return_val} -eq 1 ]; then
 ${echo} "Script error: ${base_script_name} @ `date`" >> ${install_log};
 message "Script error: ${base_script_name}." "Script Error";
 else
 if [ ${return_val} -eq 0 ]; then
 ${echo} "Script finish: ${base_script_name} @ `date`" >> ${install_log};
 fi;
 fi;
 return ${return_val}
}
remove_file => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_file <file path> ..." "remove_file";
 return 1;
 fi;
 for z in $@;
 do
 [ ! -e "${z}" ] && continue;
 ${rm} -rf ${z} &>/dev/null;
 if [ $? -eq 1 ]; then
 message "There was an error removing file ${z}." "File Removal Error";
 return 1;
 fi;
 done;
 return 0
}
abort_message => () {  if [ $# -lt 1 ] || [ -z "${1}" ]; then
 message "Usage: abort_message <text> [title]" && return 1;
 fi;
 local message_title;
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 ${dialog} --sleep 2 --title "Installation Abort" --infobox "${1}" 10 30;
 else
 ${dialog} --sleep 2 --title "Aborting Installation: ${message_title}." --infobox "${1}" 10 30;
 fi;
 exit 1
}
make_executable_file => () {  if [ $# -ne 1 ]; then
 message "Usage: make_executable_file <file name>" "make_executable_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 if ! make_file "${1}" || ! ${chmod} u+x ${1}; then
 message "Unable to create file: ${1}." "Executable File Error";
 return 1;
 fi;
 else
 if [ ! -x "${1}" ]; then
 if ! ${chmod} u+x ${1}; then
 message "Unable to make file '${1}' executable." "Executable File Error";
 return 1;
 fi;
 fi;
 fi;
 return 0
}
kill_proc => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: kill_proc <proc1> [proc2]" "kill_proc";
 return 1;
 fi;
 [ -z "${1}" ] && return 0;
 if [ $# -eq 1 ]; then
 ${ps} -p ${1} &>/dev/null || return 0;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 else
 if [ $# -eq 2 ]; then
 while ${ps} -p ${1} &>/dev/null 2>&1; do
 ${sleep} 1;
 done;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 fi;
 fi;
 return 0
}
verify_signature => () {  if [ $# -ne 2 ]; then
 message "Usage: verify_signature <sig1> <sig2>" "verify_signature";
 return 1;
 fi;
 if [ "${1}" != "${2}" ]; then
 return 1;
 else
 return 0;
 fi
}
single_program_configuration => () {  program_selection "Select a program to check and configure" "single" "Select" $@ || return 1
}
chg_tmp_file_owner => () {  if [ $# -ne 1 ]; then
 message "Usage: chg_tmp_file_owner <file>" "chg_tmp_file_owner";
 return 1;
 fi;
 local owner="${1}";
 for i in ${batch_file} ${return_val_file} ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4} ${global_time_file} ${global_temp_file5};
 do
 [ ! -f "${i}" ] && continue;
 chg_file_owner ${owner} ${i} || return 1;
 done;
 return 0
}
root => () {  if [ `id -u` -eq 0 ]; then
 return 0;
 else
 return 1;
 fi
}
remove_dir => () {  if [ $# -ne 1 ]; then
 message "Usage: remove_dir <dir>" "remove_dir";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 0;
 local sub_pid1;
 height=10;
 width=80;
 calculate_dimensions;
 ${echo} "Please wait while removing directory `${basename} ${1}`..." > ${global_temp_file1};
 ${rm} -rf ${1} &>/dev/null & sub_pid1=$!;
 make_title "Directory Removal";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Removing Directory" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 1;
 kill_proc `${cat} ${global_temp_file2}`;
 return ${return_val}
}
verify_url => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_signature <string>" "verify_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\)://.*$"; then
 return 0;
 else
 return 1;
 fi
}
message => () {  if [ $# -lt 1 ]; then
 message="Usage: message <text> [title]" "message";
 fi;
 local message;
 local message_title;
 message="${1}";
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 message_title="Message";
 fi;
 ${dialog} --colors --backtitle "${gen_title}" --title "${message_title}" --msgbox "${message}" 15 100;
 return $?
}
please_wait => () {  height=10;
 width=60;
 kill_please_wait;
 calculate_dimensions;
 make_title "Processing";
 ${echo} "Please wait..." > ${global_temp_file5};
 ${dialog} --backtitle "${main_title}" --title "Processing" --no-kill --tailboxbg ${global_temp_file5} ${height} ${width} 2> ${global_temp_file6};
 while file_empty ${global_temp_file6}; do
 sleep .5;
 done;
 please_wait_pid="`cat ${global_temp_file6}`";
 return 0
}
new_script_name => () {  prompt_for_value "New Script Name" "Enter Script Name (NOTE: empty files will still save)" "Name" || return 1;
 return 0
}
confirm_selection => () {  if [ $# -lt 1 ]; then
 message "Usage: confirm_selection <list>" "confirm_selection";
 return 1;
 fi;
 local list1="$@";
 local prog;
 local rn;
 local return_val;
 local command="";
 local i;
 local kill_wait_pid_cs="";
 declare -i i=1;
 if [ -z "${list1}" ]; then
 message "No programs were selected for confirmation." "Installation Selection Confirmation";
 return 1;
 fi;
 please_wait;
 height=25;
 width=60;
 for j in $@;
 do
 [ ${#j} -gt ${width} ] && width=${#j};
 done;
 width=$(( width + 15 ));
 calculate_dimensions;
 make_title "Selection Confirmation";
 command="${dialog} --backtitle \"${main_title}\" --title \"Selected programs\" ";
 command="${command} --ok-label \"Yes\" --cancel-label \"No\" --menu \"Is the selection correct?\" ${height} ${width} ${height} ";
 command="${command} \"PROGRAM\" \"RUN-LEVEL\"";
 command="${command} \"=================\" \"=========\"";
 for j in ${list1};
 do
 if `${echo} ${j} | ${grep} -q "^script:.*$"`; then
 prog="`${echo} ${j} | cut -d: -f2`";
 prog="script - `basename ${prog}`";
 rn="N/A";
 else
 prog="`${echo} ${j} | cut -d: -f1`";
 rn="`${echo} ${j} | cut -d: -f2`";
 fi;
 command="${command} \"${i}.  ${prog}\" \"${rn}\"";
 i=$(( ++i ));
 done;
 eval ${command} 2> /dev/null;
 return_val=$?;
 kill_please_wait;
 return $return_val
}
edit_configuration => () {  if [ $# -ne 1 ]; then
 message "Usage: edit_configuration <program name>" "edit_configuration";
 return 1;
 fi;
 local var1_ec;
 local scs=0;
 prog_dir="${data_dir}/${1}";
 run_dir="${prog_dir}/${run}";
 get_time ${tarball_base_name} ${run} || return 1;
 make_title "Configuration Edit";
 while :; do
 ${dialog} --colors --backtitle "${main_title}" --title "${1} - run level: ${run} - \Z1Est. Build Time: ${hour}h ${min}m ${sec}s\Zn" --no-cancel --extra-button --extra-label "New Run Level" --radiolist "Configuration/Installation files for ${1}" 20 90 20 "Configuration" "View/edit configuration commands" "off" "Make Flags" "View/edit list of make flags" "off" "Make (Check/Test) Flags" "View/edit list of make (check/test) commands" "off" "Make (Install) Flags" "View/edit list of make (install) commands" "off" "Master Base URL's" "View/edit base URL's for downloading packages" "off" "Master Conf File" "View/edit master configuration file (in parent directory)" "off" "Patch List" "View/edit patch list file" "off" "Post-configuration" "View/edit post-configuration commands" "off" "Pre-configuration" "View/edit pre-configuration commands" "off" "Preferred URL" "View/edit this program's preferred URL" "off" "Program Description" "View/edit program description" "off" "Required Packages" "View/edit packages to be present in source directory" "off" "Run Level Conf File" "View/edit run level configuration file" "off" "View Logs" "View logs for this run-level" "off" "Remove Run-Level" "Delete this run-level" "off" 2> ${global_temp_file1};
 return_val=$?;
 if [ ${return_val} -eq 3 ]; then
 return 3;
 else
 if file_empty ${global_temp_file1}; then
 return 1;
 fi;
 fi;
 case `${cat} ${global_temp_file1}` in 
 "Configuration")
 var1_ec="${run_dir}/cf"
 ;;
 "Pre-configuration")
 var1_ec="${run_dir}/pre-cf"
 ;;
 "Post-configuration")
 var1_ec="${run_dir}/post-cf"
 ;;
 "Program Description")
 var1_ec="${prog_dir}/df"
 ;;
 "Installed Programs")
 var1_ec="${run_dir}/ip"
 ;;
 "Make Flags")
 var1_ec="${run_dir}/mf"
 ;;
 "Make (Install) Flags")
 var1_ec="${run_dir}/mi"
 ;;
 "Make (Check/Test) Flags")
 var1_ec="${run_dir}/make_check_test"
 ;;
 "Patch List")
 var1_ec="${run_dir}/patch_list"
 ;;
 "Preferred URL")
 var1_ec="${prog_dir}/purl"
 ;;
 "Required Packages")
 var1_ec="${run_dir}/rpkg"
 ;;
 "Master Conf File")
 var1_ec="${prog_dir}/mstr_conf"
 ;;
 "Run Level Conf File")
 var1_ec="${run_dir}/conf"
 ;;
 "Master Base URL's")
 var1_ec="${profile}/mstr_urls"
 ;;
 "View Logs")
 log_viewer ${tarball_base_name} ${run};
 continue
 ;;
 "Remove Run-Level")
 if remove_run_level "${tarball_base_name}" "${run}"; then
 return 0;
 else
 continue;
 fi
 ;;
 *)
 continue
 ;;
 esac;
 ! check_for_file ${var1_ec} && ${touch} ${var1_ec};
 edit_file ${var1_ec};
 done;
 return ${scs}
}
clear_file => () {  if [ $# -ne 1 ]; then
 message "Usage: clear_file <file>" "clear_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 0;
 scs_cgf=0;
 ${rm} ${1} &>/dev/null || scs_cgf=1;
 ${touch} ${1} &>/dev/null || scs_cgf=1;
 if [ ${scs_cgf} -eq 1 ]; then
 message "An error occurred while attempting to clear a file: ${1}." "File-Clear Error";
 return 1;
 fi;
 return 0
}
highest_run_level => () {  if [ $# -ne 1 ]; then
 message "Usage: highest_run_level <tarball base directory>" "highest_run_level";
 return 1;
 fi;
 [ ! -d "${data_dir}/${1}" ] && return 1;
 local list_hrl=`ls ${data_dir}/${1}`;
 for i in ${list_hrl};
 do
 [ "${i}" == "list_hrl" ] && continue;
 if are_digits ${i}; then
 [ ${current} -lt ${i} ] && current=${i};
 fi;
 done;
 return 0
}
download_rpkg => () {  if [ $# -lt 1 ]; then
 message "Usage: download_rpkg <program list>" "download_rpkg ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local rp_name="";
 local list1="";
 local list2="";
 local error=1;
 local found;
 height=20;
 width=120;
 calculate_dimensions;
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 IFS=$(${echo} -e "\n\r");
 for rp_name in `${cat} ${data_dir}/${prog}/${run}/rpkg`;
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 found=1;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 find_file ${rp_name} ${prog_src_dir} && continue;
 if ! file_empty ${profile}/mstr_urls; then
 ${echo} "Searching for ${rp_name}..." > ${global_temp_file1};
 make_title "Required Tarball Search For ${rp_name}";
 ${dialog} --backtitle "${main_title}" --title "Required Tarball Search For ${rp_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 url="`${echo} ${url}/${rp_name}`";
 ! verify_tarball_url "${url}" && continue;
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Searching for ${rp_name} at ${url}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Required tarball, ${rp_name}, found at ${url}..." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 clear_global_files;
 if [ ${found} -eq 1 ]; then
 while :; do
 prompt_for_value "Required Program URL (${rp_name})" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${rp_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 error=0;
 break 1;
 fi;
 fi;
 break 1;
 done;
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Required Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 check_remote_file_exists "${prompt_value}";
 if [ $? -eq 0 ]; then
 found=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && echo "${url_dir}" >> ${profile}/mstr_urls;
 url="${prompt_value}";
 break 1;
 fi;
 done;
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 if [ ${found} -eq 1 ]; then
 message "Unable to find required tarball, ${rp_name}.  Aborting installation..." "File Find Failed";
 error=0;
 break 1;
 fi;
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 if ! retrieve_pkg "${url}" /tmp; then
 message "Unable to download ${rp_name} from `${dirname} ${url}`." "File Download Failed";
 error=0;
 break 1;
 fi;
 if [ ! -f "/tmp/${rp_name}" ]; then
 message "Required tarball file not found in /tmp directory." "Tarball Not Found";
 error=0;
 break 1;
 fi;
 if ! move "/tmp/${rp_name}" "${prog_src_dir}"; then
 message "Unable to move file ${rp_name} to source directory." "Tarball File Move Error";
 error=0;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 0 ] && return 1;
 done;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
script_options_m1 => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options_m1 <file>" "script_options_m1";
 return 1;
 fi;
 local command;
 height=20;
 width=60;
 calculate_dimensions;
 make_title "Options";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '`${basename} ${1}`' Options\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"View Completion Time(s)\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
install_one => () {  if [ $# -ne 1 ]; then
 message "Usage: install_one <program name>" "install_one";
 return 1;
 fi;
 local path;
 local located=1;
 local success=1;
 local runtime_error=1;
 no_dialog=1;
 tarball_name="";
 prog_dir="${data_dir}/${tarball_base_name}";
 run_dir="${prog_dir}/${run}";
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf` && ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 install_dir="${in_chroot_install_dir}";
 release_dir="${chroot_dir}${in_chroot_install_dir}";
 check_for_directory ${chroot_dir}/tmp || make_dir ${chroot_dir}/tmp;
 if ! directory_writable "${chroot_dir}/${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 else
 install_dir="$out_chroot_install_dir";
 release_dir="$out_chroot_install_dir";
 if ! directory_writable "${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 fi;
 if ! `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 if `${echo} "${install_dir}" | ${grep} -q "${chroot_dir}"` || `${echo} "${release_dir}" | ${grep} -q "${chroot_dir}"`; then
 if ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 check_for_directory "${chroot_dir}${install_dir}";
 else
 check_for_directory "${install_dir}";
 fi;
 if [ $? -ne 0 ]; then
 if ! make_dir "${install_dir}"; then
 message "Unable to create install directory (${install_dir})." "Installation Directory Creation Error";
 break 1;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 directory_writable ${chroot_dir}${install_dir} || return 1;
 else
 directory_writable ${install_dir} || return 1;
 fi;
 if ! check_structure ${run_dir}; then
 message "Program directory for ${1} not set up properly." "Improper Directory Structure";
 return 1;
 fi;
 get_time ${tarball_base_name} ${run};
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} ${calc} > ${global_time_file} && sleep 1;
 done & sub_pid2=$!;
 ! file_empty ${prog_dir}/tb_name && tarball_name="`${cat} ${prog_dir}/tb_name`";
 [ -z "${tarball_name}" ] && return 1;
 if find_file "${tarball_name}" "${prog_src_dir}"; then
 release_tarball "${file_name_path}" "${release_dir}" 0 || return 1;
 else
 message "Unable to find file, ${tarball_name}." "File Not Found";
 return 1;
 fi;
 parent_tb_base_name=${tarball_base_name};
 release_isp ${run_dir}/rpkg || return 1;
 tarball_base_name=${parent_tb_base_name};
 no_dialog=1;
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/patch_list";
 fi;
 IFS=$(${echo} -e "\n\r");
 for item in `${cat} ${run_dir}/patch_list`;
 do
 `${echo} ${item} | ${grep} -q -e "^#.*$" -e "^$" -` && continue;
 if ! run_patch ${item}; then
 message "An error occurred running the patch (${item}) for ${tarball_base_name}." "Patch-Run Error";
 return 1;
 fi;
 done;
 unset IFS;
 j="`ls ${run_dir}/log | grep -v ^.*old`";
 for k in ${j};
 do
 h="`echo ${k} | sed -e 's;\.tar\.bz2$;;g'`";
 move "${run_dir}/log/${k}" "${run_dir}/log/${h}.old.tar.bz2" || return 1;
 done;
 unset j k;
 while true; do
 if file_empty "${run_dir}/pre-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/pre-cf";
 fi;
 if ${grep} -q "^#run_as_root" ${run_dir}/pre-cf && ! root; then
 if ! global_script_run_root "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "pre_conf" ${global_temp_file1};
 compress_log "${run_dir}/log/pre_conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/cf";
 fi;
 if ! global_script_run "${run_dir}/cf" "Configuration"; then
 message "The configuration script for ${tarball_base_name}, run level ${run}, failed." "Configuration Failure";
 runtime_error=0;
 fi;
 save_log "conf" ${global_temp_file1};
 compress_log "${run_dir}/log/conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mf";
 fi;
 if ! global_script_run "${run_dir}/mf" "Make"; then
 message "The Make script for ${tarball_base_name}, run level ${run}, failed." "Make Failure";
 runtime_error=0;
 fi;
 save_log "make" ${global_temp_file1};
 compress_log "${run_dir}/log/make" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/make_check_test"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/make_check_test";
 fi;
 if ! global_script_run "${run_dir}/make_check_test" "Make Check/Test"; then
 if ! `grep -q -m1 "#ignore_check_errors" "${run_dir}/conf"`; then
 message "The Make-Check script for ${tarball_base_name}, run level ${run}, failed." "Make-Check Failed";
 runtime_error=0;
 else
 ${echo} "Warning: Make/Check error for ${tarball_base_name} @ `date`" >> ${install_log};
 fi;
 fi;
 save_log "make_check_test" ${global_temp_file1};
 compress_log "${run_dir}/log/make_check_test" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mi"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mi";
 fi;
 if ${grep} -q "^#no_root_install" ${run_dir}/mi; then
 if ! global_script_run "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run_root "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "make_install" ${global_temp_file1};
 compress_log "${run_dir}/log/make_install" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/post-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/post-cf";
 fi;
 if ${grep} -q "#run_as_root" ${run_dir}/post-cf; then
 if ! global_script_run_root "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "post_cf" ${global_temp_file1};
 compress_log "${run_dir}/log/post_cf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 break 1;
 done;
 disown ${sub_pid2};
 ${kill} ${sub_pid2};
 if [ ${runtime_error} -ne 0 ]; then
 if ! update_time ${tarball_base_name} ${run} `${cat} ${global_time_file}`; then
 message "Warning: A failure occurred while updating the time file for ${tarball_base_name}...continuing." "Update Time File Error";
 fi;
 fi;
 remove_ext_tb=1;
 if [ ${global_remove_ext_tb} -eq 0 ]; then
 remove_ext_tb=0;
 else
 if `${grep} -q "^#remove_ext_tb" ${run_dir}/conf`; then
 remove_ext_tb=0;
 fi;
 fi;
 if [ ${remove_ext_tb} -eq 0 ] && [ -d "${release_dir}/${tarball_base_name}" ]; then
 if ! remove_dir "${release_dir}/${tarball_base_name}"; then
 message "A failure occurred during the removal of directory, ${release_dir}/${tarball_base_name}." "Directory Removal Error";
 return 1;
 fi;
 fi;
 if [ ${runtime_error} -eq 1 ]; then
 ${echo} "Installed: ${tarball_base_name} @ `date`" >> ${install_log};
 return 0;
 else
 if [ ${runtime_error} -eq 0 ]; then
 ${echo} "Install Failure: ${tarball_base_name} @ `date` (check log files)" >> ${install_log};
 message "Install Failure: ${tarball_base_name} @ `date` (check log files)" "Install Failure";
 return 1;
 fi;
 fi
}
check_sig_prog => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_prog <file list>" "check_sig_prog";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local listing;
 local flag=0;
 local error=1;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 base_name="`${echo} ${line} | ${cut} -d: -f1`";
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Main Program" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 ${echo} "Checking ${base_name}..." >> ${global_temp_file1};
 if file_empty "${data_dir}/${base_name}/tb_name"; then
 ${echo} "${base_name}: Unable to find the name of the tarball to check!" >> ${global_temp_file1};
 error=0;
 break 1;
 else
 tb_name="`${head} -n1 ${data_dir}/${base_name}/tb_name`";
 if [ -z "${tb_name}" ]; then
 ${echo} "${base_name}: Unable to find the name of the tarball being used for installation!" >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 fi;
 if ! find_file ${tb_name} ${prog_src_dir}; then
 ${echo} "Unable to find program, ${tb_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
release_isp => () {  if [ $# -ne 1 ]; then
 message "Usage: release_isp <run directory>" "release_isp";
 return 1;
 fi;
 file_empty "${1}" && return 0;
 local signature;
 local full_path;
 local found;
 local url;
 IFS=$(${echo} -e "\n\r");
 for pkg in `${cat} ${1}`;
 do
 ${echo} ${pkg} | ${grep} -iq -e '^#.*' -e '^$' && continue;
 found=1;
 scs=1;
 name=`${echo} ${pkg} | ${cut} -d: -f1`;
 if [ -z "${name}" ]; then
 message "Unable to find the name of a required package!" "Required Package Name Missing";
 return 1;
 fi;
 if ! find_file ${name} ${prog_src_dir}; then
 message "Unable to find required tarball, ${name}, in source directory." "Required Package Missing";
 return 1;
 fi;
 rename=`${echo} ${pkg} | ${cut} -d: -f2`;
 append_cmds=`${echo} ${pkg} | ${cut} -d: -f3`;
 get_tarball_base_from_tb ${file_name_path} || return 1;
 if [ -f "${release_dir}/${parent_tb_base_name}/${tarball_base_name}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${tarball_base_name};
 fi;
 if release_tarball ${file_name_path} ${release_dir}/${parent_tb_base_name} 1 "${append_cmds}"; then
 if [ ! -z "${rename}" ]; then
 if [ -d "${release_dir}/${parent_tb_base_name}/${rename}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 move ${release_dir}/${parent_tb_base_name}/${tarball_base_name} ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 else
 message "There was an error releasing the tarball, ${name}, into its parent directory (${parent_tb_base_name})!" "Tarball Release Error";
 return 1;
 fi;
 done;
 unset IFS;
 return 0
}
rename_script_name => () {  prompt_for_value "Script Rename" "Script Rename" "Name" || return 1;
 return 0
}
program_selection => () {  if [ $# -lt 4 ]; then
 message "Usage: output_dialog_selection_batch <title> <type> <ok label> <list>" "output_dialog_selection_batch";
 return 1;
 fi;
 local command;
 local description_ps;
 local file1_ps;
 local file3_ps;
 local batch_prog_temp_ps="";
 local batch_progs_ps="";
 local orig_list_ps;
 local batch_run_level_ps="";
 local type_ps;
 local title_ps;
 local ok_label_ps;
 local cancel_label_ps;
 return_val="";
 title_ps="${1}";
 type_ps="${2}";
 ok_label_ps="${3}";
 shift 3;
 orig_list_ps=$@;
 prog_list="";
 while :; do
 kill_please_wait;
 please_wait;
 height=50;
 width=160;
 calculate_dimensions;
 make_title "Batch Listing";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"${ok_label_ps}\"       --no-cancel --radiolist \"${title_ps}\" ${height} ${width} ${height} ";
 for i in ${orig_list_ps};
 do
 file1_ps="${data_dir}/${i}/df";
 if ! file_empty ${file1_ps}; then
 description_ps=`${cat} ${file1_ps}`;
 else
 description_ps="No description";
 fi;
 description_ps="${description_ps:0:255}";
 command="${command} \"${i}\" \"${description_ps}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 { 
 [ ${return_val} -eq 1 ] || file_empty ${global_temp_file1}
 } && return 1;
 batch_prog_temp_ps="`${cat} ${global_temp_file1} | ${sed} -e 's;";;g'`";
 if [ "${type_ps}" == "single" ] || [ "${type_ps}" == "checksum" ]; then
 prog_list=${batch_prog_temp_ps};
 break 1;
 else
 if [ "${type_ps}" == "batch" ]; then
 get_run_level ${batch_prog_temp_ps};
 ${echo} "${batch_prog_temp_ps}:${run}" >> ${batch_file};
 prog_list="${prog_list} ${batch_prog_temp_ps}";
 fi;
 fi;
 done;
 return ${return_val}
}
verify_sha_alg => () {  case ${sha_alg} in 
 "1" | "224" | "256" | "384" | "512" | "512224" | "512256")
 :
 ;;
 *)
 sha_alg=1
 ;;
 esac;
 return 0
}
run_patch => () {  if [ $# -ne 1 ]; then
 message "Usage: run_patch <patch file>" "run_patch";
 return 1;
 fi;
 clear_global_files;
 local pfile_raw="${1}";
 local pfile_uncomp="${1}";
 local list;
 local sub_pid1;
 local scs=0;
 chg_dir "${release_dir}/${tarball_base_name}" || return 1;
 if `${echo} ${pfile_raw} | ${grep} -q ".*\.gz"`; then
 pfile_uncomp="`${echo} ${pfile_raw} | ${sed} -e 's;\(^.*\)\.gz;\1;g'`";
 if [ ! -f "${patch_src_dir}/${pfile_uncomp}" ]; then
 if ! ${gunzip} ${patch_src_dir}/${pfile_raw}; then
 message "There was a problem uncompressing '${pfile_raw}'." "Patch Un-Compression";
 return 1;
 fi;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 clear;
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp};
 scs=$?;
 else
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp} &>${global_temp_file2} & sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --title "Patching ${tarball_base_name} (${pfile_raw})" --no-kill --tailboxbg ${global_temp_file2} 40 130 2> ${global_temp_file1};
 while file_empty ${global_temp_file1}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 scs=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file1}`;
 fi;
 ${sleep} 1;
 return ${scs}
}
make_temp_file => () {  local tmp_file;
 local scs=0;
 tmp_file=`${mktemp} -p /tmp lfs_script.XXXXXXXX`;
 trap "remove_file ${tmp_file}" SIGINT;
 if [ ! -z "${tmp_file}" ] && [ -f "${tmp_file}" ]; then
 ${echo} ${tmp_file};
 else
 scs=1;
 fi;
 trap - SIGINT;
 if [ ${scs} -eq 1 ]; then
 exit 1;
 else
 return ${scs};
 fi
}
check_owner => () {  local var1;
 local var2;
 local var3;
 if [ $# -ne 2 ]; then
 message "Usage: check_owner <user> <file/directory>" "check_owner";
 return 1;
 fi;
 var1=`${dirname} ${2}`;
 var2=`${echo} ${1} | ${sed} -e 's;${var1};;g'`;
 var3=`ls -n ${var1} | ${grep} ${var2} | ${sed} -e 's;^[a-zA-Z0-9-]\+\s\+[a-zA-Z0-9]\+\s\+\(.*$\);\1;g'`;
 if [ "${1}" == "${var3}" ]; then
 return 0;
 else
 return 1;
 fi
}
batch_program_listing => () {  program_selection "Select programs to install (batch mode)" "batch" "Add" $@ || return 1
}
make_title => () {  if [ $# -lt 1 ]; then
 message "Usage: make_title <type title>..." "make_title";
 return 1;
 fi;
 local c;
 local mt_length=${#gen_title};
 local ty_length=${#1};
 local var1=$(( mt_length + ty_length ));
 local max_wd=`stty size | cut -d" " -f2`;
 main_title="";
 if [ ${var1} -gt ${max_wd} ]; then
 main_title="${gen_title}";
 return 0;
 fi;
 var1=$(( max_wd - mt_length - ty_length - 2 ));
 local spaces="`${echo} ${var1} | bc`";
 main_title="${gen_title}";
 for ((c=1; c<=${spaces}; c++ ))
 do
 main_title="${main_title}+";
 done;
 main_title="${main_title}${1}";
 return 0
}
checksum_program_listing => () {  program_selection "Select a program to view/edit checksum" "checksum" "Select" $@ || return 1
}
check_profile_struc => () {  if [ $# -ne 1 ]; then
 message "Usage: check_profile_structure <profile dir>" "check_profile_struc";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 for h in "batch" "data" "scripts" "doc";
 do
 [ -d "${1}/${h}" ] || return 1;
 done;
 return 0
}
select_from_list => () {  if [ $# -lt 2 ]; then
 message "Usage: select_from_list <title> <list>" "select_from_list";
 return 1;
 fi;
 local command="";
 local title_sfl=${1};
 height=20;
 width=120;
 local list_height_sfl=20;
 calculate_dimensions;
 shift 1;
 make_title "List Selection";
 command="${dialog} --colors --backtitle \"${main_title}\" --ok-label \"Select\" --no-cancel     --radiolist \"${title_sfl}\" ${height} ${width} ${list_height_sfl}";
 for z in $@;
 do
 command="${command} \"${z}\" \"\" off";
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 selection=`${cat} ${global_temp_file1}`;
 if [ ${return_val} -eq 1 ] || { 
 [ ${return_val} -eq 0 ] && [ -z "${selection}" ]
 }; then
 return 1;
 else
 return 0;
 fi
}
find_file => () {  if [ $# -lt 1 ]; then
 message "Usage: find_file <file name> [path]" "find_file";
 return 1;
 fi;
 local local_path;
 local real_paths="";
 if [ -z "${2}" ]; then
 local_path=`${echo} ${PATH} | tr ":" " "`;
 else
 local_path="${2}";
 fi;
 for i in ${local_path};
 do
 [ -d "${i}" ] && real_paths="${real_paths} ${i}";
 done;
 real_paths=`${echo} ${real_paths} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"`;
 file_name_path=`${find} ${real_paths} -name "${1}"`;
 file_name_path="`${echo} ${file_name_path} | cut -d" " -f1`";
 if [ -z "${file_name_path}" ]; then
 return 1;
 else
 return 0;
 fi
}
get_dialog => () {  if [ $# -ne 1 ]; then
 message "Usage: get_dialog <file>" "get_dialog";
 return 1;
 fi;
 if ! check_for_file "${1}"; then
 message "Unable to find file used to set the dialog variable." "No-Dialog File Error";
 return 1;
 fi;
 if ${grep} -q "no_dialog" ${1}; then
 no_dialog=0;
 else
 no_dialog=1;
 fi;
 return 0
}
move_dir => () {  if [ $# -ne 2 ]; then
 message "Usage: move_dir <dir> <path to new name>" "move_dir";
 return 1;
 fi;
 if [ -d "${1}" ]; then
 local dest_dir;
 dest_dir="`${echo} ${2} | ${tr} ' ' '_'`";
 if ! ${mv} ${1} ${dest_dir} &>/dev/null; then
 :;
 else
 message "Directory renamed to ${dest_dir}." "Move Directory";
 fi;
 fi;
 return 0
}
kill_please_wait => () {  `${ps} -p ${please_wait_pid} &> /dev/null` && kill -SIGINT ${please_wait_pid};
 return 0
}

PHP Variables

Variable => Value
_SERVER["grep"] => /bin/grep
_SERVER["kill"] => /bin/kill
_SERVER["printf"] => /usr/bin/printf
_SERVER["HZ"] => 100
_SERVER["out_chroot_install_dir"] => /usr/src
_SERVER["basename"] => /usr/bin/basename
_SERVER["sources_dir"] => /home/yp58t/Sources
_SERVER["XORG_CONFIG"] => --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var
_SERVER["TEST_PHP_SRCDIR"] => /usr/src/php-5.4.1
_SERVER["no_patch_dialog"] => 1
_SERVER["SHELL"] => /bin/bash
_SERVER["chroot_flag"] => 1
_SERVER["batch_sec"] => 21
_SERVER["tail"] => /usr/bin/tail
_SERVER["TERM"] => screen.linux
_SERVER["MAKEFLAGS"] => 
_SERVER["chown"] => /bin/chown
_SERVER["HISTSIZE"] => 1000
_SERVER["SSH_CLIENT"] => deleted
_SERVER["please_wait_pid"] => 31351
_SERVER["install_dir"] => /usr/src
_SERVER["patch"] => /usr/bin/patch
_SERVER["HUSHLOGIN"] => FALSE
_SERVER["no_script_dialog"] => 1
_SERVER["fail_on_shasum"] => 1
_SERVER["SSH_TTY"] => deleted
_SERVER["etc_dir"] => /etc/takenset
_SERVER["return_val"] => 0
_SERVER["prog_src_dir"] => /home/yp58t/Sources/prog
_SERVER["release_dir"] => /usr/src
_SERVER["total_sec"] => 522
_SERVER["reqd_dir"] => 
_SERVER["prog_dir"] => /etc/takenset/blfs/data/php-5.4.1
_SERVER["got_level"] => 0
_SERVER["USER"] => yp58t
_SERVER["batch_file"] => /tmp/lfs_script.eKp3FNW7
_SERVER["xz"] => /usr/bin/xz
_SERVER["LS_COLORS"] => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
_SERVER["shasum"] => /usr/bin/shasum
_SERVER["global_time_file"] => /tmp/lfs_script.gRls6AQe
_SERVER["batch_hour"] => 0
_SERVER["SSH_AUTH_SOCK"] => deleted
_SERVER["head"] => /bin/head
_SERVER["TERMCAP"] => SC|screen.linux|VT 100/ANSI X3.64 virtual terminal:\
	:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
	:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
	:do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
	:le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
	:li#64:co#160:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
	:cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
	:im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
	:ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
	:ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
	:se=\E[23m:mb=\E[5m:md=\E[1m:mh=\E[2m:mr=\E[7m:\
	:me=\E[m:ms:\
	:Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
	:vb=\Eg:as=\E(0:ae=\E(B:\
	:ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
	:k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
	:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
	:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
	:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:kb=:\
	:K2=\E[G:kB=\E[Z:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:\
	:kN=\E[6~:kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:\
	:kr=\EOC:kl=\EOD:
_SERVER["run_dir"] => /etc/takenset/blfs/data/php-5.4.1/1
_SERVER["run"] => 1
_SERVER["prompt_value"] => 
_SERVER["MAKELEVEL"] => 1
_SERVER["height"] => 35
_SERVER["selection"] => 
_SERVER["MFLAGS"] => 
_SERVER["rm"] => /bin/rm
_SERVER["chmod"] => /bin/chmod
_SERVER["echo"] => /bin/echo
_SERVER["dirname"] => /usr/bin/dirname
_SERVER["batch_dir"] => /etc/takenset/blfs/batch
_SERVER["connect_pid"] => 16438
_SERVER["cat"] => /bin/cat
_SERVER["touch"] => /usr/bin/touch
_SERVER["PATH"] => /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/X11R6/bin
_SERVER["lib_dir"] => /usr/lib/takenset
_SERVER["MAIL"] => /var/mail/yp58t
_SERVER["tarball_is_local"] => 0
_SERVER["wget"] => /usr/bin/wget
_SERVER["STY"] => 23215.tty1.lfs
_SERVER["_"] => /usr/src/php-5.4.1/sapi/cli/php
_SERVER["mount"] => /bin/mount
_SERVER["check_signature"] => 1
_SERVER["sed"] => /bin/sed
_SERVER["main_title"] => Ta-Kenset - Profile: /etc/takenset/blfs+++++++++++++++++++++++++++++++++++++++++++++++++++++Releasing php-5.4.1.tar.bz2 (Started on April 28, 2012 @ 19:07:37)
_SERVER["sleep"] => /bin/sleep
_SERVER["PWD"] => /usr/src/php-5.4.1
_SERVER["lfs_user"] => yp58t
_SERVER["mv"] => /bin/mv
_SERVER["INPUTRC"] => /etc/inputrc
_SERVER["LIBXCB_ALLOW_SLOPPY_LOCK"] => 1
_SERVER["install_log"] => /etc/takenset/log/log_install
_SERVER["ps"] => /bin/ps
_SERVER["scripts_dir"] => /etc/takenset/blfs/scripts
_SERVER["width"] => 150
_SERVER["LANG"] => en_US
_SERVER["TEST_PHP_EXECUTABLE"] => /usr/src/php-5.4.1/sapi/cli/php
_SERVER["XORG_PREFIX"] => /usr
_SERVER["global_remove_ext_tb"] => 1
_SERVER["mktemp"] => /usr/bin/mktemp
_SERVER["sec"] => 21
_SERVER["profile"] => /etc/takenset/blfs
_SERVER["global_temp_file5"] => /tmp/lfs_script.qH0DiJm4
_SERVER["ping"] => /bin/ping
_SERVER["in_chroot_install_dir"] => /usr/src
_SERVER["mkdir"] => /bin/mkdir
_SERVER["cp"] => /bin/cp
_SERVER["global_temp_file4"] => /tmp/lfs_script.rXVIqxve
_SERVER["return_string"] => 
_SERVER["file_name_path"] => /home/yp58t/Sources/prog/php-5.4.1.tar.bz2
_SERVER["HISTIGNORE"] => &:[bf]g:exit
_SERVER["vi"] => /usr/bin/vi
_SERVER["global_temp_file6"] => /tmp/lfs_script.GJ53mnIW
_SERVER["global_temp_file1"] => /tmp/lfs_script.eseAAyNr
_SERVER["shasum_file"] => /etc/takenset/SHASUM
_SERVER["data_dir"] => /etc/takenset/blfs/data
_SERVER["HOME"] => /home/yp58t
_SERVER["SHLVL"] => 6
_SERVER["batch_flag"] => 1
_SERVER["chroot_dir"] => /mnt/lfs
_SERVER["batch_min"] => 4
_SERVER["tr"] => /usr/bin/tr
_SERVER["global_temp_file3"] => /tmp/lfs_script.9YDLo2Mg
_SERVER["global_temp_file2"] => /tmp/lfs_script.EPaFl0SK
_SERVER["cut"] => /usr/bin/cut
_SERVER["no_dialog"] => 0
_SERVER["dialog"] => /usr/bin/dialog
_SERVER["start_time"] => Started on April 28, 2012 @ 19:07:37
_SERVER["global_list"] => 
_SERVER["success"] => 1
_SERVER["sha_alg"] => 1
_SERVER["hour"] => 0
_SERVER["LOGNAME"] => yp58t
_SERVER["G_FILENAME_ENCODING"] => @locale
_SERVER["screen_fail"] => 0
_SERVER["min"] => 4
_SERVER["WINDOW"] => 2
_SERVER["tarball_base_name"] => php-5.4.1
_SERVER["SSH_CONNECTION"] => deleted
_SERVER["tar"] => /bin/tar
_SERVER["unzip"] => /usr/bin/unzip
_SERVER["PKG_CONFIG_PATH"] => :/usr/X11R6/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
_SERVER["global_no_dialog"] => 0
_SERVER["find"] => /bin/find
_SERVER["run_all_as_root"] => 1
_SERVER["CC"] => cc
_SERVER["gunzip"] => /bin/gunzip
_SERVER["return_val_file"] => /tmp/lfs_script.1PFeK9xp
_SERVER["init_user"] => yp58t
_SERVER["su"] => /bin/su
_SERVER["patch_src_dir"] => /home/yp58t/Sources/patch
_SERVER["gen_title"] => Ta-Kenset - Profile: /etc/takenset/blfs
_SERVER["md5sum"] => /usr/bin/md5sum
_SERVER["prog_list"] => php-5.4.1
_SERVER["clear"] => /usr/bin/clear
_SERVER["times_file"] => /etc/takenset/blfs/prog_times
_SERVER["single_program_listing"] => () {  program_selection "Select a program to install" "single" "Select" $@ || return 1
}
_SERVER["check_structure"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_structure <path to program directory>" "check_structure";
 fi;
 local parent_dir=`${dirname} ${1}`;
 local bn=`${basename} ${1}`;
 local directory;
 local file;
 for directory in ${1} ${1}/log;
 do
 if ! check_for_directory ${directory}; then
 message "Missing directory: ${directory}" "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 if ! check_for_file ${1}/${file}; then
 message "Missing file: ${file}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for j in mstr_conf df purl;
 do
 if [ ! -f "${parent_dir}/${j}" ]; then
 message "Missing file: ${j}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 return 0
}
_SERVER["check_connection"] => () {  if `${cat} /tmp/con_status* | ${grep} -q "u" -`; then
 return 0;
 else
 message "Your internet connection is down.  Aborting the installation" "Internet Connection Down";
 return 1;
 fi
}
_SERVER["save_log"] => () {  if [ $# -ne 2 ]; then
 message "Usage: save_log <prefix> <file to save>" "save_log";
 return 1;
 fi;
 if [ -z "${run_dir}" ] || [ ! -d "${run_dir}" ]; then
 message "Run directory for ${tarball_base_name} empty.  Logs for ${1} will not be saved." "Log Save Error";
 return;
 fi;
 if ! make_dir "${run_dir}/log"; then
 message "There was an error creating the log directory for ${tarball_base_name}!" "Log Directory Creation Error";
 return;
 fi;
 if ! make_file ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 ${echo} "Linux From Scratch, version ${profile}, log created on `date`." > ${run_dir}/log/${1};
 ${echo} "Created by user `whoami` (session initiated by ${init_user})" >> ${run_dir}/log/${1};
 ${echo} "" >> ${run_dir}/log/${1};
 if ! ${cat} ${2} >> ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 return
}
_SERVER["directory_writable"] => () {  if [ $# -ne 1 ]; then
 message "Usage: directory_writable <directory>" "directory_writable";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 if ${touch} ${1}/test 2> /dev/null; then
 remove_file ${1}/test;
 return 0;
 else
 message "Your permissions do not allow you to write to directory '${1}'." "Directory Not Writable";
 return 1;
 fi
}
_SERVER["remove_run_level"] => () {  if [ $# -ne 2 ]; then
 message "Usage: remove_run_level <tarball base name> <run level>" "remove_run_level";
 return 1;
 fi;
 local count=0;
 local list1="";
 local list2="";
 local scs=0;
 local dir1="" && export dir1;
 [ ! -d "${data_dir}/${1}" ] && return 0;
 list1="`ls ${data_dir}/${1}`";
 for i in ${list1};
 do
 [ "${i}" == "count" ] && continue;
 if are_digits ${i}; then
 count=$(( ++count ));
 fi;
 done;
 if [ ${count} -eq 0 ]; then
 message "There are no run-levels to display." "No Run-Levels";
 return 0;
 fi;
 while :; do
 if [ ${count} -eq 1 ]; then
 dir1="${data_dir}/${1}";
 if yesno_inquiry "Removal Of Data Directory: ${1}" "There is, at max, one run level for ${1}.  Delete the entire data directory?"; then
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${1}.\n\n";
 ${su} -c '(
              if ! remove_dir ${dir1}; then
                message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
                exit 5
              fi

              exit 0
            )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No data directory will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 else
 dir1="${data_dir}/${1}/${2}";
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${dir1}.\n\n";
 ${su} -c '(
            if ! remove_dir ${dir1}; then
              message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
              exit 5
            fi

            exit 0
          )';
 return_val=$?;
 if [ ${error_in_chroot} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No run level will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 break 1;
 done;
 unset dir1;
 return 0
}
_SERVER["remove_dups"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 var1_rd="";
 var2_rd="";
 global_list="";
 for i in $@;
 do
 var2_rd=0;
 var1_rd="`${echo} ${i} | cut -d: -f1`";
 for j in ${global_list};
 do
 if [ "${var1_rd}" == "`${echo} ${j} | cut -d: -f1`" ]; then
 var2_rd=1;
 break 1;
 fi;
 done;
 [ ${var2_rd} -eq 0 ] && global_list="${global_list} ${i}";
 done;
 [ -z "${global_list}" ] && return 1;
 return 0
}
_SERVER["create_structure"] => () {  if [ $# -lt 1 ]; then
 message "Usage: create_structure <path to tarball> [run level]" "create_structure";
 fi;
 run=1;
 [ ! -z "${2}" ] && run=${2};
 [ -z "${tarball_name}" ] && tarball_name=`${basename} ${1}`;
 [ -z "${tarball_base_name}" ] && return 1;
 local sub_pid1;
 height=15;
 width=90;
 calculate_dimensions;
 ${echo} "Creating file structure for ${tarball_base_name}..." > ${global_temp_file1};
 make_title "Create Program Structure";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 success=1;
 while :; do
 for dir in "${tarball_base_name}" "${tarball_base_name}/${run}" "${tarball_base_name}/${run}/log";
 do
 if ! check_for_directory "${data_dir}/${dir}"; then
 if ! make_dir "${data_dir}/${dir}"; then
 break 2;
 fi;
 fi;
 done;
 ${touch} "${data_dir}/${tarball_base_name}/mstr_conf" || break 1;
 move ${1} ${prog_src_dir} || break 1;
 for file in "df" "tb_name" "purl" "checksum";
 do
 make_file "${data_dir}/${tarball_base_name}/${file}" || break 2;
 [ "${file}" == "tb_name" ] && ${echo} "${tarball_name}" > ${data_dir}/${tarball_base_name}/${file};
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 make_file "${data_dir}/${tarball_base_name}/${run}/${file}" || break 2;
 done;
 success=0;
 ${echo} "Successfully created structure for ${tarball_base_name}." >> ${global_temp_file1};
 break 1;
 done;
 if [ ${success} -eq 1 ]; then
 ${echo} "There was an error creating the structure for ${tarball_base_name}." >> ${global_temp_file1};
 fi;
 sleep 2;
 while file_empty ${global_temp_file2}; do
 sleep 1;
 done;
 sub_pid1=`${cat} ${global_temp_file2}`;
 kill_proc ${sub_pid1} || return 1;
 return ${success}
}
_SERVER["verify_tarball_url"] => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_tarball_url <url1>" "verify_tarball_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\|https\)://.*\(bz2\|zip\|gz\|tgz\|zip\|xz\)$"; then
 return 0;
 else
 message "The supplied URL is invalid." "Invalid Program URL";
 return 1;
 fi
}
_SERVER["compress_log"] => () {  [ ! -f "${1}" ] && return;
 local file="`${basename} ${1}`";
 local dir="`${dirname} ${1}`";
 cd ${dir};
 [ -f "${file}.tar.bz2" ] && remove_file "${file}.tar.bz2" &>/dev/null;
 ${tar} -cjf "${file}.tar.bz2" --remove-files ${file} &>/dev/null;
 return $?
}
_SERVER["sec_to_time"] => () {  if [ $# -ne 1 ]; then
 message "Usage: sec_to_time <seconds>" "sec_to_time";
 return 1;
 fi;
 local var1="";
 local t_sec=0;
 total_sec=${1};
 batch_hour=0;
 batch_min=0;
 batch_sec=0;
 total_min=$(${echo} "scale=5; ${total_sec}/60" | bc);
 batch_min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${batch_min}" ] && batch_min=0;
 t1="`${echo} ${batch_min}*60 | bc`";
 batch_sec="$(${echo} ${total_sec}-${t1} | bc)";
 if [ ${batch_min} -ge 60 ]; then
 batch_hour=`${echo} "scale=5; ${batch_min}/60" | bc`;
 batch_hour=`${echo} ${batch_hour} | cut -d"." -f1`;
 t1=`${echo} "${batch_hour}*60" | bc`;
 batch_min=`${echo} "${batch_min}-${t1}" | bc`;
 fi;
 return 0
}
_SERVER["chg_dir"] => () {  if cd ${1}; then
 return 0;
 else
 message "Unable to change to directory ${1}" "Change Directory";
 return 1;
 fi
}
_SERVER["check_sig_patch"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_patch <file list>" "check_sig_patch";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 tb_name="`${echo} ${line} | ${cut} -d: -f1`";
 run="`${echo} ${line} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${tb_name}/${run}/patch_list && continue;
 if [ ${flag} -eq 0 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Patch" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 flag=$(( ++flag ));
 fi;
 for base_name in `${cat} ${data_dir}/${tb_name}/${run}/patch_list`;
 do
 `${echo} ${base_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 if ! find_file ${base_name} ${patch_src_dir}; then
 ${echo} "Unable to find patch, ${base_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 2;
 fi;
 ${echo} "Checking signature for patch ${base_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${grep} -m1 ${base_name} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 3;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 ${echo} "MD5: signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 break 1;
 done;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_SERVER["release_tarball"] => () {  if [ $# -lt 3 ]; then
 message "Usage: release_tarball <path to tarball source> <install dir> <removal flag> [append commands]" "release_tarball";
 return 1;
 fi;
 local sub_pid1;
 local command;
 local scs=1;
 local location="${2}/${tarball_base_name}";
 export location;
 return_val=0;
 if [ -d "${location}" ]; then
 remove_dir ${location};
 if [ $? -ne 0 ]; then
 if yesno_inquiry "Base-Directory Deletion" "Would you like to escalate your privileges and remove the base-directory '${tarball_base_name}'?"; then
 while true; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed with directory removal ***\n";
 ${su} -c '(
            remove_dir ${location} || exit 5

            exit 0
          )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 message "Removal of the directory, ${tarball_base_name}, was unsuccessful.  Aborting install." "Directory Removal Error";
 return 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 ontinue;
 else
 message "Privilege escalation was necessary to delete directory ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 else
 scs=0;
 fi;
 fi;
 break 1;
 done;
 else
 message "You elected not to delete the base-directory for ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 fi;
 fi;
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.bz2$"`; then
 command="${tar} --directory=${2} -xvjf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.gz$" -e "^.*\.tgz$"`; then
 command="${tar} --directory=${2} -xvzf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.lzma$"`; then
 command="${tar} --directory=${2} --lzma -xvf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.xz$"`; then
 xz_file="`${basename} ${1}`";
 tar_file="`${echo} ${xz_file} | ${sed} -e 's;\.xz;;g'`";
 command="copy ${1} ${2} && cd ${2} && ${xz} -d ${xz_file} && tar -xvf ${tar_file} && remove_file ${tar_file}";
 unset xz_file tar_file;
 else
 if `${echo} ${1} | ${grep} -q "^.*\.zip$"`; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 command="${unzip} -d ${2} ${1}";
 else
 command="${unzip} -d ${2}/${tarball_base_name} ${1}";
 fi;
 else
 message "Unable determine how to uncompress package, ${1}" "Uncompress Failure";
 return 1;
 fi;
 fi;
 fi;
 fi;
 fi;
 height=35;
 width=150;
 calculate_dimensions;
 eval ${command} > ${global_temp_file1} 2>&1 & sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Releasing ${tarball_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Releasing ${tarball_name} ($start_time)";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Unpacking ${tarball_base_name} into \Z1${2}\Zn... - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 kill_proc `${cat} ${global_temp_file2}`;
 ${sleep} 1;
 if [ ${return_val} -ne 0 ]; then
 message "Error uncompressing ${tarball_base_name}" "Uncompress Failure";
 return 1;
 fi;
 return 0
}
_SERVER["check_remote_file_exists"] => () {  if [ $# -ne 1 ]; then
 message "check_remote_file_exists <url>" "check_remote_file_exists";
 return 1;
 fi;
 local pid1;
 check_connection || return 1;
 ${wget} -v --tries 2 --timeout=40 --spider ${1} &>${global_temp_file3} & pid1=$!;
 wait ${pid1};
 return_val=$?;
 [ ${return_val} -ne 0 ] && return 1;
 ${grep} -iq -e "No such file" -e "unable to resolve" -e "HTTP_NOT_FOUND" -e "Invalid PORT" -e "Remote file does not exist" -e "not retrieving" ${global_temp_file3};
 return_val=$?;
 [ ${return_val} -eq 0 ] && return 1;
 return 0
}
_SERVER["chg_file_owner"] => () {  if [ $# -ne 2 ]; then
 message "Usage: chg_file_owner <new owner> <file>" "chg_file_owner";
 return 1;
 fi;
 if ! ${chown} "${1}:${1}" "${2}"; then
 message "There was an error changing ownership of file ${2} to ${1}." "Message";
 fi
}
_SERVER["display_batch_list"] => () {  if [ $# -eq 0 ]; then
 make_title "Batch List Display";
 ${dialog} --backtitle "${main_title}" --colors --infobox "\Z1Batch list is empty.\Zn" 8 60 1>&0;
 sleep 2;
 return 0;
 fi;
 local command;
 local file2_dbl;
 local description_dbl;
 local count=0;
 height=20;
 width=130;
 calculate_dimensions;
 make_title "Batch List Display";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"Remove\" --cancel-label \"Prev\"     --extra-button --extra-label \"Clear\" --menu \"Current batch list\" ${height} ${width} ${height} ";
 for i in $@;
 do
 count=$(( ++count ));
 if `${echo} ${i} | ${grep} -iq "script:"`; then
 file2_dbl="`${echo} ${i} | cut -d: -f2 | ${sed} -e 's;^\s+;;g'`";
 description_dbl="`${cat} ${file2_dbl} | ${grep} -i "^#Desc:.*" | ${sed} -e 's;^#Desc:;;g'`";
 [ -z "${description_dbl}" ] && description_dbl="No description";
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  `${basename} ${i}`\" \"SCRIPT: ${description_dbl}\" ";
 else
 file2_dbl="${data_dir}/${i}/df";
 if ! file_empty ${file2_dbl}; then
 description_dbl=`${cat} ${file2_dbl}`;
 else
 description_dbl="No description";
 fi;
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  ${i}\" \"${description_dbl}\" ";
 fi;
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return $?
}
_SERVER["main_window"] => () {  height=35;
 width=100;
 calculate_dimensions;
 make_title "Main Selection Window";
 command="${dialog} --backtitle \"${main_title}\" --cancel-label \"Exit\" ";
 command="${command} --menu \"What would you like to do?\n\" ${height} ${width} 50 \"Install\" \"Configure & Install A Program\" ";
 command="${command} \"Check Config\" \"Review Program Configuration\" ";
 command="${command} \"Get Program\" \"Download New Program & Create Directory Structure\" ";
 command="${command} \"Create Batch\" \"Create A Batch File\" ";
 command="${command} \"Edit Batch\" \"Edit A Batch File\" ";
 command="${command} \"Run Batch\" \"Load An Existing Batch File\" ";
 command="${command} \"Edit MD5/SHA Checksum\" \"Edit File Signatures\" ";
 if [ -f "${profile}/requisites" ]; then
 command="${command} \"Version Check\" \"Host System Program Requirement Versions\" ";
 fi;
 command="${command} \"Variables\" \"View & Set Variables\" ";
 command="${command} \"Scripts\" \"Run & Edit Scripts\" ";
 command="${command} \"Shell\" \"Run shell\"";
 command="${command} \"About\" \"\"";
 eval ${command} 2> ${global_temp_file5};
 return $?
}
_SERVER["script_options"] => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options <file>" "script_options";
 return 1;
 fi;
 local command;
 selection="";
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Options";
 get_time "`${basename} ${1}`" "-";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '${1}' Options (Run Time: ${hour}h ${min}m ${sec}s)\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Execute\" \"\" off";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"Move File\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
_SERVER["copy"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 if [ -d "${1}" ]; then
 ${cp} -r "${1}" "${2}";
 else
 if [ -f "${1}" ]; then
 ${cp} "${1}" "${2}";
 fi;
 fi;
 if [ $? -eq 1 ]; then
 message "Unable to copy ${1} to ${2}." "Copy Error";
 return 1;
 fi;
 return 0
}
_SERVER["retrieve_pkg"] => () {  if [ $# -ne 2 ]; then
 message "Usage: retrieve_pkg <url> <install dir>" "retrieve_pkg";
 return 1;
 fi;
 height=20;
 width=135;
 calculate_dimensions;
 local sub_pid1;
 clear_global_files;
 ${echo} "Retrieving file ${1}..." > ${global_temp_file3};
 ${echo} "" >> ${global_temp_file3};
 make_title "Retrieving ${1}";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Retrieval Of ${1}" --no-kill --tailboxbg "${global_temp_file3}" ${height} ${width} 2> ${global_temp_file4};
 while file_empty ${global_temp_file4}; do
 ${sleep} 1;
 done;
 fi;
 ${wget} -v --timeout=30 --directory-prefix=${2} -o /dev/null ${1} & sub_pid1=$!;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file4}`;
 if [ ${return_val} -ne 0 ]; then
 message "Failed to download `${basename} ${1}` at ${1}" "Download Failure";
 fi;
 return 0
}
_SERVER["get_time"] => () {  if [ $# -ne 2 ]; then
 message "Usage: get_time <search-for name> <run level or '-' for script>" "get_time";
 return 1;
 fi;
 local t1=0;
 local total_min=0;
 local t_sec=0;
 local line;
 hour=0;
 min=0;
 sec=0;
 [ ! -f "${times_file}" ] && return 0;
 if [ "${2}" == "-" ]; then
 line=`${grep} "^${1}:-.*" ${times_file}`;
 else
 if [ "${2}" != "-" ]; then
 line=`${grep} "^${1}:${2}.*" ${times_file}`;
 else
 return;
 fi;
 fi;
 [ -z "${line}" ] && return 0;
 t_sec="`${echo} ${line} | cut -d: -f3`";
 total_sec=$(( total_sec + t_sec ));
 [ ${total_sec} -eq 0 ] && return;
 total_min=$(${echo} "scale=5; ${t_sec}/60" | bc);
 min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${min}" ] && min=0;
 t1="`${echo} ${min}*60 | bc`";
 sec="$(${echo} ${t_sec}-${t1} | bc)";
 if [ ${min} -ge 60 ]; then
 hour=`${echo} "scale=5; ${min}/60" | bc`;
 hour=`${echo} ${hour} | cut -d"." -f1`;
 t1=`${echo} "${hour}*60" | bc`;
 min=`${echo} "${min}-${t1}" | bc`;
 fi;
 return
}
_SERVER["global_script_run_root"] => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run_root <path to script> <title>" "global_script_run_root";
 return 1;
 fi;
 local scs=0;
 local return_val=0;
 export path=${1};
 export title=${2};
 if ! root; then
 while :; do
 ${clear};
 ${echo} "*** Enter root password to proceed with installation of ${title} ***";
 ${su} -c '(
        global_script_run "${path}" "${title}" || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 if ! global_script_run "${path}" "${title}"; then
 return_val=1;
 fi;
 fi;
 export -n path title error_in_chroot;
 return ${return_val}
}
_SERVER["yesno_inquiry"] => () {  if [ $# -ne 2 ]; then
 message "Usage: yesno_inquiry <title> <prompt>" "yesno_inquiry";
 return 1;
 fi;
 make_title "Inquiry";
 ${dialog} --backtitle "${main_title}" --colors --title "${1}" --yesno "${2}" 15 100;
 [ $? -eq 1 ] && return 1;
 return 0
}
_SERVER["global_script_run"] => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run <path to script> <title>" "global_script_run";
 return 1;
 fi;
 declare -i j=0;
 local var1;
 local sub_pid1;
 local sub_pid2;
 local env_cmd="";
 var1=${2};
 check_for_directory "${release_dir}/${tarball_base_name}" || return 1;
 make_executable_file ${global_temp_file2} || return 1;
 if `${grep} -q "#build" ${prog_dir}/mstr_conf`; then
 if ! check_for_directory "${release_dir}/${tarball_base_name}/build"; then
 make_dir "${release_dir}/${tarball_base_name}/build" || return 1;
 fi;
 ${echo} -e "cd ${install_dir}/${tarball_base_name}/build\n" > ${global_temp_file2};
 else
 ${echo} -e "cd ${install_dir}/${tarball_base_name}\n" > ${global_temp_file2};
 fi;
 ${cat} ${1} >> ${global_temp_file2};
 height=35;
 width=150;
 calculate_dimensions;
 if `${grep} -m1 -q "^#pre_lfs" ${run_dir}/conf`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 ${clear};
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 else
 ${clear};
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 fi;
 kill ${tail_pid};
 else
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} | tee ${global_temp_file1} &
 else
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} &
 fi;
 else
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${global_temp_file2} | tee ${global_temp_file1} &
 else
 ${global_temp_file2} &>${global_temp_file1} &
 fi;
 fi;
 sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "${var1} Of ${tarball_base_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "${var1} Of ${tarball_base_name} (${start_time})";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Run level ${run} - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file3};
 while file_empty ${global_temp_file3}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 ${sleep} 2;
 return_val=$?;
 kill_proc `${cat} ${global_temp_file3}`;
 fi;
 if [ ${return_val} -eq 0 ]; then
 ${sleep} 2;
 else
 ${sleep} 3;
 fi;
 ${rm} -f ${chroot_dir}/tmp/lfs* &>/dev/null;
 if [ ${return_val} -ne 0 ]; then
 return 1;
 else
 return 0;
 fi
}
_SERVER["are_digits"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 if `${echo} ${1} | ${grep} -q -e "\." -e "[^0-9]"`; then
 return 1;
 else
 return 0;
 fi
}
_SERVER["calculate_dimensions"] => () {  local value;
 local max_ht=0;
 local max_wd=0;
 value=`stty size`;
 max_ht=`${echo} ${value} | cut -d" " -f1`;
 max_wd=`${echo} ${value} | cut -d" " -f2`;
 max_ht=$(( max_ht - 10 ));
 max_wd=$(( max_wd - 10 ));
 [ ${height} -le ${max_ht} ] || height=${max_ht};
 [ ${width} -le ${max_wd} ] || width=${max_wd};
 return 0
}
_SERVER["check_sig_rpkg"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_rpkg <file list>" "check_sig_rpkg";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local rp_name;
 local sig1;
 local sig2;
 local list;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 run="`${echo} ${line} | ${cut} -d: -f2`";
 prog="`${echo} ${line} | ${cut} -d: -f1`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Required Tarballs For ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 list="`${cat} ${data_dir}/${prog}/${run}/rpkg`";
 for rp_name in ${list};
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 if ! find_file ${rp_name} ${prog_src_dir}; then
 ${echo} "Unable to find required package ${rp_name}..." > ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Checking ${rp_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} -m1 ${rp_name} ${data_dir}/${prog}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${rp_name}\" ${data_dir}/${prog}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 ${sleep} 2;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 flag=0;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 [ ${error} -eq 0 ] && break 1;
 done;
 ${sleep} 1;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_SERVER["get_tarball_base_from_tb"] => () {  if [ $# -gt 2 ]; then
 message "Usage: get_tarball_base_from_tb <path to tarball> [remove tmp file]" "get_tarball_base_from_tb";
 return 1;
 fi;
 rm_file=${2:-0};
 local sub_pid1;
 if [ ! -e "${1}" ]; then
 message "Unable to find tarball `${basename} ${1}`." "Tarball Find Failure";
 return 1;
 fi;
 local scs=0;
 while :; do
 if ${echo} "${1}" | ${grep} -q -e "^.*xz$"; then
 bn="`${basename} ${1}`";
 bu="${bn}.bk";
 [ ! -f "/tmp/${bn}" ] && copy ${1} /tmp;
 copy "${1}" "/tmp/${bu}";
 ${xz} -d "/tmp/${bn}";
 bn="`${echo} ${bn} | ${sed} -e 's;\.xz$;;g'`";
 ${tar} -t -f /tmp/${bn} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 remove_file "/tmp/${bn}";
 if [ ${rm_file} -eq 0 ]; then
 remove_file "/tmp/${bu}" || return 1;
 else
 move "/tmp/${bu}" "/tmp/${bn}.xz" || return 1;
 fi;
 else
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 ${unzip} -l ${1} &>${global_temp_file1};
 else
 ${tar} -t -f ${1} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 fi;
 fi;
 if `file_empty ${global_temp_file1}`; then
 message "Unable to get tarball base name from temporary file for `${basename} ${1}`." "Tarball Base Name Retrieval";
 scs=1;
 break 1;
 fi;
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 tarball_base_name="`${echo} ${temp_name} | ${sed} -e 's;\(^.*\)\/;\1;g'`";
 else
 tarball_base_name="`${basename} ${1} | ${sed} -e 's;\(^.*\)\.zip;\1;g'`";
 fi;
 else
 tarball_base_name=`${grep} -m1 "\(^[^/]\+\)\/.*$" ${global_temp_file1} | ${sed} -e 's;\(^[^/]\+\)\/.*$;\1;g'`;
 fi;
 tarball_base_name="`${echo} ${tarball_base_name} | tr ' ' '_'`";
 break 1;
 done;
 return ${scs}
}
_SERVER["batch_program_and_script_screen"] => () {  if [ $# -lt 1 ]; then
 message "Usage: batch_program_and_script_screen <prog_list>" "batch_program_and_script_screen";
 return 1;
 fi;
 prog_list="";
 old_prog_list="";
 local count_bp=0;
 local selection_bpss;
 while :; do
 height=10;
 width=65;
 calculate_dimensions;
 make_title "Batch Script Selection";
 ${dialog} --backtitle "${main_title}" --no-cancel --radiolist "Select either programs or scripts to add to the batch list" ${height} ${width} ${height} "Add program(s)" "" off "Add script(s)" "" off "View Current List" "" off 2> ${global_temp_file4};
 return_val=$?;
 selection_bpss="`${cat} ${global_temp_file4}`";
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && [ -z "${selection_bpss}" ] && return 0;
 case ${selection_bpss} in 
 "Add program(s)")
 while :; do
 please_wait;
 old_prog_list=${prog_list};
 batch_program_listing $@;
 return_val=$?;
 if [ ! -z "${prog_list}" ]; then
 prog_list="${old_prog_list} ${prog_list}";
 else
 prog_list="${old_prog_list}";
 fi;
 kill_please_wait;
 [ $return_val -eq 1 ] && break 1;
 done
 ;;
 "Add script(s)")
 local y;
 local directory_bpss="";
 local scripts_bpss="";
 local script_bpss="";
 y=`ls ${scripts_dir}`;
 if [ ! -z "$y" ]; then
 while :; do
 select_from_list "Select a script directory" `ls ${scripts_dir}` || break 1;
 directory_bpss=${selection};
 scripts_bpss=`ls ${scripts_dir}/${directory_bpss}`;
 if [ -z "${scripts_bpss}" ]; then
 message "No scripts to select!" "No Scripts Found";
 continue;
 fi;
 select_from_list "Select a script" ${scripts_bpss} || continue;
 script_bpss=${selection};
 [ -z "${script_bpss}" ] && continue;
 ${echo} "script:${scripts_dir}/${directory_bpss}/${script_bpss}" >> ${batch_file};
 prog_list="${prog_list} script:${scripts_dir}/${directory_bpss}/${script_bpss}";
 break 1;
 done;
 else
 message "No script directories to select!" "No Script Directories Found";
 fi;
 unset y
 ;;
 "View Current List")
 display_batch_list ${prog_list};
 case $? in 
 0)
 if [ ! -z "${prog_list}" ]; then
 remove_prog=`${cat} ${global_temp_file1}`;
 [ -z "remove_prog" ] && continue;
 line_no=${remove_prog:0:1};
 remove_prog=`${echo} ${remove_prog} | cut -d" " -f2`;
 if yesno_inquiry "Confirm Removal" "Are you sure that you want to remove the entry '${remove_prog}'?"; then
 old_prog_list=${prog_list};
 prog_list="";
 count_bp=1;
 for j in ${old_prog_list};
 do
 [ $(( count_bp++ )) -eq ${line_no} ] && continue;
 prog_list="${prog_list} ${j}";
 done;
 if [ -f "${batch_file}" ]; then
 eval ${sed} -i "${line_no}d" ${batch_file};
 else
 message "Unable to locate the batch file!" "Batch File Error";
 return 1;
 fi;
 fi;
 unset remove_prog old_prog_list;
 fi
 ;;
 3)
 if yesno_inquiry "Confirm Clearing Of List" "Are you sure that you want to clear the batch list?"; then
 prog_list="";
 clear_file "${global_temp_file1}" || return 1;
 clear_file "${batch_file}" || return 1;
 fi
 ;;
 esac
 ;;
 esac;
 done
}
_SERVER["download_prog"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_prog <program list>" "download_prog ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local scs;
 local found;
 local list1="";
 local list2="";
 local command="";
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 scs=1;
 found=1;
 tarball_name="";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 if ! file_empty ${data_dir}/${prog}/tb_name; then
 tarball_name=`${cat} ${data_dir}/${prog}/tb_name`;
 if [ ! -z "${tarball_name}" ]; then
 tarball_in_string ${tarball_name};
 scs=0;
 fi;
 fi;
 if [ ${scs} -eq 1 ]; then
 list1="`${grep} ${prog} ${shasum_file}`";
 z=0;
 for i in ${list1};
 do
 if `${echo} ${i} | ${grep} -q "${prog}\.\(tar\|tzg\|zip\|xz\|lzma\).*"`; then
 list2="${list2} ${i}";
 else
 continue;
 fi;
 z=$(( ++z ));
 done;
 if [ ${z} -gt 1 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Choose A Tarball For Installation";
 command="${dialog} --backtitle \"${main_title}\" --menu \"Select the tarball to use\" ${height} ${width} ${height}";
 z=1;
 for i in ${list};
 do
 command="${command} \"${z}. ${i}\" \"\"";
 z=$(( ++z ));
 done;
 eval ${command} 2> ${global_temp_file1};
 tarball_name="`${cat} ${global_temp_file1} | ${cut} -d\" \" -f2`";
 else
 tarball_name="${list2}";
 fi;
 unset z;
 if [ ! -z "${tarball_name}" ]; then
 [ ! -f "${data_dir}/${prog}/tb_name" ] && ${touch} "${data_dir}/${prog}/tb_name";
 ${echo} "${tarball_name}" > "${data_dir}/${prog}/tb_name";
 fi;
 fi;
 if [ -z "${tarball_name}" ]; then
 message "Unable to set tarball name for ${prog}." "Unable To Set Tarball Name";
 return 1;
 fi;
 tarball_name="`trim_spaces ${tarball_name}`";
 if find_file ${tarball_name} ${prog_src_dir}; then
 path="${file_name_path}";
 [ ! -z "${path}" ] && found=0;
 fi;
 if [ ${found} -eq 1 ]; then
 if ! file_empty "${profile}/mstr_urls"; then
 scs=1;
 height=20;
 width=120;
 list1="";
 calculate_dimensions;
 check_connection || return 1;
 ${echo} "Searching for ${tarball_name}..." > ${global_temp_file1};
 make_title "Tarball Search For ${tarball_name}";
 ${dialog} --backtitle "${main_title}" --title "Tarball Search For ${tarball_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;\(^.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 for line in ${list1};
 do
 `${echo} ${line} | ${grep} -iq -e "^#.*$" -e "^$" -` && continue;
 url="`${echo} ${line}/${tarball_name}`";
 if verify_tarball_url "${url}"; then
 ${echo} "Searching at ${line}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Found at ${url}..." >> ${global_temp_file1};
 ${sleep} 2;
 found=0;
 ${echo} "${line}" > "${data_dir}/${prog}/purl";
 break 1;
 fi;
 fi;
 done;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 else
 scs=0;
 fi;
 if [ ${scs} -eq 1 ] && [ ${found} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${line}/${tarball_name}" /tmp; then
 message "Unable to download ${name} from ${line}" "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 while :; do
 prompt_for_value "Program URL" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${tarball_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 return 1;
 fi;
 fi;
 break 1;
 done;
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 if check_remote_file_exists "${prompt_value}"; then
 located=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 tarball_name=`${basename} ${prompt_value}`;
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && ${echo} "${url_dir}" >> ${profile}/mstr_urls;
 ${echo} "${url_dir}" > "${data_dir}/${prog}/purl";
 fi;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 if [ ${located} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${prompt_value}" /tmp; then
 message "Unable to download ${tarball_name} from ${url_dir}." "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 fi;
 done;
 return 0
}
_SERVER["log_viewer"] => () {  if [ $# -ne 2 ]; then
 message "Usage: log_viewer <tarball base name> <run level>" "log_viewer";
 return 1;
 fi;
 local scs=0;
 while :; do
 [ ! -d "${data_dir}/${1}/${2}/log" ] && message "Unable to find log directory for ${1}." "No Log Directory" && return 1;
 local list1="`ls ${data_dir}/${1}/${2}/log`";
 if [ -z "${list1}" ]; then
 message "There are no log files to view for ${1} (run level ${2})." "No Log Files";
 break 1;
 fi;
 local command="";
 make_title "Log File Viewer";
 command="${dialog} --colors --backtitle \"${main_title}\" --title \"${1} - run level: ${run}\" --cancel-label \"Prev\"       --radiolist \"Log files for ${1}\" 20 90 20";
 for i in ${list1};
 do
 command="${command} \"${i}\" \"\" \"off\"";
 done;
 eval ${command} 2> ${global_temp_file2};
 return_val=$?;
 if [ ${return_val} -ne 0 ] || file_empty ${global_temp_file2}; then
 break 1;
 else
 local file="`${cat} ${global_temp_file2}`";
 local file2="";
 [ -z "${file}" ] && return 1;
 if ! check_for_file "${data_dir}/${1}/${2}/log/${file}"; then
 message "Unable to find log file '${file}'." "Log File Not Found";
 scs=1;
 break 1;
 fi;
 if `${echo} $file | ${grep} -q ".*bz2$"`; then
 file2="`${echo} $file | ${sed} -e 's;\.tar\.bz2;;g' -e 's;\.old;;g'`";
 ${tar} -C /tmp -xjf "${data_dir}/${1}/${2}/log/${file}";
 else
 message "Unknown extension; unable to extract log data for ${1}." "Extraction Error";
 scs=1;
 break 1;
 fi;
 if [ ! -f "/tmp/${file2}" ]; then
 message "Failed to locate the uncompressed log file in the tmp directory." "Log File Not Found";
 scs=1;
 break 1;
 else
 if ! edit_file "/tmp/${file2}" "1"; then
 message "There was an error editing the file, '${file}', for ${1}." "File Edit Error";
 fi;
 fi;
 remove_file "/tmp/${file2}";
 fi;
 done;
 return ${scs}
}
_SERVER["file_empty"] => () {  if [ $# -ne 1 ]; then
 message "Usage: file_empty <path to file>" "file_empty";
 return 1;
 fi;
 local var1;
 [ ! -e "${1}" ] && return 0;
 var1=`${cat} ${1}`;
 [ -z "${var1}" ] && return 0;
 unset var1;
 return 1
}
_SERVER["update_time"] => () {  if [ $# -ne 3 ]; then
 message "Usage: update_time <tarball base name or script name> <run level (or - for script)> <new_time>" "update_time";
 return 1;
 fi;
 local sec=${3};
 [ ! -f "${times_file}" ] && ${touch} ${times_file};
 sec=$(( sec + 0 ));
 if [ "${2}" == "-" ]; then
 if `${grep} -q ${1}:-:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:-:.*$;${1}:-:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:-:${sec}" >> ${times_file} || return 1;
 fi;
 else
 if `${grep} -q ${1}:${2}:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:${2}:.*$;${1}:${2}:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:${2}:${sec}" >> ${times_file} || return 1;
 fi;
 fi;
 return 0
}
_SERVER["get_run_level"] => () {  if [ $# -ne 1 ]; then
 message "Usage: get_run_level <program name>" "get_run_level";
 return 1;
 fi;
 local var1_grl=${1};
 local list1_grl="";
 local list2_grl="";
 local command="";
 local count=0;
 local desc="";
 list1_grl=`ls ${data_dir}/${var1_grl}`;
 for i in ${list1_grl};
 do
 [ "${i}" == "list1_grl" ] && continue;
 ! are_digits "${i}" && continue;
 list2_grl="${list2_grl} ${i}" && count=$(( ++count ));
 done;
 [ -z "${list2_grl}" ] && return 1;
 if [ ${count} -le 1 ]; then
 run=1;
 return 0;
 else
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 command="${dialog} --backtitle \"${gen_title}\" --no-cancel --ok-label \"Submit\" --title \"Multiple run levels found for ${var1_grl}\"         --radiolist \"Select a run level\" ${height} ${width} 20 ";
 for i in ${list2_grl};
 do
 desc="`${grep} '^#Desc:.*$' ${data_dir}/${var1_grl}/${i}/conf`";
 if [ ! -z "${desc}" ]; then
 desc="`${echo} ${desc} | ${sed} -e 's;^#Desc:\ *\(.*$\);\1;g'`";
 else
 desc="No Description Found";
 fi;
 desc="${desc:0:255}";
 command="${command} \"${i}\" \"${desc}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && file_empty ${global_temp_file1} && break 1;
 if ! file_empty ${global_temp_file1}; then
 run=`${cat} ${global_temp_file1}`;
 break 1;
 fi;
 done;
 [ -z "${run}" ] && run=1;
 return 0;
 fi
}
_SERVER["add_addl_run_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: add_addl_run_dir <program base name>" "add_addl_run_dir";
 fi;
 yesno_inquiry "Add Run Directory" "You chose to add an additional run-level.  Is this correct?" || return 1;
 local success=1;
 local make_copy=0;
 local next=0;
 current=0 && export current;
 highest_run_level ${1} || return 1;
 next=$((current+1));
 if yesno_inquiry "Copy Directory" "Would you like to copy the most recent run level (${current}) to the new run level (${next})?"; then
 make_copy=0;
 else
 make_copy=1;
 fi;
 height=20;
 width=120;
 calculate_dimensions;
 case ${make_copy} in 
 "0")
 ${echo} "Copying file structure for ${tarball_base_name}..." > ${global_temp_file1}
 ;;
 "1")
 ${echo} "Creating file structure for ${tarball_base_name}, run-level ${next}..." > ${global_temp_file1}
 ;;
 esac;
 ${echo} "" >> ${global_temp_file1};
 make_title "Additional Run Level";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 case ${make_copy} in 
 "0")
 if ! copy "${prog_dir}/${current}" "${prog_dir}/${next}"; then
 ${echo} "An error occurred copying data to the new run level!" >> ${global_temp_file1};
 else
 ${echo} "Copied run level ${current} to new run level ${next} for ${1}..." >> ${global_temp_file1};
 success=0;
 fi
 ;;
 "1")
 while :; do
 for dir in "${prog_dir}/${next}" "${prog_dir}/${next}/ef" "${prog_dir}/${next}/log";
 do
 if ! check_for_directory "${dir}"; then
 make_dir "${dir}" || break 2;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "ip" "mf" "mi" "make_check_test" "pf" "rpkg" "patch_list" "conf";
 do
 make_file "${prog_dir}/${next}/${file}" || break 2;
 done;
 success=0;
 break 1;
 done;
 if [ ${success} -eq 0 ]; then
 ${echo} "Creation of run-level ${next} for ${tarball_base_name} successful..." >> ${global_temp_file1};
 else
 if [ ${success} -eq 1 ]; then
 ${echo} "An error occurred in the creation of run-level ${next} for ${tarball_base_name}!" >> ${global_temp_file1};
 fi;
 fi
 ;;
 esac;
 ${sleep} 3;
 kill_proc `${cat} ${global_temp_file2}` || exit 1;
 export -n current;
 return ${success}
}
_SERVER["check_for_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_for_file <file path>" "check_for_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 1;
 return 0
}
_SERVER["create_directory_listing"] => () {  if [ $# -ne 1 ]; then
 message "Usage: create_program_list <directory>" "create_program_list";
 return 1;
 else
 if [ ! -d "${1}" ]; then
 message "Argument ${1} is not a directory." "create_program_list";
 return 1;
 fi;
 fi;
 prog_list="";
 for i in `ls ${1}`;
 do
 [ -z "${i}" ] && break 1;
 [ ! -d "${1}/${i}" ] && continue;
 prog_list="${prog_list} ${i}";
 done;
 if [ -z "${prog_list}" ]; then
 message "Empty program listing!" "Directory Listing Creation";
 return 1;
 else
 return 0;
 fi
}
_SERVER["trim_spaces"] => () {  if [ $# -lt 1 ]; then
 message "Usage: trim_spaces <string(s)>" "trim_space";
 return 1;
 fi;
 ${echo} ${1} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"
}
_SERVER["make_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_dir <path>" "make_dir";
 return 1;
 fi;
 [ -d "${1}" ] && return 0;
 if ! ${mkdir} -p ${1} &>/dev/null; then
 message "Unable to make directory ${1}" "Make directory";
 return 1;
 fi;
 if ! eval ${chmod} 775 ${1} || ! eval ${chmod} ug+s ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 return 0
}
_SERVER["download_patch"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_patch <program list>" "download_patch";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local list1="";
 local list2="";
 local found;
 local patch_name;
 for line in $@;
 do
 `${echo} ${line} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 error=0;
 prog="`${echo} ${line} | cut -d: -f1`";
 run="`${echo} ${line} | cut -d: -f2`";
 file_empty "${data_dir}/${prog}/${run}/patch_list" && continue;
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Patch Search For ${prog}";
 IFS=$(${echo} -e "\n\r");
 for patch_name in `${cat} ${data_dir}/${prog}/${run}/patch_list`;
 do
 `${echo} ${patch_name} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 found=1;
 scs=1;
 unset IFS;
 find_file ${patch_name} ${patch_src_dir} && continue;
 IFS=$(${echo} -e "\n\r");
 ${dialog} --backtitle "${main_title}" --title "Patch Search - ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ${echo} "Searching for patch, ${patch_name}..." > ${global_temp_file1};
 ${echo} "" >> ${global_temp_file1};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`head -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 for h in `${cat} "${profile}/mstr_urls"`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 `${echo} ${url} | ${grep} -iq -e '^#.*' -e '^$' -` && continue;
 ${echo} "Searching at ${url}..." >> ${global_temp_file1};
 url="${url}/${patch_name}";
 url="${url:0:255}";
 ! verify_url ${url} && continue;
 if ! check_connection; then
 ${echo} "Network connection failed...please check." >> ${global_temp_file1};
 error=1;
 break 1;
 fi;
 check_remote_file_exists ${url};
 rt=$?;
 if [ ${rt} -eq 0 ]; then
 ${echo} "" >> ${global_temp_file1};
 ${echo} "Patch ${patch_name} found at ${url}." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 [ ${error} -eq 1 ] && break 1;
 clear_global_files;
 if [ ${found} -ne 0 ]; then
 while :; do
 if ! prompt_for_value "Patch URL" "Enter URL for patch '${patch_name}'" "URL"; then
 return 1;
 fi;
 if [ -z "${prompt_value}" ]; then
 if yesno_inquiry "Try Again?" "No URL was entered.  Would you like to try again?"; then
 continue;
 else
 error=1;
 break 3;
 fi;
 fi;
 break 1;
 done;
 if ! verify_url ${prompt_value}; then
 message "Unable to verify URL for patch, ${patch_name}." "Failed URL Verification";
 error=1;
 break 2;
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=0;
 break 2;
 fi;
 clear_global_files;
 if ! check_remote_file_exists ${prompt_value}; then
 message "Patch, ${patch_name}, does not exist at the supplied URL, ${url}...exiting." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 url="${prompt_value:0:255}";
 fi;
 if ! ${grep} -iq "`${dirname} ${url}`" "${profile}/mstr_urls"; then
 ${echo} "`${dirname} ${url}`" >> "${profile}/mstr_urls";
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 clear_global_files;
 if ! retrieve_pkg ${url} /tmp; then
 message "Unable to retrieve required tarball, ${patch_name}." "Patch Tarball Retrieval Error";
 error=1;
 break 2;
 fi;
 if [ ! -f "/tmp/${patch_name}" ]; then
 message "Unable to find the patch, ${patch_name}, in the /tmp directory.";
 error=1;
 break 1;
 fi;
 if ! move "/tmp/${patch_name}" "${patch_src_dir}"; then
 message "There was an error moving patch ${patch_name} to the source directory." "File Move Error";
 error=1;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 1 ] && break 1;
 done;
 return ${error}
}
_SERVER["make_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_file <file path>" "make_file";
 return 1;
 fi;
 check_for_file "${1}" && return 0;
 err=1;
 while :; do
 if ! ${touch} ${1}; then
 err=0;
 break 1;
 fi;
 ${chmod} 775 ${1} || err=0;
 break 1;
 done;
 if [ ${err} -eq 0 ]; then
 message "Error creating file ${1}." "File Creation" && return 1;
 return 1;
 fi;
 return 0
}
_SERVER["chroot_mounted"] => () {  `${mount} -l | cut -d' ' -f3 | ${grep} -q "${chroot_dir}"` || return 1;
 return 0
}
_SERVER["execute_script_root"] => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script_root <path to script>" "execute_script_root";
 return 1;
 fi;
 local script_esr="${1}";
 export script_esr;
 local return_val=0;
 if ! root; then
 while :; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed ***\n";
 ${su} -c '(
        execute_script ${script_esr} || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 execute_script ${script_esr} || return_val=1;
 fi;
 unset script_esr;
 return ${return_val}
}
_SERVER["tarball_in_string"] => () {  if [ $# -ne 1 ]; then
 message "Usage: tarball_in_string <string>" "tarball_in_string";
 return 1;
 fi;
 if ${echo} ${1} | ${grep} -iq -e ".*tgz$" -e ".*gz$" -e ".*bz2$" -e ".*zip$" -e ".*xz$" -e ".*lzma$"; then
 return 0;
 else
 return 1;
 fi
}
_SERVER["new_dir_name"] => () {  prompt_for_value "Script Directory Name" "Enter new directory name" "Name" || return 1;
 return 0
}
_SERVER["edit_file"] => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: edit_file <path to file> [save flag]" "edit_file";
 return 1;
 fi;
 local scs=1;
 local save_flag="${2:-0}";
 EDITOR="vi";
 if [ ! -f "${1}" ]; then
 make_file ${1} || return 1;
 fi;
 find_file "`${basename} ${EDITOR}`";
 if [ ! -z "${file_name_path}" ] && [ -f "${file_name_path}" ]; then
 ${cat} ${1} > ${global_temp_file3};
 ${file_name_path} ${global_temp_file3};
 if [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 else
 return_val=0;
 fi;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 local command="";
 height=35;
 width=150;
 calculate_dimensions;
 make_title "File Edit";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Save\"       --cancel-label \"Do Not Save\" --cr-wrap --editbox \"${1}\" ${height} ${width}";
 eval ${command} 2> ${global_temp_file3};
 return_val=$?;
 if [ ${return_val} -eq 0 ] && [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 fi;
 fi;
 fi;
 return ${return_val}
}
_SERVER["new_batch_name"] => () {  prompt_for_value "Batch File Name" "Enter new batch file name" "Name" || return 1;
 return 0
}
_SERVER["clear_global_files"] => () {  for i in ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4};
 do
 clear_file "${i}" || return 1;
 ${touch} ${i} || return 1;
 done;
 return 0
}
_SERVER["move"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 ${mv} -f "${1}" "${2}";
 if [ $? -eq 1 ]; then
 message "There was an error moving file ${1} --> ${2}." "File Move";
 return 1;
 fi;
 return 0
}
_SERVER["save_file"] => () {  if [ $# -ne 2 ]; then
 message "Usage: save_file <file name> <file to copy>" "save_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 make_file ${1} || return 1;
 else
 if [ ! -e "${2}" ]; then
 message "File to copy is missing or empty.  No save will be done." "Missing Save-From File";
 return 0;
 fi;
 fi;
 if ! copy "${2}" "${1}"; then
 message "Error saving file." "File Save";
 return 1;
 fi;
 if [ -O ${1} ]; then
 if ! ${chmod} 775 ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 fi;
 return 0
}
_SERVER["check_for_directory"] => () {  if [ -d "${1}" ]; then
 return 0;
 else
 return 1;
 fi
}
_SERVER["prompt_for_value"] => () {  if [ $# -ne 3 ]; then
 message "Usage: prompt_for_value <title> <tag> <prompt>" "prompt_for_value";
 return 1;
 fi;
 height=20;
 width=120;
 p_lgth=${#3};
 local command;
 calculate_dimensions;
 make_title "Prompt";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Submit\"     --form \"${2}\" ${height} ${width} 1 \"${3}:\" 1 1 \"\" 1 $(( p_lgth + 2 )) ${width} 200";
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 prompt_value=`${cat} ${global_temp_file1}`;
 if [ ${#prompt_value} -gt 200 ]; then
 prompt_value=${prompt_value:0:255};
 fi;
 if [ ${return_val} -ne 0 ] || [ -z "${prompt_value}" ]; then
 prompt_value="";
 return 1;
 else
 prompt_value="`${echo} ${prompt_value} | tr ' ' '_'`";
 return 0;
 fi
}
_SERVER["execute_script"] => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script <path to script file>" "execute_script";
 return 1;
 fi;
 if [ ! -f "${1}" ]; then
 message "No script found!" "Script Find Error";
 return 1;
 fi;
 if `${grep} -m 1 -q "^#chroot_flag" ${1}` && ! check_for_directory ${chroot_dir}/tmp; then
 if ! make_dir ${chroot_dir}/tmp; then
 message "Unable to make chroot temporary directory." "Chroot Tmp Directory Creation Error";
 return 1;
 fi;
 fi;
 if [ ${global_no_dialog} -eq 1 ]; then
 `${grep} -m 1 -q "^#no_dialog" "${1}"` && no_dialog=0;
 fi;
 base_script_name="`${basename} ${1}`";
 make_executable_file "${global_temp_file3}";
 ${cat} ${1} > ${global_temp_file3};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 if ! copy ${global_temp_file3} "${chroot_dir}/tmp/"; then
 message "There was an error copying the script, '${1}', to the chroot temporary directory." "Script Copy Error";
 return 1;
 fi;
 fi;
 get_time ${base_script_name} "-";
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} $calc > ${global_time_file} && ${sleep} 1;
 done & sub_pid2=$!;
 if `${grep} -m 1 -q "^#pre_lfs" ${global_temp_file3}`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host directory." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 ${clear};
 ${echo} "Running script...";
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} | tee ${global_temp_file4};
 else
 ${global_temp_file3} | tee ${global_temp_file4};
 fi;
 return_val=$?;
 ${sleep} 5;
 else
 height=35;
 width=150;
 calculate_dimensions;
 local sub_pid1;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Running script ${base_script_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Running script ${base_script_name} (${start_time})";
 fi;
 ${echo} "Running script..." > ${global_temp_file4};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} &>>${global_temp_file4} &
 else
 ${global_temp_file3} &>>${global_temp_file4} &
 fi;
 sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Running Script: ${base_script_name} (Est. Completion Time: ${hour}h ${min}m ${sec}s)" --no-kill --tailboxbg ${global_temp_file4} ${height} ${width} 2> ${global_temp_file5};
 while file_empty ${global_temp_file5}; do
 ${sleep} .5;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 5;
 kill_proc `${cat} ${global_temp_file5}`;
 fi;
 disown ${sub_pid2};
 kill ${sub_pid2};
 ${rm} -f ${chroot_dir}/tmp/lfs_script* &>/dev/null;
 if ! update_time ${base_script_name} "-" `${cat} ${global_time_file}`; then
 message "Warning: There was an error updating the time file for (script) ${base_script_name}...continuing." "Update Time File Error";
 fi;
 if [ ${return_val} -eq 1 ]; then
 ${echo} "Script error: ${base_script_name} @ `date`" >> ${install_log};
 message "Script error: ${base_script_name}." "Script Error";
 else
 if [ ${return_val} -eq 0 ]; then
 ${echo} "Script finish: ${base_script_name} @ `date`" >> ${install_log};
 fi;
 fi;
 return ${return_val}
}
_SERVER["remove_file"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_file <file path> ..." "remove_file";
 return 1;
 fi;
 for z in $@;
 do
 [ ! -e "${z}" ] && continue;
 ${rm} -rf ${z} &>/dev/null;
 if [ $? -eq 1 ]; then
 message "There was an error removing file ${z}." "File Removal Error";
 return 1;
 fi;
 done;
 return 0
}
_SERVER["abort_message"] => () {  if [ $# -lt 1 ] || [ -z "${1}" ]; then
 message "Usage: abort_message <text> [title]" && return 1;
 fi;
 local message_title;
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 ${dialog} --sleep 2 --title "Installation Abort" --infobox "${1}" 10 30;
 else
 ${dialog} --sleep 2 --title "Aborting Installation: ${message_title}." --infobox "${1}" 10 30;
 fi;
 exit 1
}
_SERVER["make_executable_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_executable_file <file name>" "make_executable_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 if ! make_file "${1}" || ! ${chmod} u+x ${1}; then
 message "Unable to create file: ${1}." "Executable File Error";
 return 1;
 fi;
 else
 if [ ! -x "${1}" ]; then
 if ! ${chmod} u+x ${1}; then
 message "Unable to make file '${1}' executable." "Executable File Error";
 return 1;
 fi;
 fi;
 fi;
 return 0
}
_SERVER["kill_proc"] => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: kill_proc <proc1> [proc2]" "kill_proc";
 return 1;
 fi;
 [ -z "${1}" ] && return 0;
 if [ $# -eq 1 ]; then
 ${ps} -p ${1} &>/dev/null || return 0;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 else
 if [ $# -eq 2 ]; then
 while ${ps} -p ${1} &>/dev/null 2>&1; do
 ${sleep} 1;
 done;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 fi;
 fi;
 return 0
}
_SERVER["verify_signature"] => () {  if [ $# -ne 2 ]; then
 message "Usage: verify_signature <sig1> <sig2>" "verify_signature";
 return 1;
 fi;
 if [ "${1}" != "${2}" ]; then
 return 1;
 else
 return 0;
 fi
}
_SERVER["single_program_configuration"] => () {  program_selection "Select a program to check and configure" "single" "Select" $@ || return 1
}
_SERVER["chg_tmp_file_owner"] => () {  if [ $# -ne 1 ]; then
 message "Usage: chg_tmp_file_owner <file>" "chg_tmp_file_owner";
 return 1;
 fi;
 local owner="${1}";
 for i in ${batch_file} ${return_val_file} ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4} ${global_time_file} ${global_temp_file5};
 do
 [ ! -f "${i}" ] && continue;
 chg_file_owner ${owner} ${i} || return 1;
 done;
 return 0
}
_SERVER["root"] => () {  if [ `id -u` -eq 0 ]; then
 return 0;
 else
 return 1;
 fi
}
_SERVER["remove_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: remove_dir <dir>" "remove_dir";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 0;
 local sub_pid1;
 height=10;
 width=80;
 calculate_dimensions;
 ${echo} "Please wait while removing directory `${basename} ${1}`..." > ${global_temp_file1};
 ${rm} -rf ${1} &>/dev/null & sub_pid1=$!;
 make_title "Directory Removal";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Removing Directory" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 1;
 kill_proc `${cat} ${global_temp_file2}`;
 return ${return_val}
}
_SERVER["verify_url"] => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_signature <string>" "verify_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\)://.*$"; then
 return 0;
 else
 return 1;
 fi
}
_SERVER["message"] => () {  if [ $# -lt 1 ]; then
 message="Usage: message <text> [title]" "message";
 fi;
 local message;
 local message_title;
 message="${1}";
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 message_title="Message";
 fi;
 ${dialog} --colors --backtitle "${gen_title}" --title "${message_title}" --msgbox "${message}" 15 100;
 return $?
}
_SERVER["please_wait"] => () {  height=10;
 width=60;
 kill_please_wait;
 calculate_dimensions;
 make_title "Processing";
 ${echo} "Please wait..." > ${global_temp_file5};
 ${dialog} --backtitle "${main_title}" --title "Processing" --no-kill --tailboxbg ${global_temp_file5} ${height} ${width} 2> ${global_temp_file6};
 while file_empty ${global_temp_file6}; do
 sleep .5;
 done;
 please_wait_pid="`cat ${global_temp_file6}`";
 return 0
}
_SERVER["new_script_name"] => () {  prompt_for_value "New Script Name" "Enter Script Name (NOTE: empty files will still save)" "Name" || return 1;
 return 0
}
_SERVER["confirm_selection"] => () {  if [ $# -lt 1 ]; then
 message "Usage: confirm_selection <list>" "confirm_selection";
 return 1;
 fi;
 local list1="$@";
 local prog;
 local rn;
 local return_val;
 local command="";
 local i;
 local kill_wait_pid_cs="";
 declare -i i=1;
 if [ -z "${list1}" ]; then
 message "No programs were selected for confirmation." "Installation Selection Confirmation";
 return 1;
 fi;
 please_wait;
 height=25;
 width=60;
 for j in $@;
 do
 [ ${#j} -gt ${width} ] && width=${#j};
 done;
 width=$(( width + 15 ));
 calculate_dimensions;
 make_title "Selection Confirmation";
 command="${dialog} --backtitle \"${main_title}\" --title \"Selected programs\" ";
 command="${command} --ok-label \"Yes\" --cancel-label \"No\" --menu \"Is the selection correct?\" ${height} ${width} ${height} ";
 command="${command} \"PROGRAM\" \"RUN-LEVEL\"";
 command="${command} \"=================\" \"=========\"";
 for j in ${list1};
 do
 if `${echo} ${j} | ${grep} -q "^script:.*$"`; then
 prog="`${echo} ${j} | cut -d: -f2`";
 prog="script - `basename ${prog}`";
 rn="N/A";
 else
 prog="`${echo} ${j} | cut -d: -f1`";
 rn="`${echo} ${j} | cut -d: -f2`";
 fi;
 command="${command} \"${i}.  ${prog}\" \"${rn}\"";
 i=$(( ++i ));
 done;
 eval ${command} 2> /dev/null;
 return_val=$?;
 kill_please_wait;
 return $return_val
}
_SERVER["edit_configuration"] => () {  if [ $# -ne 1 ]; then
 message "Usage: edit_configuration <program name>" "edit_configuration";
 return 1;
 fi;
 local var1_ec;
 local scs=0;
 prog_dir="${data_dir}/${1}";
 run_dir="${prog_dir}/${run}";
 get_time ${tarball_base_name} ${run} || return 1;
 make_title "Configuration Edit";
 while :; do
 ${dialog} --colors --backtitle "${main_title}" --title "${1} - run level: ${run} - \Z1Est. Build Time: ${hour}h ${min}m ${sec}s\Zn" --no-cancel --extra-button --extra-label "New Run Level" --radiolist "Configuration/Installation files for ${1}" 20 90 20 "Configuration" "View/edit configuration commands" "off" "Make Flags" "View/edit list of make flags" "off" "Make (Check/Test) Flags" "View/edit list of make (check/test) commands" "off" "Make (Install) Flags" "View/edit list of make (install) commands" "off" "Master Base URL's" "View/edit base URL's for downloading packages" "off" "Master Conf File" "View/edit master configuration file (in parent directory)" "off" "Patch List" "View/edit patch list file" "off" "Post-configuration" "View/edit post-configuration commands" "off" "Pre-configuration" "View/edit pre-configuration commands" "off" "Preferred URL" "View/edit this program's preferred URL" "off" "Program Description" "View/edit program description" "off" "Required Packages" "View/edit packages to be present in source directory" "off" "Run Level Conf File" "View/edit run level configuration file" "off" "View Logs" "View logs for this run-level" "off" "Remove Run-Level" "Delete this run-level" "off" 2> ${global_temp_file1};
 return_val=$?;
 if [ ${return_val} -eq 3 ]; then
 return 3;
 else
 if file_empty ${global_temp_file1}; then
 return 1;
 fi;
 fi;
 case `${cat} ${global_temp_file1}` in 
 "Configuration")
 var1_ec="${run_dir}/cf"
 ;;
 "Pre-configuration")
 var1_ec="${run_dir}/pre-cf"
 ;;
 "Post-configuration")
 var1_ec="${run_dir}/post-cf"
 ;;
 "Program Description")
 var1_ec="${prog_dir}/df"
 ;;
 "Installed Programs")
 var1_ec="${run_dir}/ip"
 ;;
 "Make Flags")
 var1_ec="${run_dir}/mf"
 ;;
 "Make (Install) Flags")
 var1_ec="${run_dir}/mi"
 ;;
 "Make (Check/Test) Flags")
 var1_ec="${run_dir}/make_check_test"
 ;;
 "Patch List")
 var1_ec="${run_dir}/patch_list"
 ;;
 "Preferred URL")
 var1_ec="${prog_dir}/purl"
 ;;
 "Required Packages")
 var1_ec="${run_dir}/rpkg"
 ;;
 "Master Conf File")
 var1_ec="${prog_dir}/mstr_conf"
 ;;
 "Run Level Conf File")
 var1_ec="${run_dir}/conf"
 ;;
 "Master Base URL's")
 var1_ec="${profile}/mstr_urls"
 ;;
 "View Logs")
 log_viewer ${tarball_base_name} ${run};
 continue
 ;;
 "Remove Run-Level")
 if remove_run_level "${tarball_base_name}" "${run}"; then
 return 0;
 else
 continue;
 fi
 ;;
 *)
 continue
 ;;
 esac;
 ! check_for_file ${var1_ec} && ${touch} ${var1_ec};
 edit_file ${var1_ec};
 done;
 return ${scs}
}
_SERVER["clear_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: clear_file <file>" "clear_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 0;
 scs_cgf=0;
 ${rm} ${1} &>/dev/null || scs_cgf=1;
 ${touch} ${1} &>/dev/null || scs_cgf=1;
 if [ ${scs_cgf} -eq 1 ]; then
 message "An error occurred while attempting to clear a file: ${1}." "File-Clear Error";
 return 1;
 fi;
 return 0
}
_SERVER["highest_run_level"] => () {  if [ $# -ne 1 ]; then
 message "Usage: highest_run_level <tarball base directory>" "highest_run_level";
 return 1;
 fi;
 [ ! -d "${data_dir}/${1}" ] && return 1;
 local list_hrl=`ls ${data_dir}/${1}`;
 for i in ${list_hrl};
 do
 [ "${i}" == "list_hrl" ] && continue;
 if are_digits ${i}; then
 [ ${current} -lt ${i} ] && current=${i};
 fi;
 done;
 return 0
}
_SERVER["download_rpkg"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_rpkg <program list>" "download_rpkg ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local rp_name="";
 local list1="";
 local list2="";
 local error=1;
 local found;
 height=20;
 width=120;
 calculate_dimensions;
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 IFS=$(${echo} -e "\n\r");
 for rp_name in `${cat} ${data_dir}/${prog}/${run}/rpkg`;
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 found=1;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 find_file ${rp_name} ${prog_src_dir} && continue;
 if ! file_empty ${profile}/mstr_urls; then
 ${echo} "Searching for ${rp_name}..." > ${global_temp_file1};
 make_title "Required Tarball Search For ${rp_name}";
 ${dialog} --backtitle "${main_title}" --title "Required Tarball Search For ${rp_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 url="`${echo} ${url}/${rp_name}`";
 ! verify_tarball_url "${url}" && continue;
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Searching for ${rp_name} at ${url}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Required tarball, ${rp_name}, found at ${url}..." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 clear_global_files;
 if [ ${found} -eq 1 ]; then
 while :; do
 prompt_for_value "Required Program URL (${rp_name})" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${rp_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 error=0;
 break 1;
 fi;
 fi;
 break 1;
 done;
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Required Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 check_remote_file_exists "${prompt_value}";
 if [ $? -eq 0 ]; then
 found=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && echo "${url_dir}" >> ${profile}/mstr_urls;
 url="${prompt_value}";
 break 1;
 fi;
 done;
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 if [ ${found} -eq 1 ]; then
 message "Unable to find required tarball, ${rp_name}.  Aborting installation..." "File Find Failed";
 error=0;
 break 1;
 fi;
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 if ! retrieve_pkg "${url}" /tmp; then
 message "Unable to download ${rp_name} from `${dirname} ${url}`." "File Download Failed";
 error=0;
 break 1;
 fi;
 if [ ! -f "/tmp/${rp_name}" ]; then
 message "Required tarball file not found in /tmp directory." "Tarball Not Found";
 error=0;
 break 1;
 fi;
 if ! move "/tmp/${rp_name}" "${prog_src_dir}"; then
 message "Unable to move file ${rp_name} to source directory." "Tarball File Move Error";
 error=0;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 0 ] && return 1;
 done;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_SERVER["script_options_m1"] => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options_m1 <file>" "script_options_m1";
 return 1;
 fi;
 local command;
 height=20;
 width=60;
 calculate_dimensions;
 make_title "Options";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '`${basename} ${1}`' Options\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"View Completion Time(s)\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
_SERVER["install_one"] => () {  if [ $# -ne 1 ]; then
 message "Usage: install_one <program name>" "install_one";
 return 1;
 fi;
 local path;
 local located=1;
 local success=1;
 local runtime_error=1;
 no_dialog=1;
 tarball_name="";
 prog_dir="${data_dir}/${tarball_base_name}";
 run_dir="${prog_dir}/${run}";
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf` && ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 install_dir="${in_chroot_install_dir}";
 release_dir="${chroot_dir}${in_chroot_install_dir}";
 check_for_directory ${chroot_dir}/tmp || make_dir ${chroot_dir}/tmp;
 if ! directory_writable "${chroot_dir}/${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 else
 install_dir="$out_chroot_install_dir";
 release_dir="$out_chroot_install_dir";
 if ! directory_writable "${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 fi;
 if ! `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 if `${echo} "${install_dir}" | ${grep} -q "${chroot_dir}"` || `${echo} "${release_dir}" | ${grep} -q "${chroot_dir}"`; then
 if ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 check_for_directory "${chroot_dir}${install_dir}";
 else
 check_for_directory "${install_dir}";
 fi;
 if [ $? -ne 0 ]; then
 if ! make_dir "${install_dir}"; then
 message "Unable to create install directory (${install_dir})." "Installation Directory Creation Error";
 break 1;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 directory_writable ${chroot_dir}${install_dir} || return 1;
 else
 directory_writable ${install_dir} || return 1;
 fi;
 if ! check_structure ${run_dir}; then
 message "Program directory for ${1} not set up properly." "Improper Directory Structure";
 return 1;
 fi;
 get_time ${tarball_base_name} ${run};
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} ${calc} > ${global_time_file} && sleep 1;
 done & sub_pid2=$!;
 ! file_empty ${prog_dir}/tb_name && tarball_name="`${cat} ${prog_dir}/tb_name`";
 [ -z "${tarball_name}" ] && return 1;
 if find_file "${tarball_name}" "${prog_src_dir}"; then
 release_tarball "${file_name_path}" "${release_dir}" 0 || return 1;
 else
 message "Unable to find file, ${tarball_name}." "File Not Found";
 return 1;
 fi;
 parent_tb_base_name=${tarball_base_name};
 release_isp ${run_dir}/rpkg || return 1;
 tarball_base_name=${parent_tb_base_name};
 no_dialog=1;
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/patch_list";
 fi;
 IFS=$(${echo} -e "\n\r");
 for item in `${cat} ${run_dir}/patch_list`;
 do
 `${echo} ${item} | ${grep} -q -e "^#.*$" -e "^$" -` && continue;
 if ! run_patch ${item}; then
 message "An error occurred running the patch (${item}) for ${tarball_base_name}." "Patch-Run Error";
 return 1;
 fi;
 done;
 unset IFS;
 j="`ls ${run_dir}/log | grep -v ^.*old`";
 for k in ${j};
 do
 h="`echo ${k} | sed -e 's;\.tar\.bz2$;;g'`";
 move "${run_dir}/log/${k}" "${run_dir}/log/${h}.old.tar.bz2" || return 1;
 done;
 unset j k;
 while true; do
 if file_empty "${run_dir}/pre-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/pre-cf";
 fi;
 if ${grep} -q "^#run_as_root" ${run_dir}/pre-cf && ! root; then
 if ! global_script_run_root "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "pre_conf" ${global_temp_file1};
 compress_log "${run_dir}/log/pre_conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/cf";
 fi;
 if ! global_script_run "${run_dir}/cf" "Configuration"; then
 message "The configuration script for ${tarball_base_name}, run level ${run}, failed." "Configuration Failure";
 runtime_error=0;
 fi;
 save_log "conf" ${global_temp_file1};
 compress_log "${run_dir}/log/conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mf";
 fi;
 if ! global_script_run "${run_dir}/mf" "Make"; then
 message "The Make script for ${tarball_base_name}, run level ${run}, failed." "Make Failure";
 runtime_error=0;
 fi;
 save_log "make" ${global_temp_file1};
 compress_log "${run_dir}/log/make" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/make_check_test"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/make_check_test";
 fi;
 if ! global_script_run "${run_dir}/make_check_test" "Make Check/Test"; then
 if ! `grep -q -m1 "#ignore_check_errors" "${run_dir}/conf"`; then
 message "The Make-Check script for ${tarball_base_name}, run level ${run}, failed." "Make-Check Failed";
 runtime_error=0;
 else
 ${echo} "Warning: Make/Check error for ${tarball_base_name} @ `date`" >> ${install_log};
 fi;
 fi;
 save_log "make_check_test" ${global_temp_file1};
 compress_log "${run_dir}/log/make_check_test" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mi"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mi";
 fi;
 if ${grep} -q "^#no_root_install" ${run_dir}/mi; then
 if ! global_script_run "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run_root "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "make_install" ${global_temp_file1};
 compress_log "${run_dir}/log/make_install" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/post-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/post-cf";
 fi;
 if ${grep} -q "#run_as_root" ${run_dir}/post-cf; then
 if ! global_script_run_root "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "post_cf" ${global_temp_file1};
 compress_log "${run_dir}/log/post_cf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 break 1;
 done;
 disown ${sub_pid2};
 ${kill} ${sub_pid2};
 if [ ${runtime_error} -ne 0 ]; then
 if ! update_time ${tarball_base_name} ${run} `${cat} ${global_time_file}`; then
 message "Warning: A failure occurred while updating the time file for ${tarball_base_name}...continuing." "Update Time File Error";
 fi;
 fi;
 remove_ext_tb=1;
 if [ ${global_remove_ext_tb} -eq 0 ]; then
 remove_ext_tb=0;
 else
 if `${grep} -q "^#remove_ext_tb" ${run_dir}/conf`; then
 remove_ext_tb=0;
 fi;
 fi;
 if [ ${remove_ext_tb} -eq 0 ] && [ -d "${release_dir}/${tarball_base_name}" ]; then
 if ! remove_dir "${release_dir}/${tarball_base_name}"; then
 message "A failure occurred during the removal of directory, ${release_dir}/${tarball_base_name}." "Directory Removal Error";
 return 1;
 fi;
 fi;
 if [ ${runtime_error} -eq 1 ]; then
 ${echo} "Installed: ${tarball_base_name} @ `date`" >> ${install_log};
 return 0;
 else
 if [ ${runtime_error} -eq 0 ]; then
 ${echo} "Install Failure: ${tarball_base_name} @ `date` (check log files)" >> ${install_log};
 message "Install Failure: ${tarball_base_name} @ `date` (check log files)" "Install Failure";
 return 1;
 fi;
 fi
}
_SERVER["check_sig_prog"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_prog <file list>" "check_sig_prog";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local listing;
 local flag=0;
 local error=1;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 base_name="`${echo} ${line} | ${cut} -d: -f1`";
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Main Program" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 ${echo} "Checking ${base_name}..." >> ${global_temp_file1};
 if file_empty "${data_dir}/${base_name}/tb_name"; then
 ${echo} "${base_name}: Unable to find the name of the tarball to check!" >> ${global_temp_file1};
 error=0;
 break 1;
 else
 tb_name="`${head} -n1 ${data_dir}/${base_name}/tb_name`";
 if [ -z "${tb_name}" ]; then
 ${echo} "${base_name}: Unable to find the name of the tarball being used for installation!" >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 fi;
 if ! find_file ${tb_name} ${prog_src_dir}; then
 ${echo} "Unable to find program, ${tb_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_SERVER["release_isp"] => () {  if [ $# -ne 1 ]; then
 message "Usage: release_isp <run directory>" "release_isp";
 return 1;
 fi;
 file_empty "${1}" && return 0;
 local signature;
 local full_path;
 local found;
 local url;
 IFS=$(${echo} -e "\n\r");
 for pkg in `${cat} ${1}`;
 do
 ${echo} ${pkg} | ${grep} -iq -e '^#.*' -e '^$' && continue;
 found=1;
 scs=1;
 name=`${echo} ${pkg} | ${cut} -d: -f1`;
 if [ -z "${name}" ]; then
 message "Unable to find the name of a required package!" "Required Package Name Missing";
 return 1;
 fi;
 if ! find_file ${name} ${prog_src_dir}; then
 message "Unable to find required tarball, ${name}, in source directory." "Required Package Missing";
 return 1;
 fi;
 rename=`${echo} ${pkg} | ${cut} -d: -f2`;
 append_cmds=`${echo} ${pkg} | ${cut} -d: -f3`;
 get_tarball_base_from_tb ${file_name_path} || return 1;
 if [ -f "${release_dir}/${parent_tb_base_name}/${tarball_base_name}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${tarball_base_name};
 fi;
 if release_tarball ${file_name_path} ${release_dir}/${parent_tb_base_name} 1 "${append_cmds}"; then
 if [ ! -z "${rename}" ]; then
 if [ -d "${release_dir}/${parent_tb_base_name}/${rename}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 move ${release_dir}/${parent_tb_base_name}/${tarball_base_name} ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 else
 message "There was an error releasing the tarball, ${name}, into its parent directory (${parent_tb_base_name})!" "Tarball Release Error";
 return 1;
 fi;
 done;
 unset IFS;
 return 0
}
_SERVER["rename_script_name"] => () {  prompt_for_value "Script Rename" "Script Rename" "Name" || return 1;
 return 0
}
_SERVER["program_selection"] => () {  if [ $# -lt 4 ]; then
 message "Usage: output_dialog_selection_batch <title> <type> <ok label> <list>" "output_dialog_selection_batch";
 return 1;
 fi;
 local command;
 local description_ps;
 local file1_ps;
 local file3_ps;
 local batch_prog_temp_ps="";
 local batch_progs_ps="";
 local orig_list_ps;
 local batch_run_level_ps="";
 local type_ps;
 local title_ps;
 local ok_label_ps;
 local cancel_label_ps;
 return_val="";
 title_ps="${1}";
 type_ps="${2}";
 ok_label_ps="${3}";
 shift 3;
 orig_list_ps=$@;
 prog_list="";
 while :; do
 kill_please_wait;
 please_wait;
 height=50;
 width=160;
 calculate_dimensions;
 make_title "Batch Listing";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"${ok_label_ps}\"       --no-cancel --radiolist \"${title_ps}\" ${height} ${width} ${height} ";
 for i in ${orig_list_ps};
 do
 file1_ps="${data_dir}/${i}/df";
 if ! file_empty ${file1_ps}; then
 description_ps=`${cat} ${file1_ps}`;
 else
 description_ps="No description";
 fi;
 description_ps="${description_ps:0:255}";
 command="${command} \"${i}\" \"${description_ps}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 { 
 [ ${return_val} -eq 1 ] || file_empty ${global_temp_file1}
 } && return 1;
 batch_prog_temp_ps="`${cat} ${global_temp_file1} | ${sed} -e 's;";;g'`";
 if [ "${type_ps}" == "single" ] || [ "${type_ps}" == "checksum" ]; then
 prog_list=${batch_prog_temp_ps};
 break 1;
 else
 if [ "${type_ps}" == "batch" ]; then
 get_run_level ${batch_prog_temp_ps};
 ${echo} "${batch_prog_temp_ps}:${run}" >> ${batch_file};
 prog_list="${prog_list} ${batch_prog_temp_ps}";
 fi;
 fi;
 done;
 return ${return_val}
}
_SERVER["verify_sha_alg"] => () {  case ${sha_alg} in 
 "1" | "224" | "256" | "384" | "512" | "512224" | "512256")
 :
 ;;
 *)
 sha_alg=1
 ;;
 esac;
 return 0
}
_SERVER["run_patch"] => () {  if [ $# -ne 1 ]; then
 message "Usage: run_patch <patch file>" "run_patch";
 return 1;
 fi;
 clear_global_files;
 local pfile_raw="${1}";
 local pfile_uncomp="${1}";
 local list;
 local sub_pid1;
 local scs=0;
 chg_dir "${release_dir}/${tarball_base_name}" || return 1;
 if `${echo} ${pfile_raw} | ${grep} -q ".*\.gz"`; then
 pfile_uncomp="`${echo} ${pfile_raw} | ${sed} -e 's;\(^.*\)\.gz;\1;g'`";
 if [ ! -f "${patch_src_dir}/${pfile_uncomp}" ]; then
 if ! ${gunzip} ${patch_src_dir}/${pfile_raw}; then
 message "There was a problem uncompressing '${pfile_raw}'." "Patch Un-Compression";
 return 1;
 fi;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 clear;
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp};
 scs=$?;
 else
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp} &>${global_temp_file2} & sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --title "Patching ${tarball_base_name} (${pfile_raw})" --no-kill --tailboxbg ${global_temp_file2} 40 130 2> ${global_temp_file1};
 while file_empty ${global_temp_file1}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 scs=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file1}`;
 fi;
 ${sleep} 1;
 return ${scs}
}
_SERVER["make_temp_file"] => () {  local tmp_file;
 local scs=0;
 tmp_file=`${mktemp} -p /tmp lfs_script.XXXXXXXX`;
 trap "remove_file ${tmp_file}" SIGINT;
 if [ ! -z "${tmp_file}" ] && [ -f "${tmp_file}" ]; then
 ${echo} ${tmp_file};
 else
 scs=1;
 fi;
 trap - SIGINT;
 if [ ${scs} -eq 1 ]; then
 exit 1;
 else
 return ${scs};
 fi
}
_SERVER["check_owner"] => () {  local var1;
 local var2;
 local var3;
 if [ $# -ne 2 ]; then
 message "Usage: check_owner <user> <file/directory>" "check_owner";
 return 1;
 fi;
 var1=`${dirname} ${2}`;
 var2=`${echo} ${1} | ${sed} -e 's;${var1};;g'`;
 var3=`ls -n ${var1} | ${grep} ${var2} | ${sed} -e 's;^[a-zA-Z0-9-]\+\s\+[a-zA-Z0-9]\+\s\+\(.*$\);\1;g'`;
 if [ "${1}" == "${var3}" ]; then
 return 0;
 else
 return 1;
 fi
}
_SERVER["batch_program_listing"] => () {  program_selection "Select programs to install (batch mode)" "batch" "Add" $@ || return 1
}
_SERVER["make_title"] => () {  if [ $# -lt 1 ]; then
 message "Usage: make_title <type title>..." "make_title";
 return 1;
 fi;
 local c;
 local mt_length=${#gen_title};
 local ty_length=${#1};
 local var1=$(( mt_length + ty_length ));
 local max_wd=`stty size | cut -d" " -f2`;
 main_title="";
 if [ ${var1} -gt ${max_wd} ]; then
 main_title="${gen_title}";
 return 0;
 fi;
 var1=$(( max_wd - mt_length - ty_length - 2 ));
 local spaces="`${echo} ${var1} | bc`";
 main_title="${gen_title}";
 for ((c=1; c<=${spaces}; c++ ))
 do
 main_title="${main_title}+";
 done;
 main_title="${main_title}${1}";
 return 0
}
_SERVER["checksum_program_listing"] => () {  program_selection "Select a program to view/edit checksum" "checksum" "Select" $@ || return 1
}
_SERVER["check_profile_struc"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_profile_structure <profile dir>" "check_profile_struc";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 for h in "batch" "data" "scripts" "doc";
 do
 [ -d "${1}/${h}" ] || return 1;
 done;
 return 0
}
_SERVER["select_from_list"] => () {  if [ $# -lt 2 ]; then
 message "Usage: select_from_list <title> <list>" "select_from_list";
 return 1;
 fi;
 local command="";
 local title_sfl=${1};
 height=20;
 width=120;
 local list_height_sfl=20;
 calculate_dimensions;
 shift 1;
 make_title "List Selection";
 command="${dialog} --colors --backtitle \"${main_title}\" --ok-label \"Select\" --no-cancel     --radiolist \"${title_sfl}\" ${height} ${width} ${list_height_sfl}";
 for z in $@;
 do
 command="${command} \"${z}\" \"\" off";
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 selection=`${cat} ${global_temp_file1}`;
 if [ ${return_val} -eq 1 ] || { 
 [ ${return_val} -eq 0 ] && [ -z "${selection}" ]
 }; then
 return 1;
 else
 return 0;
 fi
}
_SERVER["find_file"] => () {  if [ $# -lt 1 ]; then
 message "Usage: find_file <file name> [path]" "find_file";
 return 1;
 fi;
 local local_path;
 local real_paths="";
 if [ -z "${2}" ]; then
 local_path=`${echo} ${PATH} | tr ":" " "`;
 else
 local_path="${2}";
 fi;
 for i in ${local_path};
 do
 [ -d "${i}" ] && real_paths="${real_paths} ${i}";
 done;
 real_paths=`${echo} ${real_paths} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"`;
 file_name_path=`${find} ${real_paths} -name "${1}"`;
 file_name_path="`${echo} ${file_name_path} | cut -d" " -f1`";
 if [ -z "${file_name_path}" ]; then
 return 1;
 else
 return 0;
 fi
}
_SERVER["get_dialog"] => () {  if [ $# -ne 1 ]; then
 message "Usage: get_dialog <file>" "get_dialog";
 return 1;
 fi;
 if ! check_for_file "${1}"; then
 message "Unable to find file used to set the dialog variable." "No-Dialog File Error";
 return 1;
 fi;
 if ${grep} -q "no_dialog" ${1}; then
 no_dialog=0;
 else
 no_dialog=1;
 fi;
 return 0
}
_SERVER["move_dir"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move_dir <dir> <path to new name>" "move_dir";
 return 1;
 fi;
 if [ -d "${1}" ]; then
 local dest_dir;
 dest_dir="`${echo} ${2} | ${tr} ' ' '_'`";
 if ! ${mv} ${1} ${dest_dir} &>/dev/null; then
 :;
 else
 message "Directory renamed to ${dest_dir}." "Move Directory";
 fi;
 fi;
 return 0
}
_SERVER["kill_please_wait"] => () {  `${ps} -p ${please_wait_pid} &> /dev/null` && kill -SIGINT ${please_wait_pid};
 return 0
}
_SERVER["PHP_SELF"] => 
_SERVER["SCRIPT_NAME"] => 
_SERVER["SCRIPT_FILENAME"] => 
_SERVER["PATH_TRANSLATED"] => 
_SERVER["DOCUMENT_ROOT"] => 
_SERVER["REQUEST_TIME_FLOAT"] => 1335662388.5143
_SERVER["REQUEST_TIME"] => 1335662388
_SERVER["argv"] => Array
(
)

_SERVER["argc"] => 0
_ENV["grep"] => /bin/grep
_ENV["kill"] => /bin/kill
_ENV["printf"] => /usr/bin/printf
_ENV["HZ"] => 100
_ENV["out_chroot_install_dir"] => /usr/src
_ENV["basename"] => /usr/bin/basename
_ENV["sources_dir"] => /home/yp58t/Sources
_ENV["XORG_CONFIG"] => --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man --localstatedir=/var
_ENV["TEST_PHP_SRCDIR"] => /usr/src/php-5.4.1
_ENV["no_patch_dialog"] => 1
_ENV["SHELL"] => /bin/bash
_ENV["chroot_flag"] => 1
_ENV["batch_sec"] => 21
_ENV["tail"] => /usr/bin/tail
_ENV["TERM"] => screen.linux
_ENV["MAKEFLAGS"] => 
_ENV["chown"] => /bin/chown
_ENV["HISTSIZE"] => 1000
_ENV["SSH_CLIENT"] => deleted
_ENV["please_wait_pid"] => 31351
_ENV["install_dir"] => /usr/src
_ENV["patch"] => /usr/bin/patch
_ENV["HUSHLOGIN"] => FALSE
_ENV["no_script_dialog"] => 1
_ENV["fail_on_shasum"] => 1
_ENV["SSH_TTY"] => deleted
_ENV["etc_dir"] => /etc/takenset
_ENV["return_val"] => 0
_ENV["prog_src_dir"] => /home/yp58t/Sources/prog
_ENV["release_dir"] => /usr/src
_ENV["total_sec"] => 522
_ENV["reqd_dir"] => 
_ENV["prog_dir"] => /etc/takenset/blfs/data/php-5.4.1
_ENV["got_level"] => 0
_ENV["USER"] => yp58t
_ENV["batch_file"] => /tmp/lfs_script.eKp3FNW7
_ENV["xz"] => /usr/bin/xz
_ENV["LS_COLORS"] => rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
_ENV["shasum"] => /usr/bin/shasum
_ENV["global_time_file"] => /tmp/lfs_script.gRls6AQe
_ENV["batch_hour"] => 0
_ENV["SSH_AUTH_SOCK"] => deleted
_ENV["head"] => /bin/head
_ENV["TERMCAP"] => SC|screen.linux|VT 100/ANSI X3.64 virtual terminal:\
	:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
	:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
	:do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
	:le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
	:li#64:co#160:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
	:cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
	:im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
	:ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
	:ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
	:se=\E[23m:mb=\E[5m:md=\E[1m:mh=\E[2m:mr=\E[7m:\
	:me=\E[m:ms:\
	:Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
	:vb=\Eg:as=\E(0:ae=\E(B:\
	:ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
	:k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:\
	:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\
	:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\
	:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:kb=:\
	:K2=\E[G:kB=\E[Z:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:\
	:kN=\E[6~:kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:\
	:kr=\EOC:kl=\EOD:
_ENV["run_dir"] => /etc/takenset/blfs/data/php-5.4.1/1
_ENV["run"] => 1
_ENV["prompt_value"] => 
_ENV["MAKELEVEL"] => 1
_ENV["height"] => 35
_ENV["selection"] => 
_ENV["MFLAGS"] => 
_ENV["rm"] => /bin/rm
_ENV["chmod"] => /bin/chmod
_ENV["echo"] => /bin/echo
_ENV["dirname"] => /usr/bin/dirname
_ENV["batch_dir"] => /etc/takenset/blfs/batch
_ENV["connect_pid"] => 16438
_ENV["cat"] => /bin/cat
_ENV["touch"] => /usr/bin/touch
_ENV["PATH"] => /usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/X11R6/bin
_ENV["lib_dir"] => /usr/lib/takenset
_ENV["MAIL"] => /var/mail/yp58t
_ENV["tarball_is_local"] => 0
_ENV["wget"] => /usr/bin/wget
_ENV["STY"] => 23215.tty1.lfs
_ENV["_"] => /usr/src/php-5.4.1/sapi/cli/php
_ENV["mount"] => /bin/mount
_ENV["check_signature"] => 1
_ENV["sed"] => /bin/sed
_ENV["main_title"] => Ta-Kenset - Profile: /etc/takenset/blfs+++++++++++++++++++++++++++++++++++++++++++++++++++++Releasing php-5.4.1.tar.bz2 (Started on April 28, 2012 @ 19:07:37)
_ENV["sleep"] => /bin/sleep
_ENV["PWD"] => /usr/src/php-5.4.1
_ENV["lfs_user"] => yp58t
_ENV["mv"] => /bin/mv
_ENV["INPUTRC"] => /etc/inputrc
_ENV["LIBXCB_ALLOW_SLOPPY_LOCK"] => 1
_ENV["install_log"] => /etc/takenset/log/log_install
_ENV["ps"] => /bin/ps
_ENV["scripts_dir"] => /etc/takenset/blfs/scripts
_ENV["width"] => 150
_ENV["LANG"] => en_US
_ENV["TEST_PHP_EXECUTABLE"] => /usr/src/php-5.4.1/sapi/cli/php
_ENV["XORG_PREFIX"] => /usr
_ENV["global_remove_ext_tb"] => 1
_ENV["mktemp"] => /usr/bin/mktemp
_ENV["sec"] => 21
_ENV["profile"] => /etc/takenset/blfs
_ENV["global_temp_file5"] => /tmp/lfs_script.qH0DiJm4
_ENV["ping"] => /bin/ping
_ENV["in_chroot_install_dir"] => /usr/src
_ENV["mkdir"] => /bin/mkdir
_ENV["cp"] => /bin/cp
_ENV["global_temp_file4"] => /tmp/lfs_script.rXVIqxve
_ENV["return_string"] => 
_ENV["file_name_path"] => /home/yp58t/Sources/prog/php-5.4.1.tar.bz2
_ENV["HISTIGNORE"] => &:[bf]g:exit
_ENV["vi"] => /usr/bin/vi
_ENV["global_temp_file6"] => /tmp/lfs_script.GJ53mnIW
_ENV["global_temp_file1"] => /tmp/lfs_script.eseAAyNr
_ENV["shasum_file"] => /etc/takenset/SHASUM
_ENV["data_dir"] => /etc/takenset/blfs/data
_ENV["HOME"] => /home/yp58t
_ENV["SHLVL"] => 6
_ENV["batch_flag"] => 1
_ENV["chroot_dir"] => /mnt/lfs
_ENV["batch_min"] => 4
_ENV["tr"] => /usr/bin/tr
_ENV["global_temp_file3"] => /tmp/lfs_script.9YDLo2Mg
_ENV["global_temp_file2"] => /tmp/lfs_script.EPaFl0SK
_ENV["cut"] => /usr/bin/cut
_ENV["no_dialog"] => 0
_ENV["dialog"] => /usr/bin/dialog
_ENV["start_time"] => Started on April 28, 2012 @ 19:07:37
_ENV["global_list"] => 
_ENV["success"] => 1
_ENV["sha_alg"] => 1
_ENV["hour"] => 0
_ENV["LOGNAME"] => yp58t
_ENV["G_FILENAME_ENCODING"] => @locale
_ENV["screen_fail"] => 0
_ENV["min"] => 4
_ENV["WINDOW"] => 2
_ENV["tarball_base_name"] => php-5.4.1
_ENV["SSH_CONNECTION"] => deleted
_ENV["tar"] => /bin/tar
_ENV["unzip"] => /usr/bin/unzip
_ENV["PKG_CONFIG_PATH"] => :/usr/X11R6/lib/pkgconfig:/usr/X11R6/lib/pkgconfig
_ENV["global_no_dialog"] => 0
_ENV["find"] => /bin/find
_ENV["run_all_as_root"] => 1
_ENV["CC"] => cc
_ENV["gunzip"] => /bin/gunzip
_ENV["return_val_file"] => /tmp/lfs_script.1PFeK9xp
_ENV["init_user"] => yp58t
_ENV["su"] => /bin/su
_ENV["patch_src_dir"] => /home/yp58t/Sources/patch
_ENV["gen_title"] => Ta-Kenset - Profile: /etc/takenset/blfs
_ENV["md5sum"] => /usr/bin/md5sum
_ENV["prog_list"] => php-5.4.1
_ENV["clear"] => /usr/bin/clear
_ENV["times_file"] => /etc/takenset/blfs/prog_times
_ENV["single_program_listing"] => () {  program_selection "Select a program to install" "single" "Select" $@ || return 1
}
_ENV["check_structure"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_structure <path to program directory>" "check_structure";
 fi;
 local parent_dir=`${dirname} ${1}`;
 local bn=`${basename} ${1}`;
 local directory;
 local file;
 for directory in ${1} ${1}/log;
 do
 if ! check_for_directory ${directory}; then
 message "Missing directory: ${directory}" "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 if ! check_for_file ${1}/${file}; then
 message "Missing file: ${file}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 for j in mstr_conf df purl;
 do
 if [ ! -f "${parent_dir}/${j}" ]; then
 message "Missing file: ${j}." "Directory Structure Error For ${bn}";
 return 1;
 fi;
 done;
 return 0
}
_ENV["check_connection"] => () {  if `${cat} /tmp/con_status* | ${grep} -q "u" -`; then
 return 0;
 else
 message "Your internet connection is down.  Aborting the installation" "Internet Connection Down";
 return 1;
 fi
}
_ENV["save_log"] => () {  if [ $# -ne 2 ]; then
 message "Usage: save_log <prefix> <file to save>" "save_log";
 return 1;
 fi;
 if [ -z "${run_dir}" ] || [ ! -d "${run_dir}" ]; then
 message "Run directory for ${tarball_base_name} empty.  Logs for ${1} will not be saved." "Log Save Error";
 return;
 fi;
 if ! make_dir "${run_dir}/log"; then
 message "There was an error creating the log directory for ${tarball_base_name}!" "Log Directory Creation Error";
 return;
 fi;
 if ! make_file ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 ${echo} "Linux From Scratch, version ${profile}, log created on `date`." > ${run_dir}/log/${1};
 ${echo} "Created by user `whoami` (session initiated by ${init_user})" >> ${run_dir}/log/${1};
 ${echo} "" >> ${run_dir}/log/${1};
 if ! ${cat} ${2} >> ${run_dir}/log/${1}; then
 message "There was an error creating the log file, ${1}, for ${tarball_base_name}." "Log File Creation Error";
 return;
 fi;
 return
}
_ENV["directory_writable"] => () {  if [ $# -ne 1 ]; then
 message "Usage: directory_writable <directory>" "directory_writable";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 if ${touch} ${1}/test 2> /dev/null; then
 remove_file ${1}/test;
 return 0;
 else
 message "Your permissions do not allow you to write to directory '${1}'." "Directory Not Writable";
 return 1;
 fi
}
_ENV["remove_run_level"] => () {  if [ $# -ne 2 ]; then
 message "Usage: remove_run_level <tarball base name> <run level>" "remove_run_level";
 return 1;
 fi;
 local count=0;
 local list1="";
 local list2="";
 local scs=0;
 local dir1="" && export dir1;
 [ ! -d "${data_dir}/${1}" ] && return 0;
 list1="`ls ${data_dir}/${1}`";
 for i in ${list1};
 do
 [ "${i}" == "count" ] && continue;
 if are_digits ${i}; then
 count=$(( ++count ));
 fi;
 done;
 if [ ${count} -eq 0 ]; then
 message "There are no run-levels to display." "No Run-Levels";
 return 0;
 fi;
 while :; do
 if [ ${count} -eq 1 ]; then
 dir1="${data_dir}/${1}";
 if yesno_inquiry "Removal Of Data Directory: ${1}" "There is, at max, one run level for ${1}.  Delete the entire data directory?"; then
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${1}.\n\n";
 ${su} -c '(
              if ! remove_dir ${dir1}; then
                message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
                exit 5
              fi

              exit 0
            )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No data directory will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 else
 dir1="${data_dir}/${1}/${2}";
 if ! remove_dir ${dir1}; then
 while :; do
 clear;
 ${echo} -e "Enter root password to remove directory, ${dir1}.\n\n";
 ${su} -c '(
            if ! remove_dir ${dir1}; then
              message "An error occurred while trying to remove ${dir1}." "Directory Removal Error"
              exit 5
            fi

            exit 0
          )';
 return_val=$?;
 if [ ${error_in_chroot} -eq 5 ]; then
 break 2;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 message "No run level will be removed." "No Directory Removal";
 break 2;
 fi;
 fi;
 fi;
 break 2;
 done;
 fi;
 fi;
 break 1;
 done;
 unset dir1;
 return 0
}
_ENV["remove_dups"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 var1_rd="";
 var2_rd="";
 global_list="";
 for i in $@;
 do
 var2_rd=0;
 var1_rd="`${echo} ${i} | cut -d: -f1`";
 for j in ${global_list};
 do
 if [ "${var1_rd}" == "`${echo} ${j} | cut -d: -f1`" ]; then
 var2_rd=1;
 break 1;
 fi;
 done;
 [ ${var2_rd} -eq 0 ] && global_list="${global_list} ${i}";
 done;
 [ -z "${global_list}" ] && return 1;
 return 0
}
_ENV["create_structure"] => () {  if [ $# -lt 1 ]; then
 message "Usage: create_structure <path to tarball> [run level]" "create_structure";
 fi;
 run=1;
 [ ! -z "${2}" ] && run=${2};
 [ -z "${tarball_name}" ] && tarball_name=`${basename} ${1}`;
 [ -z "${tarball_base_name}" ] && return 1;
 local sub_pid1;
 height=15;
 width=90;
 calculate_dimensions;
 ${echo} "Creating file structure for ${tarball_base_name}..." > ${global_temp_file1};
 make_title "Create Program Structure";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 success=1;
 while :; do
 for dir in "${tarball_base_name}" "${tarball_base_name}/${run}" "${tarball_base_name}/${run}/log";
 do
 if ! check_for_directory "${data_dir}/${dir}"; then
 if ! make_dir "${data_dir}/${dir}"; then
 break 2;
 fi;
 fi;
 done;
 ${touch} "${data_dir}/${tarball_base_name}/mstr_conf" || break 1;
 move ${1} ${prog_src_dir} || break 1;
 for file in "df" "tb_name" "purl" "checksum";
 do
 make_file "${data_dir}/${tarball_base_name}/${file}" || break 2;
 [ "${file}" == "tb_name" ] && ${echo} "${tarball_name}" > ${data_dir}/${tarball_base_name}/${file};
 done;
 for file in "cf" "pre-cf" "post-cf" "mf" "mi" "make_check_test" "rpkg" "patch_list" "conf";
 do
 make_file "${data_dir}/${tarball_base_name}/${run}/${file}" || break 2;
 done;
 success=0;
 ${echo} "Successfully created structure for ${tarball_base_name}." >> ${global_temp_file1};
 break 1;
 done;
 if [ ${success} -eq 1 ]; then
 ${echo} "There was an error creating the structure for ${tarball_base_name}." >> ${global_temp_file1};
 fi;
 sleep 2;
 while file_empty ${global_temp_file2}; do
 sleep 1;
 done;
 sub_pid1=`${cat} ${global_temp_file2}`;
 kill_proc ${sub_pid1} || return 1;
 return ${success}
}
_ENV["verify_tarball_url"] => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_tarball_url <url1>" "verify_tarball_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\|https\)://.*\(bz2\|zip\|gz\|tgz\|zip\|xz\)$"; then
 return 0;
 else
 message "The supplied URL is invalid." "Invalid Program URL";
 return 1;
 fi
}
_ENV["compress_log"] => () {  [ ! -f "${1}" ] && return;
 local file="`${basename} ${1}`";
 local dir="`${dirname} ${1}`";
 cd ${dir};
 [ -f "${file}.tar.bz2" ] && remove_file "${file}.tar.bz2" &>/dev/null;
 ${tar} -cjf "${file}.tar.bz2" --remove-files ${file} &>/dev/null;
 return $?
}
_ENV["sec_to_time"] => () {  if [ $# -ne 1 ]; then
 message "Usage: sec_to_time <seconds>" "sec_to_time";
 return 1;
 fi;
 local var1="";
 local t_sec=0;
 total_sec=${1};
 batch_hour=0;
 batch_min=0;
 batch_sec=0;
 total_min=$(${echo} "scale=5; ${total_sec}/60" | bc);
 batch_min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${batch_min}" ] && batch_min=0;
 t1="`${echo} ${batch_min}*60 | bc`";
 batch_sec="$(${echo} ${total_sec}-${t1} | bc)";
 if [ ${batch_min} -ge 60 ]; then
 batch_hour=`${echo} "scale=5; ${batch_min}/60" | bc`;
 batch_hour=`${echo} ${batch_hour} | cut -d"." -f1`;
 t1=`${echo} "${batch_hour}*60" | bc`;
 batch_min=`${echo} "${batch_min}-${t1}" | bc`;
 fi;
 return 0
}
_ENV["chg_dir"] => () {  if cd ${1}; then
 return 0;
 else
 message "Unable to change to directory ${1}" "Change Directory";
 return 1;
 fi
}
_ENV["check_sig_patch"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_patch <file list>" "check_sig_patch";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 tb_name="`${echo} ${line} | ${cut} -d: -f1`";
 run="`${echo} ${line} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${tb_name}/${run}/patch_list && continue;
 if [ ${flag} -eq 0 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Patch" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 flag=$(( ++flag ));
 fi;
 for base_name in `${cat} ${data_dir}/${tb_name}/${run}/patch_list`;
 do
 `${echo} ${base_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 if ! find_file ${base_name} ${patch_src_dir}; then
 ${echo} "Unable to find patch, ${base_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 2;
 fi;
 ${echo} "Checking signature for patch ${base_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${grep} -m1 ${base_name} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${base_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 3;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${base_name}\" ${data_dir}/${tb_name}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${base_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${base_name}! @ `date`" >> ${install_log};
 error=0;
 break 3;
 else
 ${echo} "MD5: signature check passed for ${base_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${base_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 break 1;
 done;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_ENV["release_tarball"] => () {  if [ $# -lt 3 ]; then
 message "Usage: release_tarball <path to tarball source> <install dir> <removal flag> [append commands]" "release_tarball";
 return 1;
 fi;
 local sub_pid1;
 local command;
 local scs=1;
 local location="${2}/${tarball_base_name}";
 export location;
 return_val=0;
 if [ -d "${location}" ]; then
 remove_dir ${location};
 if [ $? -ne 0 ]; then
 if yesno_inquiry "Base-Directory Deletion" "Would you like to escalate your privileges and remove the base-directory '${tarball_base_name}'?"; then
 while true; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed with directory removal ***\n";
 ${su} -c '(
            remove_dir ${location} || exit 5

            exit 0
          )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 message "Removal of the directory, ${tarball_base_name}, was unsuccessful.  Aborting install." "Directory Removal Error";
 return 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 ontinue;
 else
 message "Privilege escalation was necessary to delete directory ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 else
 scs=0;
 fi;
 fi;
 break 1;
 done;
 else
 message "You elected not to delete the base-directory for ${tarball_base_name}.  Aborting install." "Installation Abort";
 return 1;
 fi;
 fi;
 fi;
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.bz2$"`; then
 command="${tar} --directory=${2} -xvjf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.gz$" -e "^.*\.tgz$"`; then
 command="${tar} --directory=${2} -xvzf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q -e "^.*\.tar\.lzma$"`; then
 command="${tar} --directory=${2} --lzma -xvf ${1} ${4}";
 else
 if `${echo} ${1} | ${grep} -q "^.*\.tar\.xz$"`; then
 xz_file="`${basename} ${1}`";
 tar_file="`${echo} ${xz_file} | ${sed} -e 's;\.xz;;g'`";
 command="copy ${1} ${2} && cd ${2} && ${xz} -d ${xz_file} && tar -xvf ${tar_file} && remove_file ${tar_file}";
 unset xz_file tar_file;
 else
 if `${echo} ${1} | ${grep} -q "^.*\.zip$"`; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 command="${unzip} -d ${2} ${1}";
 else
 command="${unzip} -d ${2}/${tarball_base_name} ${1}";
 fi;
 else
 message "Unable determine how to uncompress package, ${1}" "Uncompress Failure";
 return 1;
 fi;
 fi;
 fi;
 fi;
 fi;
 height=35;
 width=150;
 calculate_dimensions;
 eval ${command} > ${global_temp_file1} 2>&1 & sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Releasing ${tarball_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Releasing ${tarball_name} ($start_time)";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Unpacking ${tarball_base_name} into \Z1${2}\Zn... - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 kill_proc `${cat} ${global_temp_file2}`;
 ${sleep} 1;
 if [ ${return_val} -ne 0 ]; then
 message "Error uncompressing ${tarball_base_name}" "Uncompress Failure";
 return 1;
 fi;
 return 0
}
_ENV["check_remote_file_exists"] => () {  if [ $# -ne 1 ]; then
 message "check_remote_file_exists <url>" "check_remote_file_exists";
 return 1;
 fi;
 local pid1;
 check_connection || return 1;
 ${wget} -v --tries 2 --timeout=40 --spider ${1} &>${global_temp_file3} & pid1=$!;
 wait ${pid1};
 return_val=$?;
 [ ${return_val} -ne 0 ] && return 1;
 ${grep} -iq -e "No such file" -e "unable to resolve" -e "HTTP_NOT_FOUND" -e "Invalid PORT" -e "Remote file does not exist" -e "not retrieving" ${global_temp_file3};
 return_val=$?;
 [ ${return_val} -eq 0 ] && return 1;
 return 0
}
_ENV["chg_file_owner"] => () {  if [ $# -ne 2 ]; then
 message "Usage: chg_file_owner <new owner> <file>" "chg_file_owner";
 return 1;
 fi;
 if ! ${chown} "${1}:${1}" "${2}"; then
 message "There was an error changing ownership of file ${2} to ${1}." "Message";
 fi
}
_ENV["display_batch_list"] => () {  if [ $# -eq 0 ]; then
 make_title "Batch List Display";
 ${dialog} --backtitle "${main_title}" --colors --infobox "\Z1Batch list is empty.\Zn" 8 60 1>&0;
 sleep 2;
 return 0;
 fi;
 local command;
 local file2_dbl;
 local description_dbl;
 local count=0;
 height=20;
 width=130;
 calculate_dimensions;
 make_title "Batch List Display";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"Remove\" --cancel-label \"Prev\"     --extra-button --extra-label \"Clear\" --menu \"Current batch list\" ${height} ${width} ${height} ";
 for i in $@;
 do
 count=$(( ++count ));
 if `${echo} ${i} | ${grep} -iq "script:"`; then
 file2_dbl="`${echo} ${i} | cut -d: -f2 | ${sed} -e 's;^\s+;;g'`";
 description_dbl="`${cat} ${file2_dbl} | ${grep} -i "^#Desc:.*" | ${sed} -e 's;^#Desc:;;g'`";
 [ -z "${description_dbl}" ] && description_dbl="No description";
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  `${basename} ${i}`\" \"SCRIPT: ${description_dbl}\" ";
 else
 file2_dbl="${data_dir}/${i}/df";
 if ! file_empty ${file2_dbl}; then
 description_dbl=`${cat} ${file2_dbl}`;
 else
 description_dbl="No description";
 fi;
 description_dbl="${description_dbl:0:255}";
 command="${command} \"${count}.  ${i}\" \"${description_dbl}\" ";
 fi;
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return $?
}
_ENV["main_window"] => () {  height=35;
 width=100;
 calculate_dimensions;
 make_title "Main Selection Window";
 command="${dialog} --backtitle \"${main_title}\" --cancel-label \"Exit\" ";
 command="${command} --menu \"What would you like to do?\n\" ${height} ${width} 50 \"Install\" \"Configure & Install A Program\" ";
 command="${command} \"Check Config\" \"Review Program Configuration\" ";
 command="${command} \"Get Program\" \"Download New Program & Create Directory Structure\" ";
 command="${command} \"Create Batch\" \"Create A Batch File\" ";
 command="${command} \"Edit Batch\" \"Edit A Batch File\" ";
 command="${command} \"Run Batch\" \"Load An Existing Batch File\" ";
 command="${command} \"Edit MD5/SHA Checksum\" \"Edit File Signatures\" ";
 if [ -f "${profile}/requisites" ]; then
 command="${command} \"Version Check\" \"Host System Program Requirement Versions\" ";
 fi;
 command="${command} \"Variables\" \"View & Set Variables\" ";
 command="${command} \"Scripts\" \"Run & Edit Scripts\" ";
 command="${command} \"Shell\" \"Run shell\"";
 command="${command} \"About\" \"\"";
 eval ${command} 2> ${global_temp_file5};
 return $?
}
_ENV["script_options"] => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options <file>" "script_options";
 return 1;
 fi;
 local command;
 selection="";
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Options";
 get_time "`${basename} ${1}`" "-";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '${1}' Options (Run Time: ${hour}h ${min}m ${sec}s)\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Execute\" \"\" off";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"Move File\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
_ENV["copy"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 if [ -d "${1}" ]; then
 ${cp} -r "${1}" "${2}";
 else
 if [ -f "${1}" ]; then
 ${cp} "${1}" "${2}";
 fi;
 fi;
 if [ $? -eq 1 ]; then
 message "Unable to copy ${1} to ${2}." "Copy Error";
 return 1;
 fi;
 return 0
}
_ENV["retrieve_pkg"] => () {  if [ $# -ne 2 ]; then
 message "Usage: retrieve_pkg <url> <install dir>" "retrieve_pkg";
 return 1;
 fi;
 height=20;
 width=135;
 calculate_dimensions;
 local sub_pid1;
 clear_global_files;
 ${echo} "Retrieving file ${1}..." > ${global_temp_file3};
 ${echo} "" >> ${global_temp_file3};
 make_title "Retrieving ${1}";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Retrieval Of ${1}" --no-kill --tailboxbg "${global_temp_file3}" ${height} ${width} 2> ${global_temp_file4};
 while file_empty ${global_temp_file4}; do
 ${sleep} 1;
 done;
 fi;
 ${wget} -v --timeout=30 --directory-prefix=${2} -o /dev/null ${1} & sub_pid1=$!;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file4}`;
 if [ ${return_val} -ne 0 ]; then
 message "Failed to download `${basename} ${1}` at ${1}" "Download Failure";
 fi;
 return 0
}
_ENV["get_time"] => () {  if [ $# -ne 2 ]; then
 message "Usage: get_time <search-for name> <run level or '-' for script>" "get_time";
 return 1;
 fi;
 local t1=0;
 local total_min=0;
 local t_sec=0;
 local line;
 hour=0;
 min=0;
 sec=0;
 [ ! -f "${times_file}" ] && return 0;
 if [ "${2}" == "-" ]; then
 line=`${grep} "^${1}:-.*" ${times_file}`;
 else
 if [ "${2}" != "-" ]; then
 line=`${grep} "^${1}:${2}.*" ${times_file}`;
 else
 return;
 fi;
 fi;
 [ -z "${line}" ] && return 0;
 t_sec="`${echo} ${line} | cut -d: -f3`";
 total_sec=$(( total_sec + t_sec ));
 [ ${total_sec} -eq 0 ] && return;
 total_min=$(${echo} "scale=5; ${t_sec}/60" | bc);
 min="`${echo} ${total_min} | cut -d"." -f1`";
 [ -z "${min}" ] && min=0;
 t1="`${echo} ${min}*60 | bc`";
 sec="$(${echo} ${t_sec}-${t1} | bc)";
 if [ ${min} -ge 60 ]; then
 hour=`${echo} "scale=5; ${min}/60" | bc`;
 hour=`${echo} ${hour} | cut -d"." -f1`;
 t1=`${echo} "${hour}*60" | bc`;
 min=`${echo} "${min}-${t1}" | bc`;
 fi;
 return
}
_ENV["global_script_run_root"] => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run_root <path to script> <title>" "global_script_run_root";
 return 1;
 fi;
 local scs=0;
 local return_val=0;
 export path=${1};
 export title=${2};
 if ! root; then
 while :; do
 ${clear};
 ${echo} "*** Enter root password to proceed with installation of ${title} ***";
 ${su} -c '(
        global_script_run "${path}" "${title}" || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 if ! global_script_run "${path}" "${title}"; then
 return_val=1;
 fi;
 fi;
 export -n path title error_in_chroot;
 return ${return_val}
}
_ENV["yesno_inquiry"] => () {  if [ $# -ne 2 ]; then
 message "Usage: yesno_inquiry <title> <prompt>" "yesno_inquiry";
 return 1;
 fi;
 make_title "Inquiry";
 ${dialog} --backtitle "${main_title}" --colors --title "${1}" --yesno "${2}" 15 100;
 [ $? -eq 1 ] && return 1;
 return 0
}
_ENV["global_script_run"] => () {  if [ $# -ne 2 ]; then
 message "Usage: global_script_run <path to script> <title>" "global_script_run";
 return 1;
 fi;
 declare -i j=0;
 local var1;
 local sub_pid1;
 local sub_pid2;
 local env_cmd="";
 var1=${2};
 check_for_directory "${release_dir}/${tarball_base_name}" || return 1;
 make_executable_file ${global_temp_file2} || return 1;
 if `${grep} -q "#build" ${prog_dir}/mstr_conf`; then
 if ! check_for_directory "${release_dir}/${tarball_base_name}/build"; then
 make_dir "${release_dir}/${tarball_base_name}/build" || return 1;
 fi;
 ${echo} -e "cd ${install_dir}/${tarball_base_name}/build\n" > ${global_temp_file2};
 else
 ${echo} -e "cd ${install_dir}/${tarball_base_name}\n" > ${global_temp_file2};
 fi;
 ${cat} ${1} >> ${global_temp_file2};
 height=35;
 width=150;
 calculate_dimensions;
 if `${grep} -m1 -q "^#pre_lfs" ${run_dir}/conf`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 ${clear};
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 else
 ${clear};
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} > ${global_temp_file1};
 return_val=$?;
 else
 ${tail} -f ${global_temp_file1} & tail_pid=$!;
 ${global_temp_file2} &>${global_temp_file1} & cmd_pid=$!;
 wait ${cmd_pid};
 return_val=$?;
 fi;
 fi;
 kill ${tail_pid};
 else
 if `${grep} -m1 -q "^#chroot_flag" ${run_dir}/conf`; then
 copy ${global_temp_file2} ${chroot_dir}/tmp || return 1;
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} | tee ${global_temp_file1} &
 else
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/tmp TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file2} &>${global_temp_file1} &
 fi;
 else
 if `${grep} -m1 -q "^#no_redirect" ${global_temp_file2}`; then
 ${global_temp_file2} | tee ${global_temp_file1} &
 else
 ${global_temp_file2} &>${global_temp_file1} &
 fi;
 fi;
 sub_pid1=$!;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "${var1} Of ${tarball_base_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "${var1} Of ${tarball_base_name} (${start_time})";
 fi;
 if debug; then
 :;
 else
 ${dialog} --colors --backtitle "${main_title}" --title "Run level ${run} - \Z1Estimated build time: ${hour}h:${min}m:${sec}s\Zn" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file3};
 while file_empty ${global_temp_file3}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 ${sleep} 2;
 return_val=$?;
 kill_proc `${cat} ${global_temp_file3}`;
 fi;
 if [ ${return_val} -eq 0 ]; then
 ${sleep} 2;
 else
 ${sleep} 3;
 fi;
 ${rm} -f ${chroot_dir}/tmp/lfs* &>/dev/null;
 if [ ${return_val} -ne 0 ]; then
 return 1;
 else
 return 0;
 fi
}
_ENV["are_digits"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_dups <list>" "remove_dups";
 return 1;
 fi;
 if `${echo} ${1} | ${grep} -q -e "\." -e "[^0-9]"`; then
 return 1;
 else
 return 0;
 fi
}
_ENV["calculate_dimensions"] => () {  local value;
 local max_ht=0;
 local max_wd=0;
 value=`stty size`;
 max_ht=`${echo} ${value} | cut -d" " -f1`;
 max_wd=`${echo} ${value} | cut -d" " -f2`;
 max_ht=$(( max_ht - 10 ));
 max_wd=$(( max_wd - 10 ));
 [ ${height} -le ${max_ht} ] || height=${max_ht};
 [ ${width} -le ${max_wd} ] || width=${max_wd};
 return 0
}
_ENV["check_sig_rpkg"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_rpkg <file list>" "check_sig_rpkg";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local rp_name;
 local sig1;
 local sig2;
 local list;
 local error=1;
 local flag=0;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 run="`${echo} ${line} | ${cut} -d: -f2`";
 prog="`${echo} ${line} | ${cut} -d: -f1`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Required Tarballs For ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 list="`${cat} ${data_dir}/${prog}/${run}/rpkg`";
 for rp_name in ${list};
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 if ! find_file ${rp_name} ${prog_src_dir}; then
 ${echo} "Unable to find required package ${rp_name}..." > ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Checking ${rp_name}..." >> ${global_temp_file1};
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${grep} -m1 ${rp_name} ${data_dir}/${prog}/checksum | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA (algorithm ${sha_alg}): Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 2;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${grep} -m1 \"${rp_name}\" ${data_dir}/${prog}/checksum | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${rp_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${rp_name}! @ `date`" >> ${install_log};
 error=1;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${rp_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${rp_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 ${sleep} 2;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 flag=0;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 [ ${error} -eq 0 ] && break 1;
 done;
 ${sleep} 1;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_ENV["get_tarball_base_from_tb"] => () {  if [ $# -gt 2 ]; then
 message "Usage: get_tarball_base_from_tb <path to tarball> [remove tmp file]" "get_tarball_base_from_tb";
 return 1;
 fi;
 rm_file=${2:-0};
 local sub_pid1;
 if [ ! -e "${1}" ]; then
 message "Unable to find tarball `${basename} ${1}`." "Tarball Find Failure";
 return 1;
 fi;
 local scs=0;
 while :; do
 if ${echo} "${1}" | ${grep} -q -e "^.*xz$"; then
 bn="`${basename} ${1}`";
 bu="${bn}.bk";
 [ ! -f "/tmp/${bn}" ] && copy ${1} /tmp;
 copy "${1}" "/tmp/${bu}";
 ${xz} -d "/tmp/${bn}";
 bn="`${echo} ${bn} | ${sed} -e 's;\.xz$;;g'`";
 ${tar} -t -f /tmp/${bn} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 remove_file "/tmp/${bn}";
 if [ ${rm_file} -eq 0 ]; then
 remove_file "/tmp/${bu}" || return 1;
 else
 move "/tmp/${bu}" "/tmp/${bn}.xz" || return 1;
 fi;
 else
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 ${unzip} -l ${1} &>${global_temp_file1};
 else
 ${tar} -t -f ${1} &>${global_temp_file1} & sub_pid1=$!;
 wait ${sub_pid1};
 fi;
 fi;
 if `file_empty ${global_temp_file1}`; then
 message "Unable to get tarball base name from temporary file for `${basename} ${1}`." "Tarball Base Name Retrieval";
 scs=1;
 break 1;
 fi;
 if ${echo} "${1}" | ${grep} -q -e "^.*zip$"; then
 temp_name="`${sed} -n 4p ${global_temp_file1} | ${sed} -e 's;^\ *;;g' | ${cut} -d" " -f7`";
 if `${echo} ${temp_name} | ${grep} -q "\/$"`; then
 tarball_base_name="`${echo} ${temp_name} | ${sed} -e 's;\(^.*\)\/;\1;g'`";
 else
 tarball_base_name="`${basename} ${1} | ${sed} -e 's;\(^.*\)\.zip;\1;g'`";
 fi;
 else
 tarball_base_name=`${grep} -m1 "\(^[^/]\+\)\/.*$" ${global_temp_file1} | ${sed} -e 's;\(^[^/]\+\)\/.*$;\1;g'`;
 fi;
 tarball_base_name="`${echo} ${tarball_base_name} | tr ' ' '_'`";
 break 1;
 done;
 return ${scs}
}
_ENV["batch_program_and_script_screen"] => () {  if [ $# -lt 1 ]; then
 message "Usage: batch_program_and_script_screen <prog_list>" "batch_program_and_script_screen";
 return 1;
 fi;
 prog_list="";
 old_prog_list="";
 local count_bp=0;
 local selection_bpss;
 while :; do
 height=10;
 width=65;
 calculate_dimensions;
 make_title "Batch Script Selection";
 ${dialog} --backtitle "${main_title}" --no-cancel --radiolist "Select either programs or scripts to add to the batch list" ${height} ${width} ${height} "Add program(s)" "" off "Add script(s)" "" off "View Current List" "" off 2> ${global_temp_file4};
 return_val=$?;
 selection_bpss="`${cat} ${global_temp_file4}`";
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && [ -z "${selection_bpss}" ] && return 0;
 case ${selection_bpss} in 
 "Add program(s)")
 while :; do
 please_wait;
 old_prog_list=${prog_list};
 batch_program_listing $@;
 return_val=$?;
 if [ ! -z "${prog_list}" ]; then
 prog_list="${old_prog_list} ${prog_list}";
 else
 prog_list="${old_prog_list}";
 fi;
 kill_please_wait;
 [ $return_val -eq 1 ] && break 1;
 done
 ;;
 "Add script(s)")
 local y;
 local directory_bpss="";
 local scripts_bpss="";
 local script_bpss="";
 y=`ls ${scripts_dir}`;
 if [ ! -z "$y" ]; then
 while :; do
 select_from_list "Select a script directory" `ls ${scripts_dir}` || break 1;
 directory_bpss=${selection};
 scripts_bpss=`ls ${scripts_dir}/${directory_bpss}`;
 if [ -z "${scripts_bpss}" ]; then
 message "No scripts to select!" "No Scripts Found";
 continue;
 fi;
 select_from_list "Select a script" ${scripts_bpss} || continue;
 script_bpss=${selection};
 [ -z "${script_bpss}" ] && continue;
 ${echo} "script:${scripts_dir}/${directory_bpss}/${script_bpss}" >> ${batch_file};
 prog_list="${prog_list} script:${scripts_dir}/${directory_bpss}/${script_bpss}";
 break 1;
 done;
 else
 message "No script directories to select!" "No Script Directories Found";
 fi;
 unset y
 ;;
 "View Current List")
 display_batch_list ${prog_list};
 case $? in 
 0)
 if [ ! -z "${prog_list}" ]; then
 remove_prog=`${cat} ${global_temp_file1}`;
 [ -z "remove_prog" ] && continue;
 line_no=${remove_prog:0:1};
 remove_prog=`${echo} ${remove_prog} | cut -d" " -f2`;
 if yesno_inquiry "Confirm Removal" "Are you sure that you want to remove the entry '${remove_prog}'?"; then
 old_prog_list=${prog_list};
 prog_list="";
 count_bp=1;
 for j in ${old_prog_list};
 do
 [ $(( count_bp++ )) -eq ${line_no} ] && continue;
 prog_list="${prog_list} ${j}";
 done;
 if [ -f "${batch_file}" ]; then
 eval ${sed} -i "${line_no}d" ${batch_file};
 else
 message "Unable to locate the batch file!" "Batch File Error";
 return 1;
 fi;
 fi;
 unset remove_prog old_prog_list;
 fi
 ;;
 3)
 if yesno_inquiry "Confirm Clearing Of List" "Are you sure that you want to clear the batch list?"; then
 prog_list="";
 clear_file "${global_temp_file1}" || return 1;
 clear_file "${batch_file}" || return 1;
 fi
 ;;
 esac
 ;;
 esac;
 done
}
_ENV["download_prog"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_prog <program list>" "download_prog ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local scs;
 local found;
 local list1="";
 local list2="";
 local command="";
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 scs=1;
 found=1;
 tarball_name="";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 if ! file_empty ${data_dir}/${prog}/tb_name; then
 tarball_name=`${cat} ${data_dir}/${prog}/tb_name`;
 if [ ! -z "${tarball_name}" ]; then
 tarball_in_string ${tarball_name};
 scs=0;
 fi;
 fi;
 if [ ${scs} -eq 1 ]; then
 list1="`${grep} ${prog} ${shasum_file}`";
 z=0;
 for i in ${list1};
 do
 if `${echo} ${i} | ${grep} -q "${prog}\.\(tar\|tzg\|zip\|xz\|lzma\).*"`; then
 list2="${list2} ${i}";
 else
 continue;
 fi;
 z=$(( ++z ));
 done;
 if [ ${z} -gt 1 ]; then
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Choose A Tarball For Installation";
 command="${dialog} --backtitle \"${main_title}\" --menu \"Select the tarball to use\" ${height} ${width} ${height}";
 z=1;
 for i in ${list};
 do
 command="${command} \"${z}. ${i}\" \"\"";
 z=$(( ++z ));
 done;
 eval ${command} 2> ${global_temp_file1};
 tarball_name="`${cat} ${global_temp_file1} | ${cut} -d\" \" -f2`";
 else
 tarball_name="${list2}";
 fi;
 unset z;
 if [ ! -z "${tarball_name}" ]; then
 [ ! -f "${data_dir}/${prog}/tb_name" ] && ${touch} "${data_dir}/${prog}/tb_name";
 ${echo} "${tarball_name}" > "${data_dir}/${prog}/tb_name";
 fi;
 fi;
 if [ -z "${tarball_name}" ]; then
 message "Unable to set tarball name for ${prog}." "Unable To Set Tarball Name";
 return 1;
 fi;
 tarball_name="`trim_spaces ${tarball_name}`";
 if find_file ${tarball_name} ${prog_src_dir}; then
 path="${file_name_path}";
 [ ! -z "${path}" ] && found=0;
 fi;
 if [ ${found} -eq 1 ]; then
 if ! file_empty "${profile}/mstr_urls"; then
 scs=1;
 height=20;
 width=120;
 list1="";
 calculate_dimensions;
 check_connection || return 1;
 ${echo} "Searching for ${tarball_name}..." > ${global_temp_file1};
 make_title "Tarball Search For ${tarball_name}";
 ${dialog} --backtitle "${main_title}" --title "Tarball Search For ${tarball_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;\(^.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 for line in ${list1};
 do
 `${echo} ${line} | ${grep} -iq -e "^#.*$" -e "^$" -` && continue;
 url="`${echo} ${line}/${tarball_name}`";
 if verify_tarball_url "${url}"; then
 ${echo} "Searching at ${line}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Found at ${url}..." >> ${global_temp_file1};
 ${sleep} 2;
 found=0;
 ${echo} "${line}" > "${data_dir}/${prog}/purl";
 break 1;
 fi;
 fi;
 done;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 fi;
 else
 scs=0;
 fi;
 if [ ${scs} -eq 1 ] && [ ${found} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${line}/${tarball_name}" /tmp; then
 message "Unable to download ${name} from ${line}" "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 while :; do
 prompt_for_value "Program URL" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${tarball_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 return 1;
 fi;
 fi;
 break 1;
 done;
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 if check_remote_file_exists "${prompt_value}"; then
 located=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 tarball_name=`${basename} ${prompt_value}`;
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && ${echo} "${url_dir}" >> ${profile}/mstr_urls;
 ${echo} "${url_dir}" > "${data_dir}/${prog}/purl";
 fi;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 if [ ${located} -eq 0 ]; then
 check_connection || return 1;
 if ! retrieve_pkg "${prompt_value}" /tmp; then
 message "Unable to download ${tarball_name} from ${url_dir}." "File Download Failed";
 return 1;
 fi;
 if [ ! -f "/tmp/${tarball_name}" ]; then
 message "Tarball file not found in /tmp directory." "Tarball Not Found";
 return 1;
 fi;
 if ! move "/tmp/${tarball_name}" "${prog_src_dir}"; then
 message "Unable to move file ${tarball_name} to source directory." "Tarball File Move Error";
 return 1;
 fi;
 scs=0;
 fi;
 fi;
 done;
 return 0
}
_ENV["log_viewer"] => () {  if [ $# -ne 2 ]; then
 message "Usage: log_viewer <tarball base name> <run level>" "log_viewer";
 return 1;
 fi;
 local scs=0;
 while :; do
 [ ! -d "${data_dir}/${1}/${2}/log" ] && message "Unable to find log directory for ${1}." "No Log Directory" && return 1;
 local list1="`ls ${data_dir}/${1}/${2}/log`";
 if [ -z "${list1}" ]; then
 message "There are no log files to view for ${1} (run level ${2})." "No Log Files";
 break 1;
 fi;
 local command="";
 make_title "Log File Viewer";
 command="${dialog} --colors --backtitle \"${main_title}\" --title \"${1} - run level: ${run}\" --cancel-label \"Prev\"       --radiolist \"Log files for ${1}\" 20 90 20";
 for i in ${list1};
 do
 command="${command} \"${i}\" \"\" \"off\"";
 done;
 eval ${command} 2> ${global_temp_file2};
 return_val=$?;
 if [ ${return_val} -ne 0 ] || file_empty ${global_temp_file2}; then
 break 1;
 else
 local file="`${cat} ${global_temp_file2}`";
 local file2="";
 [ -z "${file}" ] && return 1;
 if ! check_for_file "${data_dir}/${1}/${2}/log/${file}"; then
 message "Unable to find log file '${file}'." "Log File Not Found";
 scs=1;
 break 1;
 fi;
 if `${echo} $file | ${grep} -q ".*bz2$"`; then
 file2="`${echo} $file | ${sed} -e 's;\.tar\.bz2;;g' -e 's;\.old;;g'`";
 ${tar} -C /tmp -xjf "${data_dir}/${1}/${2}/log/${file}";
 else
 message "Unknown extension; unable to extract log data for ${1}." "Extraction Error";
 scs=1;
 break 1;
 fi;
 if [ ! -f "/tmp/${file2}" ]; then
 message "Failed to locate the uncompressed log file in the tmp directory." "Log File Not Found";
 scs=1;
 break 1;
 else
 if ! edit_file "/tmp/${file2}" "1"; then
 message "There was an error editing the file, '${file}', for ${1}." "File Edit Error";
 fi;
 fi;
 remove_file "/tmp/${file2}";
 fi;
 done;
 return ${scs}
}
_ENV["file_empty"] => () {  if [ $# -ne 1 ]; then
 message "Usage: file_empty <path to file>" "file_empty";
 return 1;
 fi;
 local var1;
 [ ! -e "${1}" ] && return 0;
 var1=`${cat} ${1}`;
 [ -z "${var1}" ] && return 0;
 unset var1;
 return 1
}
_ENV["update_time"] => () {  if [ $# -ne 3 ]; then
 message "Usage: update_time <tarball base name or script name> <run level (or - for script)> <new_time>" "update_time";
 return 1;
 fi;
 local sec=${3};
 [ ! -f "${times_file}" ] && ${touch} ${times_file};
 sec=$(( sec + 0 ));
 if [ "${2}" == "-" ]; then
 if `${grep} -q ${1}:-:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:-:.*$;${1}:-:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:-:${sec}" >> ${times_file} || return 1;
 fi;
 else
 if `${grep} -q ${1}:${2}:* ${times_file}`; then
 ${sed} -i -e "s;^${1}:${2}:.*$;${1}:${2}:${sec};g" ${times_file} || return 1;
 else
 ${echo} "${1}:${2}:${sec}" >> ${times_file} || return 1;
 fi;
 fi;
 return 0
}
_ENV["get_run_level"] => () {  if [ $# -ne 1 ]; then
 message "Usage: get_run_level <program name>" "get_run_level";
 return 1;
 fi;
 local var1_grl=${1};
 local list1_grl="";
 local list2_grl="";
 local command="";
 local count=0;
 local desc="";
 list1_grl=`ls ${data_dir}/${var1_grl}`;
 for i in ${list1_grl};
 do
 [ "${i}" == "list1_grl" ] && continue;
 ! are_digits "${i}" && continue;
 list2_grl="${list2_grl} ${i}" && count=$(( ++count ));
 done;
 [ -z "${list2_grl}" ] && return 1;
 if [ ${count} -le 1 ]; then
 run=1;
 return 0;
 else
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 command="${dialog} --backtitle \"${gen_title}\" --no-cancel --ok-label \"Submit\" --title \"Multiple run levels found for ${var1_grl}\"         --radiolist \"Select a run level\" ${height} ${width} 20 ";
 for i in ${list2_grl};
 do
 desc="`${grep} '^#Desc:.*$' ${data_dir}/${var1_grl}/${i}/conf`";
 if [ ! -z "${desc}" ]; then
 desc="`${echo} ${desc} | ${sed} -e 's;^#Desc:\ *\(.*$\);\1;g'`";
 else
 desc="No Description Found";
 fi;
 desc="${desc:0:255}";
 command="${command} \"${i}\" \"${desc}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 [ ${return_val} -eq 0 ] && file_empty ${global_temp_file1} && break 1;
 if ! file_empty ${global_temp_file1}; then
 run=`${cat} ${global_temp_file1}`;
 break 1;
 fi;
 done;
 [ -z "${run}" ] && run=1;
 return 0;
 fi
}
_ENV["add_addl_run_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: add_addl_run_dir <program base name>" "add_addl_run_dir";
 fi;
 yesno_inquiry "Add Run Directory" "You chose to add an additional run-level.  Is this correct?" || return 1;
 local success=1;
 local make_copy=0;
 local next=0;
 current=0 && export current;
 highest_run_level ${1} || return 1;
 next=$((current+1));
 if yesno_inquiry "Copy Directory" "Would you like to copy the most recent run level (${current}) to the new run level (${next})?"; then
 make_copy=0;
 else
 make_copy=1;
 fi;
 height=20;
 width=120;
 calculate_dimensions;
 case ${make_copy} in 
 "0")
 ${echo} "Copying file structure for ${tarball_base_name}..." > ${global_temp_file1}
 ;;
 "1")
 ${echo} "Creating file structure for ${tarball_base_name}, run-level ${next}..." > ${global_temp_file1}
 ;;
 esac;
 ${echo} "" >> ${global_temp_file1};
 make_title "Additional Run Level";
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 case ${make_copy} in 
 "0")
 if ! copy "${prog_dir}/${current}" "${prog_dir}/${next}"; then
 ${echo} "An error occurred copying data to the new run level!" >> ${global_temp_file1};
 else
 ${echo} "Copied run level ${current} to new run level ${next} for ${1}..." >> ${global_temp_file1};
 success=0;
 fi
 ;;
 "1")
 while :; do
 for dir in "${prog_dir}/${next}" "${prog_dir}/${next}/ef" "${prog_dir}/${next}/log";
 do
 if ! check_for_directory "${dir}"; then
 make_dir "${dir}" || break 2;
 fi;
 done;
 for file in "cf" "pre-cf" "post-cf" "ip" "mf" "mi" "make_check_test" "pf" "rpkg" "patch_list" "conf";
 do
 make_file "${prog_dir}/${next}/${file}" || break 2;
 done;
 success=0;
 break 1;
 done;
 if [ ${success} -eq 0 ]; then
 ${echo} "Creation of run-level ${next} for ${tarball_base_name} successful..." >> ${global_temp_file1};
 else
 if [ ${success} -eq 1 ]; then
 ${echo} "An error occurred in the creation of run-level ${next} for ${tarball_base_name}!" >> ${global_temp_file1};
 fi;
 fi
 ;;
 esac;
 ${sleep} 3;
 kill_proc `${cat} ${global_temp_file2}` || exit 1;
 export -n current;
 return ${success}
}
_ENV["check_for_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_for_file <file path>" "check_for_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 1;
 return 0
}
_ENV["create_directory_listing"] => () {  if [ $# -ne 1 ]; then
 message "Usage: create_program_list <directory>" "create_program_list";
 return 1;
 else
 if [ ! -d "${1}" ]; then
 message "Argument ${1} is not a directory." "create_program_list";
 return 1;
 fi;
 fi;
 prog_list="";
 for i in `ls ${1}`;
 do
 [ -z "${i}" ] && break 1;
 [ ! -d "${1}/${i}" ] && continue;
 prog_list="${prog_list} ${i}";
 done;
 if [ -z "${prog_list}" ]; then
 message "Empty program listing!" "Directory Listing Creation";
 return 1;
 else
 return 0;
 fi
}
_ENV["trim_spaces"] => () {  if [ $# -lt 1 ]; then
 message "Usage: trim_spaces <string(s)>" "trim_space";
 return 1;
 fi;
 ${echo} ${1} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"
}
_ENV["make_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_dir <path>" "make_dir";
 return 1;
 fi;
 [ -d "${1}" ] && return 0;
 if ! ${mkdir} -p ${1} &>/dev/null; then
 message "Unable to make directory ${1}" "Make directory";
 return 1;
 fi;
 if ! eval ${chmod} 775 ${1} || ! eval ${chmod} ug+s ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 return 0
}
_ENV["download_patch"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_patch <program list>" "download_patch";
 return 1;
 fi;
 clear_global_files;
 local prog;
 local run;
 local list1="";
 local list2="";
 local found;
 local patch_name;
 for line in $@;
 do
 `${echo} ${line} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 error=0;
 prog="`${echo} ${line} | cut -d: -f1`";
 run="`${echo} ${line} | cut -d: -f2`";
 file_empty "${data_dir}/${prog}/${run}/patch_list" && continue;
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Patch Search For ${prog}";
 IFS=$(${echo} -e "\n\r");
 for patch_name in `${cat} ${data_dir}/${prog}/${run}/patch_list`;
 do
 `${echo} ${patch_name} | ${grep} -iq -e '^#.*' -e '^$' -e '^script:.*' -` && continue;
 found=1;
 scs=1;
 unset IFS;
 find_file ${patch_name} ${patch_src_dir} && continue;
 IFS=$(${echo} -e "\n\r");
 ${dialog} --backtitle "${main_title}" --title "Patch Search - ${prog}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ${echo} "Searching for patch, ${patch_name}..." > ${global_temp_file1};
 ${echo} "" >> ${global_temp_file1};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`head -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 for h in `${cat} "${profile}/mstr_urls"`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 `${echo} ${url} | ${grep} -iq -e '^#.*' -e '^$' -` && continue;
 ${echo} "Searching at ${url}..." >> ${global_temp_file1};
 url="${url}/${patch_name}";
 url="${url:0:255}";
 ! verify_url ${url} && continue;
 if ! check_connection; then
 ${echo} "Network connection failed...please check." >> ${global_temp_file1};
 error=1;
 break 1;
 fi;
 check_remote_file_exists ${url};
 rt=$?;
 if [ ${rt} -eq 0 ]; then
 ${echo} "" >> ${global_temp_file1};
 ${echo} "Patch ${patch_name} found at ${url}." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 [ ${error} -eq 1 ] && break 1;
 clear_global_files;
 if [ ${found} -ne 0 ]; then
 while :; do
 if ! prompt_for_value "Patch URL" "Enter URL for patch '${patch_name}'" "URL"; then
 return 1;
 fi;
 if [ -z "${prompt_value}" ]; then
 if yesno_inquiry "Try Again?" "No URL was entered.  Would you like to try again?"; then
 continue;
 else
 error=1;
 break 3;
 fi;
 fi;
 break 1;
 done;
 if ! verify_url ${prompt_value}; then
 message "Unable to verify URL for patch, ${patch_name}." "Failed URL Verification";
 error=1;
 break 2;
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=0;
 break 2;
 fi;
 clear_global_files;
 if ! check_remote_file_exists ${prompt_value}; then
 message "Patch, ${patch_name}, does not exist at the supplied URL, ${url}...exiting." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 url="${prompt_value:0:255}";
 fi;
 if ! ${grep} -iq "`${dirname} ${url}`" "${profile}/mstr_urls"; then
 ${echo} "`${dirname} ${url}`" >> "${profile}/mstr_urls";
 fi;
 if ! check_connection; then
 message "Network connection failed...please check." "Remote File Non-Existent";
 error=1;
 break 2;
 fi;
 clear_global_files;
 if ! retrieve_pkg ${url} /tmp; then
 message "Unable to retrieve required tarball, ${patch_name}." "Patch Tarball Retrieval Error";
 error=1;
 break 2;
 fi;
 if [ ! -f "/tmp/${patch_name}" ]; then
 message "Unable to find the patch, ${patch_name}, in the /tmp directory.";
 error=1;
 break 1;
 fi;
 if ! move "/tmp/${patch_name}" "${patch_src_dir}"; then
 message "There was an error moving patch ${patch_name} to the source directory." "File Move Error";
 error=1;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 1 ] && break 1;
 done;
 return ${error}
}
_ENV["make_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_file <file path>" "make_file";
 return 1;
 fi;
 check_for_file "${1}" && return 0;
 err=1;
 while :; do
 if ! ${touch} ${1}; then
 err=0;
 break 1;
 fi;
 ${chmod} 775 ${1} || err=0;
 break 1;
 done;
 if [ ${err} -eq 0 ]; then
 message "Error creating file ${1}." "File Creation" && return 1;
 return 1;
 fi;
 return 0
}
_ENV["chroot_mounted"] => () {  `${mount} -l | cut -d' ' -f3 | ${grep} -q "${chroot_dir}"` || return 1;
 return 0
}
_ENV["execute_script_root"] => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script_root <path to script>" "execute_script_root";
 return 1;
 fi;
 local script_esr="${1}";
 export script_esr;
 local return_val=0;
 if ! root; then
 while :; do
 ${clear};
 ${echo} -e "*** Enter root password to proceed ***\n";
 ${su} -c '(
        execute_script ${script_esr} || exit 5
  
        chg_tmp_file_owner ${init_user} || exit 5
  
        exit 0
      )';
 return_val=$?;
 if [ ${return_val} -eq 5 ]; then
 return_val=1;
 break 1;
 else
 if [ ${return_val} -eq 1 ]; then
 if yesno_inquiry "Incorrect Password" "The incorrect password was entered.  Try again?"; then
 continue;
 else
 break 1;
 fi;
 fi;
 fi;
 break 1;
 done;
 else
 execute_script ${script_esr} || return_val=1;
 fi;
 unset script_esr;
 return ${return_val}
}
_ENV["tarball_in_string"] => () {  if [ $# -ne 1 ]; then
 message "Usage: tarball_in_string <string>" "tarball_in_string";
 return 1;
 fi;
 if ${echo} ${1} | ${grep} -iq -e ".*tgz$" -e ".*gz$" -e ".*bz2$" -e ".*zip$" -e ".*xz$" -e ".*lzma$"; then
 return 0;
 else
 return 1;
 fi
}
_ENV["new_dir_name"] => () {  prompt_for_value "Script Directory Name" "Enter new directory name" "Name" || return 1;
 return 0
}
_ENV["edit_file"] => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: edit_file <path to file> [save flag]" "edit_file";
 return 1;
 fi;
 local scs=1;
 local save_flag="${2:-0}";
 EDITOR="vi";
 if [ ! -f "${1}" ]; then
 make_file ${1} || return 1;
 fi;
 find_file "`${basename} ${EDITOR}`";
 if [ ! -z "${file_name_path}" ] && [ -f "${file_name_path}" ]; then
 ${cat} ${1} > ${global_temp_file3};
 ${file_name_path} ${global_temp_file3};
 if [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 else
 return_val=0;
 fi;
 fi;
 scs=0;
 fi;
 if [ ${scs} -eq 1 ]; then
 local command="";
 height=35;
 width=150;
 calculate_dimensions;
 make_title "File Edit";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Save\"       --cancel-label \"Do Not Save\" --cr-wrap --editbox \"${1}\" ${height} ${width}";
 eval ${command} 2> ${global_temp_file3};
 return_val=$?;
 if [ ${return_val} -eq 0 ] && [ ${save_flag} -eq 0 ]; then
 if ! save_file ${1} ${global_temp_file3}; then
 return_val=1;
 fi;
 fi;
 fi;
 return ${return_val}
}
_ENV["new_batch_name"] => () {  prompt_for_value "Batch File Name" "Enter new batch file name" "Name" || return 1;
 return 0
}
_ENV["clear_global_files"] => () {  for i in ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4};
 do
 clear_file "${i}" || return 1;
 ${touch} ${i} || return 1;
 done;
 return 0
}
_ENV["move"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move <source> <dest>" "Move";
 fi;
 ${mv} -f "${1}" "${2}";
 if [ $? -eq 1 ]; then
 message "There was an error moving file ${1} --> ${2}." "File Move";
 return 1;
 fi;
 return 0
}
_ENV["save_file"] => () {  if [ $# -ne 2 ]; then
 message "Usage: save_file <file name> <file to copy>" "save_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 make_file ${1} || return 1;
 else
 if [ ! -e "${2}" ]; then
 message "File to copy is missing or empty.  No save will be done." "Missing Save-From File";
 return 0;
 fi;
 fi;
 if ! copy "${2}" "${1}"; then
 message "Error saving file." "File Save";
 return 1;
 fi;
 if [ -O ${1} ]; then
 if ! ${chmod} 775 ${1}; then
 message "An error occurred while modifying the permissions of the file, '${1}'." "File Permissions Error";
 return 1;
 fi;
 fi;
 return 0
}
_ENV["check_for_directory"] => () {  if [ -d "${1}" ]; then
 return 0;
 else
 return 1;
 fi
}
_ENV["prompt_for_value"] => () {  if [ $# -ne 3 ]; then
 message "Usage: prompt_for_value <title> <tag> <prompt>" "prompt_for_value";
 return 1;
 fi;
 height=20;
 width=120;
 p_lgth=${#3};
 local command;
 calculate_dimensions;
 make_title "Prompt";
 command="${dialog} --backtitle \"${main_title}\" --title \"${1}\" --ok-label \"Submit\"     --form \"${2}\" ${height} ${width} 1 \"${3}:\" 1 1 \"\" 1 $(( p_lgth + 2 )) ${width} 200";
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 prompt_value=`${cat} ${global_temp_file1}`;
 if [ ${#prompt_value} -gt 200 ]; then
 prompt_value=${prompt_value:0:255};
 fi;
 if [ ${return_val} -ne 0 ] || [ -z "${prompt_value}" ]; then
 prompt_value="";
 return 1;
 else
 prompt_value="`${echo} ${prompt_value} | tr ' ' '_'`";
 return 0;
 fi
}
_ENV["execute_script"] => () {  if [ $# -ne 1 ]; then
 message "Usage: execute_script <path to script file>" "execute_script";
 return 1;
 fi;
 if [ ! -f "${1}" ]; then
 message "No script found!" "Script Find Error";
 return 1;
 fi;
 if `${grep} -m 1 -q "^#chroot_flag" ${1}` && ! check_for_directory ${chroot_dir}/tmp; then
 if ! make_dir ${chroot_dir}/tmp; then
 message "Unable to make chroot temporary directory." "Chroot Tmp Directory Creation Error";
 return 1;
 fi;
 fi;
 if [ ${global_no_dialog} -eq 1 ]; then
 `${grep} -m 1 -q "^#no_dialog" "${1}"` && no_dialog=0;
 fi;
 base_script_name="`${basename} ${1}`";
 make_executable_file "${global_temp_file3}";
 ${cat} ${1} > ${global_temp_file3};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 if ! copy ${global_temp_file3} "${chroot_dir}/tmp/"; then
 message "There was an error copying the script, '${1}', to the chroot temporary directory." "Script Copy Error";
 return 1;
 fi;
 fi;
 get_time ${base_script_name} "-";
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} $calc > ${global_time_file} && ${sleep} 1;
 done & sub_pid2=$!;
 if `${grep} -m 1 -q "^#pre_lfs" ${global_temp_file3}`; then
 if [ -f "/tools/bin/env" ]; then
 env_cmd="/tools/bin/env";
 else
 message "Unable to find the 'env' executable in the chroot directory." "No 'env' Executable Found";
 return 1;
 fi;
 else
 if [ -f "/usr/bin/env" ]; then
 env_cmd="/usr/bin/env";
 else
 message "Unable to find the 'env' executable on the host directory." "No 'env' Executable Found";
 return 1;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 ${clear};
 ${echo} "Running script...";
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} | tee ${global_temp_file4};
 else
 ${global_temp_file3} | tee ${global_temp_file4};
 fi;
 return_val=$?;
 ${sleep} 5;
 else
 height=35;
 width=150;
 calculate_dimensions;
 local sub_pid1;
 if [ ${batch_flag} -eq 0 ]; then
 make_title "Running script ${base_script_name} (Batch Comp. Time: ${batch_hour}h ${batch_min}m ${batch_sec}s / ${start_time})";
 else
 make_title "Running script ${base_script_name} (${start_time})";
 fi;
 ${echo} "Running script..." > ${global_temp_file4};
 if `${grep} -m 1 -q "^#chroot_flag" ${1}`; then
 chroot "${chroot_dir}" ${env_cmd} -i HOME=/root TERM="${TERM}" PS1="\u:\w\$ " PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h ${global_temp_file3} &>>${global_temp_file4} &
 else
 ${global_temp_file3} &>>${global_temp_file4} &
 fi;
 sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Running Script: ${base_script_name} (Est. Completion Time: ${hour}h ${min}m ${sec}s)" --no-kill --tailboxbg ${global_temp_file4} ${height} ${width} 2> ${global_temp_file5};
 while file_empty ${global_temp_file5}; do
 ${sleep} .5;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 5;
 kill_proc `${cat} ${global_temp_file5}`;
 fi;
 disown ${sub_pid2};
 kill ${sub_pid2};
 ${rm} -f ${chroot_dir}/tmp/lfs_script* &>/dev/null;
 if ! update_time ${base_script_name} "-" `${cat} ${global_time_file}`; then
 message "Warning: There was an error updating the time file for (script) ${base_script_name}...continuing." "Update Time File Error";
 fi;
 if [ ${return_val} -eq 1 ]; then
 ${echo} "Script error: ${base_script_name} @ `date`" >> ${install_log};
 message "Script error: ${base_script_name}." "Script Error";
 else
 if [ ${return_val} -eq 0 ]; then
 ${echo} "Script finish: ${base_script_name} @ `date`" >> ${install_log};
 fi;
 fi;
 return ${return_val}
}
_ENV["remove_file"] => () {  if [ $# -lt 1 ]; then
 message "Usage: remove_file <file path> ..." "remove_file";
 return 1;
 fi;
 for z in $@;
 do
 [ ! -e "${z}" ] && continue;
 ${rm} -rf ${z} &>/dev/null;
 if [ $? -eq 1 ]; then
 message "There was an error removing file ${z}." "File Removal Error";
 return 1;
 fi;
 done;
 return 0
}
_ENV["abort_message"] => () {  if [ $# -lt 1 ] || [ -z "${1}" ]; then
 message "Usage: abort_message <text> [title]" && return 1;
 fi;
 local message_title;
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 ${dialog} --sleep 2 --title "Installation Abort" --infobox "${1}" 10 30;
 else
 ${dialog} --sleep 2 --title "Aborting Installation: ${message_title}." --infobox "${1}" 10 30;
 fi;
 exit 1
}
_ENV["make_executable_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: make_executable_file <file name>" "make_executable_file";
 return 1;
 fi;
 if [ ! -e "${1}" ]; then
 if ! make_file "${1}" || ! ${chmod} u+x ${1}; then
 message "Unable to create file: ${1}." "Executable File Error";
 return 1;
 fi;
 else
 if [ ! -x "${1}" ]; then
 if ! ${chmod} u+x ${1}; then
 message "Unable to make file '${1}' executable." "Executable File Error";
 return 1;
 fi;
 fi;
 fi;
 return 0
}
_ENV["kill_proc"] => () {  if [ $# -lt 1 ] || [ $# -gt 2 ]; then
 message "Usage: kill_proc <proc1> [proc2]" "kill_proc";
 return 1;
 fi;
 [ -z "${1}" ] && return 0;
 if [ $# -eq 1 ]; then
 ${ps} -p ${1} &>/dev/null || return 0;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 else
 if [ $# -eq 2 ]; then
 while ${ps} -p ${1} &>/dev/null 2>&1; do
 ${sleep} 1;
 done;
 ${kill} -1 ${1} &>/dev/null || ${kill} -2 ${1} &>/dev/null || ${kill} -15 ${1} &>/dev/null || ${kill} -9 ${1} &>/dev/null || return 1;
 fi;
 fi;
 return 0
}
_ENV["verify_signature"] => () {  if [ $# -ne 2 ]; then
 message "Usage: verify_signature <sig1> <sig2>" "verify_signature";
 return 1;
 fi;
 if [ "${1}" != "${2}" ]; then
 return 1;
 else
 return 0;
 fi
}
_ENV["single_program_configuration"] => () {  program_selection "Select a program to check and configure" "single" "Select" $@ || return 1
}
_ENV["chg_tmp_file_owner"] => () {  if [ $# -ne 1 ]; then
 message "Usage: chg_tmp_file_owner <file>" "chg_tmp_file_owner";
 return 1;
 fi;
 local owner="${1}";
 for i in ${batch_file} ${return_val_file} ${global_temp_file1} ${global_temp_file2} ${global_temp_file3} ${global_temp_file4} ${global_time_file} ${global_temp_file5};
 do
 [ ! -f "${i}" ] && continue;
 chg_file_owner ${owner} ${i} || return 1;
 done;
 return 0
}
_ENV["root"] => () {  if [ `id -u` -eq 0 ]; then
 return 0;
 else
 return 1;
 fi
}
_ENV["remove_dir"] => () {  if [ $# -ne 1 ]; then
 message "Usage: remove_dir <dir>" "remove_dir";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 0;
 local sub_pid1;
 height=10;
 width=80;
 calculate_dimensions;
 ${echo} "Please wait while removing directory `${basename} ${1}`..." > ${global_temp_file1};
 ${rm} -rf ${1} &>/dev/null & sub_pid1=$!;
 make_title "Directory Removal";
 if debug; then
 :;
 else
 ${dialog} --backtitle "${main_title}" --title "Removing Directory" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 return_val=$?;
 ${sleep} 1;
 kill_proc `${cat} ${global_temp_file2}`;
 return ${return_val}
}
_ENV["verify_url"] => () {  if [ $# -ne 1 ]; then
 message "Usage: verify_signature <string>" "verify_url";
 return 1;
 fi;
 if ${echo} "${1}" | ${grep} -qi -e "^\(ftp\|http\)://.*$"; then
 return 0;
 else
 return 1;
 fi
}
_ENV["message"] => () {  if [ $# -lt 1 ]; then
 message="Usage: message <text> [title]" "message";
 fi;
 local message;
 local message_title;
 message="${1}";
 message_title="${2}";
 if [ -z "${message_title}" ]; then
 message_title="Message";
 fi;
 ${dialog} --colors --backtitle "${gen_title}" --title "${message_title}" --msgbox "${message}" 15 100;
 return $?
}
_ENV["please_wait"] => () {  height=10;
 width=60;
 kill_please_wait;
 calculate_dimensions;
 make_title "Processing";
 ${echo} "Please wait..." > ${global_temp_file5};
 ${dialog} --backtitle "${main_title}" --title "Processing" --no-kill --tailboxbg ${global_temp_file5} ${height} ${width} 2> ${global_temp_file6};
 while file_empty ${global_temp_file6}; do
 sleep .5;
 done;
 please_wait_pid="`cat ${global_temp_file6}`";
 return 0
}
_ENV["new_script_name"] => () {  prompt_for_value "New Script Name" "Enter Script Name (NOTE: empty files will still save)" "Name" || return 1;
 return 0
}
_ENV["confirm_selection"] => () {  if [ $# -lt 1 ]; then
 message "Usage: confirm_selection <list>" "confirm_selection";
 return 1;
 fi;
 local list1="$@";
 local prog;
 local rn;
 local return_val;
 local command="";
 local i;
 local kill_wait_pid_cs="";
 declare -i i=1;
 if [ -z "${list1}" ]; then
 message "No programs were selected for confirmation." "Installation Selection Confirmation";
 return 1;
 fi;
 please_wait;
 height=25;
 width=60;
 for j in $@;
 do
 [ ${#j} -gt ${width} ] && width=${#j};
 done;
 width=$(( width + 15 ));
 calculate_dimensions;
 make_title "Selection Confirmation";
 command="${dialog} --backtitle \"${main_title}\" --title \"Selected programs\" ";
 command="${command} --ok-label \"Yes\" --cancel-label \"No\" --menu \"Is the selection correct?\" ${height} ${width} ${height} ";
 command="${command} \"PROGRAM\" \"RUN-LEVEL\"";
 command="${command} \"=================\" \"=========\"";
 for j in ${list1};
 do
 if `${echo} ${j} | ${grep} -q "^script:.*$"`; then
 prog="`${echo} ${j} | cut -d: -f2`";
 prog="script - `basename ${prog}`";
 rn="N/A";
 else
 prog="`${echo} ${j} | cut -d: -f1`";
 rn="`${echo} ${j} | cut -d: -f2`";
 fi;
 command="${command} \"${i}.  ${prog}\" \"${rn}\"";
 i=$(( ++i ));
 done;
 eval ${command} 2> /dev/null;
 return_val=$?;
 kill_please_wait;
 return $return_val
}
_ENV["edit_configuration"] => () {  if [ $# -ne 1 ]; then
 message "Usage: edit_configuration <program name>" "edit_configuration";
 return 1;
 fi;
 local var1_ec;
 local scs=0;
 prog_dir="${data_dir}/${1}";
 run_dir="${prog_dir}/${run}";
 get_time ${tarball_base_name} ${run} || return 1;
 make_title "Configuration Edit";
 while :; do
 ${dialog} --colors --backtitle "${main_title}" --title "${1} - run level: ${run} - \Z1Est. Build Time: ${hour}h ${min}m ${sec}s\Zn" --no-cancel --extra-button --extra-label "New Run Level" --radiolist "Configuration/Installation files for ${1}" 20 90 20 "Configuration" "View/edit configuration commands" "off" "Make Flags" "View/edit list of make flags" "off" "Make (Check/Test) Flags" "View/edit list of make (check/test) commands" "off" "Make (Install) Flags" "View/edit list of make (install) commands" "off" "Master Base URL's" "View/edit base URL's for downloading packages" "off" "Master Conf File" "View/edit master configuration file (in parent directory)" "off" "Patch List" "View/edit patch list file" "off" "Post-configuration" "View/edit post-configuration commands" "off" "Pre-configuration" "View/edit pre-configuration commands" "off" "Preferred URL" "View/edit this program's preferred URL" "off" "Program Description" "View/edit program description" "off" "Required Packages" "View/edit packages to be present in source directory" "off" "Run Level Conf File" "View/edit run level configuration file" "off" "View Logs" "View logs for this run-level" "off" "Remove Run-Level" "Delete this run-level" "off" 2> ${global_temp_file1};
 return_val=$?;
 if [ ${return_val} -eq 3 ]; then
 return 3;
 else
 if file_empty ${global_temp_file1}; then
 return 1;
 fi;
 fi;
 case `${cat} ${global_temp_file1}` in 
 "Configuration")
 var1_ec="${run_dir}/cf"
 ;;
 "Pre-configuration")
 var1_ec="${run_dir}/pre-cf"
 ;;
 "Post-configuration")
 var1_ec="${run_dir}/post-cf"
 ;;
 "Program Description")
 var1_ec="${prog_dir}/df"
 ;;
 "Installed Programs")
 var1_ec="${run_dir}/ip"
 ;;
 "Make Flags")
 var1_ec="${run_dir}/mf"
 ;;
 "Make (Install) Flags")
 var1_ec="${run_dir}/mi"
 ;;
 "Make (Check/Test) Flags")
 var1_ec="${run_dir}/make_check_test"
 ;;
 "Patch List")
 var1_ec="${run_dir}/patch_list"
 ;;
 "Preferred URL")
 var1_ec="${prog_dir}/purl"
 ;;
 "Required Packages")
 var1_ec="${run_dir}/rpkg"
 ;;
 "Master Conf File")
 var1_ec="${prog_dir}/mstr_conf"
 ;;
 "Run Level Conf File")
 var1_ec="${run_dir}/conf"
 ;;
 "Master Base URL's")
 var1_ec="${profile}/mstr_urls"
 ;;
 "View Logs")
 log_viewer ${tarball_base_name} ${run};
 continue
 ;;
 "Remove Run-Level")
 if remove_run_level "${tarball_base_name}" "${run}"; then
 return 0;
 else
 continue;
 fi
 ;;
 *)
 continue
 ;;
 esac;
 ! check_for_file ${var1_ec} && ${touch} ${var1_ec};
 edit_file ${var1_ec};
 done;
 return ${scs}
}
_ENV["clear_file"] => () {  if [ $# -ne 1 ]; then
 message "Usage: clear_file <file>" "clear_file";
 return 1;
 fi;
 [ ! -f "${1}" ] && return 0;
 scs_cgf=0;
 ${rm} ${1} &>/dev/null || scs_cgf=1;
 ${touch} ${1} &>/dev/null || scs_cgf=1;
 if [ ${scs_cgf} -eq 1 ]; then
 message "An error occurred while attempting to clear a file: ${1}." "File-Clear Error";
 return 1;
 fi;
 return 0
}
_ENV["highest_run_level"] => () {  if [ $# -ne 1 ]; then
 message "Usage: highest_run_level <tarball base directory>" "highest_run_level";
 return 1;
 fi;
 [ ! -d "${data_dir}/${1}" ] && return 1;
 local list_hrl=`ls ${data_dir}/${1}`;
 for i in ${list_hrl};
 do
 [ "${i}" == "list_hrl" ] && continue;
 if are_digits ${i}; then
 [ ${current} -lt ${i} ] && current=${i};
 fi;
 done;
 return 0
}
_ENV["download_rpkg"] => () {  if [ $# -lt 1 ]; then
 message "Usage: download_rpkg <program list>" "download_rpkg ";
 fi;
 clear_global_files;
 local prog="";
 local run="";
 local rp_name="";
 local list1="";
 local list2="";
 local error=1;
 local found;
 height=20;
 width=120;
 calculate_dimensions;
 for z in $@;
 do
 `${echo} ${z} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 prog="`${echo} ${z} | ${cut} -d: -f1`";
 run="`${echo} ${z} | ${cut} -d: -f2`";
 file_empty ${data_dir}/${prog}/${run}/rpkg && continue;
 IFS=$(${echo} -e "\n\r");
 for rp_name in `${cat} ${data_dir}/${prog}/${run}/rpkg`;
 do
 `${echo} ${rp_name} | ${grep} -q -e "^#.*$" -e "^$" -e "^script:.*" -` && continue;
 found=1;
 rp_name="`${echo} ${rp_name} | ${cut} -d: -f1`";
 find_file ${rp_name} ${prog_src_dir} && continue;
 if ! file_empty ${profile}/mstr_urls; then
 ${echo} "Searching for ${rp_name}..." > ${global_temp_file1};
 make_title "Required Tarball Search For ${rp_name}";
 ${dialog} --backtitle "${main_title}" --title "Required Tarball Search For ${rp_name}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 ! file_empty "${data_dir}/${prog}/purl" && list1="`${head} -n1 ${data_dir}/${prog}/purl`";
 list1="`${echo} ${list1} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 list2="";
 for h in `${cat} ${profile}/mstr_urls`;
 do
 h="`${echo} ${h} | ${sed} -e 's;^\(.*\)/$;\1;g'`";
 [ "${h}" == "${list1}" ] && continue;
 list2="${list2} ${h}";
 done;
 list1="${list1} ${list2}";
 unset IFS;
 for url in ${list1};
 do
 url="`${echo} ${url}/${rp_name}`";
 ! verify_tarball_url "${url}" && continue;
 if ! check_connection; then
 ${echo} "Your internet connection is down.  Aborting the installation." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 ${echo} "Searching for ${rp_name} at ${url}..." >> ${global_temp_file1};
 check_remote_file_exists "${url}";
 if [ $? -eq 0 ]; then
 ${echo} "Required tarball, ${rp_name}, found at ${url}..." >> ${global_temp_file1};
 found=0;
 break 1;
 fi;
 done;
 IFS=$(${echo} -e "\n\r");
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 clear_global_files;
 if [ ${found} -eq 1 ]; then
 while :; do
 prompt_for_value "Required Program URL (${rp_name})" "Enter program URL (FTP/HTTP)" "URL" || return 1;
 if ! verify_tarball_url ${prompt_value} || ! `${echo} ${prompt_value} | ${grep} -q ${rp_name}`; then
 if yesno_inquiry "Invalid URL" "You didn't enter a valid url.  Would you like to try again?"; then
 continue;
 else
 error=0;
 break 1;
 fi;
 fi;
 break 1;
 done;
 while :; do
 height=20;
 width=120;
 calculate_dimensions;
 ${echo} "Searching for `${basename} ${prompt_value}` at `${dirname} ${prompt_value}`..." > ${global_temp_file1};
 make_title "Required Tarball Search For `${basename} ${prompt_value}`";
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 ${dialog} --backtitle "${main_title}" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 check_remote_file_exists "${prompt_value}";
 if [ $? -eq 0 ]; then
 found=0;
 ${echo} "Found at ${prompt_value}..." >> ${global_temp_file1};
 url_dir=`${dirname} ${prompt_value}`;
 ! ${grep} -iq "${url_dir}" ${profile}/mstr_urls && echo "${url_dir}" >> ${profile}/mstr_urls;
 url="${prompt_value}";
 break 1;
 fi;
 done;
 ${sleep} 2;
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || exit;
 [ ${error} -eq 0 ] && return 1;
 fi;
 if [ ${found} -eq 1 ]; then
 message "Unable to find required tarball, ${rp_name}.  Aborting installation..." "File Find Failed";
 error=0;
 break 1;
 fi;
 if ! check_connection; then
 error=0;
 break 1;
 fi;
 if ! retrieve_pkg "${url}" /tmp; then
 message "Unable to download ${rp_name} from `${dirname} ${url}`." "File Download Failed";
 error=0;
 break 1;
 fi;
 if [ ! -f "/tmp/${rp_name}" ]; then
 message "Required tarball file not found in /tmp directory." "Tarball Not Found";
 error=0;
 break 1;
 fi;
 if ! move "/tmp/${rp_name}" "${prog_src_dir}"; then
 message "Unable to move file ${rp_name} to source directory." "Tarball File Move Error";
 error=0;
 break 1;
 fi;
 done;
 unset IFS;
 [ ${error} -eq 0 ] && return 1;
 done;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_ENV["script_options_m1"] => () {  if [ $# -ne 1 ]; then
 message "Usage: script_options_m1 <file>" "script_options_m1";
 return 1;
 fi;
 local command;
 height=20;
 width=60;
 calculate_dimensions;
 make_title "Options";
 command="${dialog} --backtitle \"${main_title}\" --title \"File '`${basename} ${1}`' Options\"     --cancel-label \"Cancel\" --ok-label \"Select\"     --radiolist \"Select an operation to perform on the file.\" ${height} ${width} ${height}";
 command="${command} \"Modify\" \"\" off";
 command="${command} \"Copy\" \"\" off";
 command="${command} \"Rename\" \"\" off";
 command="${command} \"Delete\" \"\" off";
 command="${command} \"View Completion Time(s)\" \"\" off";
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 [ ${return_val} -eq 1 ] && return 1;
 selection=`${cat} ${global_temp_file1}`;
 return 0
}
_ENV["install_one"] => () {  if [ $# -ne 1 ]; then
 message "Usage: install_one <program name>" "install_one";
 return 1;
 fi;
 local path;
 local located=1;
 local success=1;
 local runtime_error=1;
 no_dialog=1;
 tarball_name="";
 prog_dir="${data_dir}/${tarball_base_name}";
 run_dir="${prog_dir}/${run}";
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf` && ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 install_dir="${in_chroot_install_dir}";
 release_dir="${chroot_dir}${in_chroot_install_dir}";
 check_for_directory ${chroot_dir}/tmp || make_dir ${chroot_dir}/tmp;
 if ! directory_writable "${chroot_dir}/${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 else
 install_dir="$out_chroot_install_dir";
 release_dir="$out_chroot_install_dir";
 if ! directory_writable "${install_dir}" || ! directory_writable "${release_dir}"; then
 return 1;
 fi;
 fi;
 if ! `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 if `${echo} "${install_dir}" | ${grep} -q "${chroot_dir}"` || `${echo} "${release_dir}" | ${grep} -q "${chroot_dir}"`; then
 if ! chroot_mounted; then
 message "Please mount the chroot directory (${chroot_dir}) before continuing." "Chroot Unmounted";
 return 1;
 fi;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 check_for_directory "${chroot_dir}${install_dir}";
 else
 check_for_directory "${install_dir}";
 fi;
 if [ $? -ne 0 ]; then
 if ! make_dir "${install_dir}"; then
 message "Unable to create install directory (${install_dir})." "Installation Directory Creation Error";
 break 1;
 fi;
 fi;
 if `grep -m 1 -q "^#chroot_flag" ${run_dir}/conf`; then
 directory_writable ${chroot_dir}${install_dir} || return 1;
 else
 directory_writable ${install_dir} || return 1;
 fi;
 if ! check_structure ${run_dir}; then
 message "Program directory for ${1} not set up properly." "Improper Directory Structure";
 return 1;
 fi;
 get_time ${tarball_base_name} ${run};
 declare -i calc=0;
 while true; do
 calc=$(( ++calc )) && ${echo} ${calc} > ${global_time_file} && sleep 1;
 done & sub_pid2=$!;
 ! file_empty ${prog_dir}/tb_name && tarball_name="`${cat} ${prog_dir}/tb_name`";
 [ -z "${tarball_name}" ] && return 1;
 if find_file "${tarball_name}" "${prog_src_dir}"; then
 release_tarball "${file_name_path}" "${release_dir}" 0 || return 1;
 else
 message "Unable to find file, ${tarball_name}." "File Not Found";
 return 1;
 fi;
 parent_tb_base_name=${tarball_base_name};
 release_isp ${run_dir}/rpkg || return 1;
 tarball_base_name=${parent_tb_base_name};
 no_dialog=1;
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/patch_list";
 fi;
 IFS=$(${echo} -e "\n\r");
 for item in `${cat} ${run_dir}/patch_list`;
 do
 `${echo} ${item} | ${grep} -q -e "^#.*$" -e "^$" -` && continue;
 if ! run_patch ${item}; then
 message "An error occurred running the patch (${item}) for ${tarball_base_name}." "Patch-Run Error";
 return 1;
 fi;
 done;
 unset IFS;
 j="`ls ${run_dir}/log | grep -v ^.*old`";
 for k in ${j};
 do
 h="`echo ${k} | sed -e 's;\.tar\.bz2$;;g'`";
 move "${run_dir}/log/${k}" "${run_dir}/log/${h}.old.tar.bz2" || return 1;
 done;
 unset j k;
 while true; do
 if file_empty "${run_dir}/pre-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/pre-cf";
 fi;
 if ${grep} -q "^#run_as_root" ${run_dir}/pre-cf && ! root; then
 if ! global_script_run_root "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/pre-cf" "Pre-Configuration"; then
 message "The Pre-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Pre-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "pre_conf" ${global_temp_file1};
 compress_log "${run_dir}/log/pre_conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/cf";
 fi;
 if ! global_script_run "${run_dir}/cf" "Configuration"; then
 message "The configuration script for ${tarball_base_name}, run level ${run}, failed." "Configuration Failure";
 runtime_error=0;
 fi;
 save_log "conf" ${global_temp_file1};
 compress_log "${run_dir}/log/conf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mf";
 fi;
 if ! global_script_run "${run_dir}/mf" "Make"; then
 message "The Make script for ${tarball_base_name}, run level ${run}, failed." "Make Failure";
 runtime_error=0;
 fi;
 save_log "make" ${global_temp_file1};
 compress_log "${run_dir}/log/make" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/make_check_test"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/make_check_test";
 fi;
 if ! global_script_run "${run_dir}/make_check_test" "Make Check/Test"; then
 if ! `grep -q -m1 "#ignore_check_errors" "${run_dir}/conf"`; then
 message "The Make-Check script for ${tarball_base_name}, run level ${run}, failed." "Make-Check Failed";
 runtime_error=0;
 else
 ${echo} "Warning: Make/Check error for ${tarball_base_name} @ `date`" >> ${install_log};
 fi;
 fi;
 save_log "make_check_test" ${global_temp_file1};
 compress_log "${run_dir}/log/make_check_test" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/mi"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/mi";
 fi;
 if ${grep} -q "^#no_root_install" ${run_dir}/mi; then
 if ! global_script_run "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run_root "${run_dir}/mi" "Make-Install"; then
 message "The Make-Install script for ${tarball_base_name}, run level ${run}, failed." "Make-Install Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "make_install" ${global_temp_file1};
 compress_log "${run_dir}/log/make_install" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 if file_empty "${run_dir}/post-cf"; then
 :;
 else
 if [ ${global_no_dialog} -eq 0 ]; then
 no_dialog=0;
 else
 get_dialog "${run_dir}/post-cf";
 fi;
 if ${grep} -q "#run_as_root" ${run_dir}/post-cf; then
 if ! global_script_run_root "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 else
 if ! global_script_run "${run_dir}/post-cf" "Post-Configuration"; then
 message "The Post-Configuration script for ${tarball_base_name}, run level ${run}, failed." "Post-Configuration Failed";
 runtime_error=0;
 fi;
 fi;
 save_log "post_cf" ${global_temp_file1};
 compress_log "${run_dir}/log/post_cf" & [ ${runtime_error} -eq 0 ] && break 1;
 fi;
 break 1;
 done;
 disown ${sub_pid2};
 ${kill} ${sub_pid2};
 if [ ${runtime_error} -ne 0 ]; then
 if ! update_time ${tarball_base_name} ${run} `${cat} ${global_time_file}`; then
 message "Warning: A failure occurred while updating the time file for ${tarball_base_name}...continuing." "Update Time File Error";
 fi;
 fi;
 remove_ext_tb=1;
 if [ ${global_remove_ext_tb} -eq 0 ]; then
 remove_ext_tb=0;
 else
 if `${grep} -q "^#remove_ext_tb" ${run_dir}/conf`; then
 remove_ext_tb=0;
 fi;
 fi;
 if [ ${remove_ext_tb} -eq 0 ] && [ -d "${release_dir}/${tarball_base_name}" ]; then
 if ! remove_dir "${release_dir}/${tarball_base_name}"; then
 message "A failure occurred during the removal of directory, ${release_dir}/${tarball_base_name}." "Directory Removal Error";
 return 1;
 fi;
 fi;
 if [ ${runtime_error} -eq 1 ]; then
 ${echo} "Installed: ${tarball_base_name} @ `date`" >> ${install_log};
 return 0;
 else
 if [ ${runtime_error} -eq 0 ]; then
 ${echo} "Install Failure: ${tarball_base_name} @ `date` (check log files)" >> ${install_log};
 message "Install Failure: ${tarball_base_name} @ `date` (check log files)" "Install Failure";
 return 1;
 fi;
 fi
}
_ENV["check_sig_prog"] => () {  if [ $# -lt 1 ]; then
 message "Usage: check_sig_prog <file list>" "check_sig_prog";
 return 1;
 fi;
 clear_global_files;
 local line;
 local base_name;
 local tb_name;
 local run;
 local sig1;
 local sig2;
 local listing;
 local flag=0;
 local error=1;
 remove_dups $@ || return 1;
 for line in ${global_list};
 do
 `${echo} ${line} | ${grep} -q -e "^#.*$" -e "^$" -e "^script.*" -` && continue;
 base_name="`${echo} ${line} | ${cut} -d: -f1`";
 if [ ${flag} -eq 0 ]; then
 flag=$(( ++flag ));
 height=20;
 width=120;
 calculate_dimensions;
 make_title "Signature Check";
 ${dialog} --backtitle "${main_title}" --title "Main Program" --no-kill --tailboxbg ${global_temp_file1} ${height} ${width} 2> ${global_temp_file2};
 fi;
 ${echo} "Checking ${base_name}..." >> ${global_temp_file1};
 if file_empty "${data_dir}/${base_name}/tb_name"; then
 ${echo} "${base_name}: Unable to find the name of the tarball to check!" >> ${global_temp_file1};
 error=0;
 break 1;
 else
 tb_name="`${head} -n1 ${data_dir}/${base_name}/tb_name`";
 if [ -z "${tb_name}" ]; then
 ${echo} "${base_name}: Unable to find the name of the tarball being used for installation!" >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 fi;
 if ! find_file ${tb_name} ${prog_src_dir}; then
 ${echo} "Unable to find program, ${tb_name}, in the source directory." >> ${global_temp_file1};
 error=0;
 break 1;
 fi;
 while :; do
 verify_sha_alg;
 shasum_actual="`${shasum} -a ${sha_alg} ${file_name_path} | ${cut} -d\" \" -f1`";
 shasum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f3`";
 if [ -z "${shasum_file}" ] || [ -z "${shasum_actual}" ]; then
 ${echo} "SHA: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 else
 if ! verify_signature ${shasum_actual} ${shasum_file}; then
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 if [ ${fail_on_shasum} -eq 0 ]; then
 error=0;
 break 2;
 fi;
 else
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "SHA (algorithm ${sha_alg}): signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 md5sum_actual="`${md5sum} ${file_name_path} | ${cut} -d\" \" -f1`";
 md5sum_file="`${cat} ${data_dir}/${base_name}/checksum | ${grep} ${tb_name} | ${cut} -d: -f2`";
 if [ -z "${md5sum_file}" ] || [ -z "${md5sum_actual}" ]; then
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: Unable to obtain one or more signatures for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 if ! verify_signature ${md5sum_actual} ${md5sum_file}; then
 ${echo} "MD5: signature check failed for ${tb_name}!" >> ${global_temp_file1};
 ${echo} "MD5: signature check failed for ${tb_name}! @ `date`" >> ${install_log};
 error=0;
 break 2;
 else
 ${echo} "MD5: signature check passed for ${tb_name}." >> ${global_temp_file1};
 ${echo} "MD5: signature check passed for ${tb_name} @ `date`" >> ${install_log};
 break 1;
 fi;
 fi;
 break 1;
 done;
 done;
 ${sleep} 3;
 if [ ${flag} -eq 1 ]; then
 while file_empty ${global_temp_file2}; do
 ${sleep} 1;
 done;
 kill_proc `${cat} ${global_temp_file2}` || return 1;
 fi;
 [ ${error} -eq 0 ] && return 1;
 return 0
}
_ENV["release_isp"] => () {  if [ $# -ne 1 ]; then
 message "Usage: release_isp <run directory>" "release_isp";
 return 1;
 fi;
 file_empty "${1}" && return 0;
 local signature;
 local full_path;
 local found;
 local url;
 IFS=$(${echo} -e "\n\r");
 for pkg in `${cat} ${1}`;
 do
 ${echo} ${pkg} | ${grep} -iq -e '^#.*' -e '^$' && continue;
 found=1;
 scs=1;
 name=`${echo} ${pkg} | ${cut} -d: -f1`;
 if [ -z "${name}" ]; then
 message "Unable to find the name of a required package!" "Required Package Name Missing";
 return 1;
 fi;
 if ! find_file ${name} ${prog_src_dir}; then
 message "Unable to find required tarball, ${name}, in source directory." "Required Package Missing";
 return 1;
 fi;
 rename=`${echo} ${pkg} | ${cut} -d: -f2`;
 append_cmds=`${echo} ${pkg} | ${cut} -d: -f3`;
 get_tarball_base_from_tb ${file_name_path} || return 1;
 if [ -f "${release_dir}/${parent_tb_base_name}/${tarball_base_name}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${tarball_base_name};
 fi;
 if release_tarball ${file_name_path} ${release_dir}/${parent_tb_base_name} 1 "${append_cmds}"; then
 if [ ! -z "${rename}" ]; then
 if [ -d "${release_dir}/${parent_tb_base_name}/${rename}" ]; then
 remove_file ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 move ${release_dir}/${parent_tb_base_name}/${tarball_base_name} ${release_dir}/${parent_tb_base_name}/${rename} || return 1;
 fi;
 else
 message "There was an error releasing the tarball, ${name}, into its parent directory (${parent_tb_base_name})!" "Tarball Release Error";
 return 1;
 fi;
 done;
 unset IFS;
 return 0
}
_ENV["rename_script_name"] => () {  prompt_for_value "Script Rename" "Script Rename" "Name" || return 1;
 return 0
}
_ENV["program_selection"] => () {  if [ $# -lt 4 ]; then
 message "Usage: output_dialog_selection_batch <title> <type> <ok label> <list>" "output_dialog_selection_batch";
 return 1;
 fi;
 local command;
 local description_ps;
 local file1_ps;
 local file3_ps;
 local batch_prog_temp_ps="";
 local batch_progs_ps="";
 local orig_list_ps;
 local batch_run_level_ps="";
 local type_ps;
 local title_ps;
 local ok_label_ps;
 local cancel_label_ps;
 return_val="";
 title_ps="${1}";
 type_ps="${2}";
 ok_label_ps="${3}";
 shift 3;
 orig_list_ps=$@;
 prog_list="";
 while :; do
 kill_please_wait;
 please_wait;
 height=50;
 width=160;
 calculate_dimensions;
 make_title "Batch Listing";
 command="${dialog} --backtitle \"${main_title}\" --ok-label \"${ok_label_ps}\"       --no-cancel --radiolist \"${title_ps}\" ${height} ${width} ${height} ";
 for i in ${orig_list_ps};
 do
 file1_ps="${data_dir}/${i}/df";
 if ! file_empty ${file1_ps}; then
 description_ps=`${cat} ${file1_ps}`;
 else
 description_ps="No description";
 fi;
 description_ps="${description_ps:0:255}";
 command="${command} \"${i}\" \"${description_ps}\" \"off\" ";
 done;
 eval ${command} 2> ${global_temp_file1};
 return_val=$?;
 { 
 [ ${return_val} -eq 1 ] || file_empty ${global_temp_file1}
 } && return 1;
 batch_prog_temp_ps="`${cat} ${global_temp_file1} | ${sed} -e 's;";;g'`";
 if [ "${type_ps}" == "single" ] || [ "${type_ps}" == "checksum" ]; then
 prog_list=${batch_prog_temp_ps};
 break 1;
 else
 if [ "${type_ps}" == "batch" ]; then
 get_run_level ${batch_prog_temp_ps};
 ${echo} "${batch_prog_temp_ps}:${run}" >> ${batch_file};
 prog_list="${prog_list} ${batch_prog_temp_ps}";
 fi;
 fi;
 done;
 return ${return_val}
}
_ENV["verify_sha_alg"] => () {  case ${sha_alg} in 
 "1" | "224" | "256" | "384" | "512" | "512224" | "512256")
 :
 ;;
 *)
 sha_alg=1
 ;;
 esac;
 return 0
}
_ENV["run_patch"] => () {  if [ $# -ne 1 ]; then
 message "Usage: run_patch <patch file>" "run_patch";
 return 1;
 fi;
 clear_global_files;
 local pfile_raw="${1}";
 local pfile_uncomp="${1}";
 local list;
 local sub_pid1;
 local scs=0;
 chg_dir "${release_dir}/${tarball_base_name}" || return 1;
 if `${echo} ${pfile_raw} | ${grep} -q ".*\.gz"`; then
 pfile_uncomp="`${echo} ${pfile_raw} | ${sed} -e 's;\(^.*\)\.gz;\1;g'`";
 if [ ! -f "${patch_src_dir}/${pfile_uncomp}" ]; then
 if ! ${gunzip} ${patch_src_dir}/${pfile_raw}; then
 message "There was a problem uncompressing '${pfile_raw}'." "Patch Un-Compression";
 return 1;
 fi;
 fi;
 fi;
 if [ ${no_dialog} -eq 0 ]; then
 clear;
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp};
 scs=$?;
 else
 ${patch} -Np1 -i ${patch_src_dir}/${pfile_uncomp} &>${global_temp_file2} & sub_pid1=$!;
 if debug; then
 :;
 else
 ${dialog} --title "Patching ${tarball_base_name} (${pfile_raw})" --no-kill --tailboxbg ${global_temp_file2} 40 130 2> ${global_temp_file1};
 while file_empty ${global_temp_file1}; do
 ${sleep} 1;
 done;
 fi;
 wait ${sub_pid1};
 scs=$?;
 ${sleep} 2;
 kill_proc `${cat} ${global_temp_file1}`;
 fi;
 ${sleep} 1;
 return ${scs}
}
_ENV["make_temp_file"] => () {  local tmp_file;
 local scs=0;
 tmp_file=`${mktemp} -p /tmp lfs_script.XXXXXXXX`;
 trap "remove_file ${tmp_file}" SIGINT;
 if [ ! -z "${tmp_file}" ] && [ -f "${tmp_file}" ]; then
 ${echo} ${tmp_file};
 else
 scs=1;
 fi;
 trap - SIGINT;
 if [ ${scs} -eq 1 ]; then
 exit 1;
 else
 return ${scs};
 fi
}
_ENV["check_owner"] => () {  local var1;
 local var2;
 local var3;
 if [ $# -ne 2 ]; then
 message "Usage: check_owner <user> <file/directory>" "check_owner";
 return 1;
 fi;
 var1=`${dirname} ${2}`;
 var2=`${echo} ${1} | ${sed} -e 's;${var1};;g'`;
 var3=`ls -n ${var1} | ${grep} ${var2} | ${sed} -e 's;^[a-zA-Z0-9-]\+\s\+[a-zA-Z0-9]\+\s\+\(.*$\);\1;g'`;
 if [ "${1}" == "${var3}" ]; then
 return 0;
 else
 return 1;
 fi
}
_ENV["batch_program_listing"] => () {  program_selection "Select programs to install (batch mode)" "batch" "Add" $@ || return 1
}
_ENV["make_title"] => () {  if [ $# -lt 1 ]; then
 message "Usage: make_title <type title>..." "make_title";
 return 1;
 fi;
 local c;
 local mt_length=${#gen_title};
 local ty_length=${#1};
 local var1=$(( mt_length + ty_length ));
 local max_wd=`stty size | cut -d" " -f2`;
 main_title="";
 if [ ${var1} -gt ${max_wd} ]; then
 main_title="${gen_title}";
 return 0;
 fi;
 var1=$(( max_wd - mt_length - ty_length - 2 ));
 local spaces="`${echo} ${var1} | bc`";
 main_title="${gen_title}";
 for ((c=1; c<=${spaces}; c++ ))
 do
 main_title="${main_title}+";
 done;
 main_title="${main_title}${1}";
 return 0
}
_ENV["checksum_program_listing"] => () {  program_selection "Select a program to view/edit checksum" "checksum" "Select" $@ || return 1
}
_ENV["check_profile_struc"] => () {  if [ $# -ne 1 ]; then
 message "Usage: check_profile_structure <profile dir>" "check_profile_struc";
 return 1;
 fi;
 [ ! -d "${1}" ] && return 1;
 for h in "batch" "data" "scripts" "doc";
 do
 [ -d "${1}/${h}" ] || return 1;
 done;
 return 0
}
_ENV["select_from_list"] => () {  if [ $# -lt 2 ]; then
 message "Usage: select_from_list <title> <list>" "select_from_list";
 return 1;
 fi;
 local command="";
 local title_sfl=${1};
 height=20;
 width=120;
 local list_height_sfl=20;
 calculate_dimensions;
 shift 1;
 make_title "List Selection";
 command="${dialog} --colors --backtitle \"${main_title}\" --ok-label \"Select\" --no-cancel     --radiolist \"${title_sfl}\" ${height} ${width} ${list_height_sfl}";
 for z in $@;
 do
 command="${command} \"${z}\" \"\" off";
 done;
 eval ${command} 2> ${global_temp_file1} 1>&0;
 return_val=$?;
 selection=`${cat} ${global_temp_file1}`;
 if [ ${return_val} -eq 1 ] || { 
 [ ${return_val} -eq 0 ] && [ -z "${selection}" ]
 }; then
 return 1;
 else
 return 0;
 fi
}
_ENV["find_file"] => () {  if [ $# -lt 1 ]; then
 message "Usage: find_file <file name> [path]" "find_file";
 return 1;
 fi;
 local local_path;
 local real_paths="";
 if [ -z "${2}" ]; then
 local_path=`${echo} ${PATH} | tr ":" " "`;
 else
 local_path="${2}";
 fi;
 for i in ${local_path};
 do
 [ -d "${i}" ] && real_paths="${real_paths} ${i}";
 done;
 real_paths=`${echo} ${real_paths} | ${sed} -e "s;^\s*\(.*\)\s*;\1;g"`;
 file_name_path=`${find} ${real_paths} -name "${1}"`;
 file_name_path="`${echo} ${file_name_path} | cut -d" " -f1`";
 if [ -z "${file_name_path}" ]; then
 return 1;
 else
 return 0;
 fi
}
_ENV["get_dialog"] => () {  if [ $# -ne 1 ]; then
 message "Usage: get_dialog <file>" "get_dialog";
 return 1;
 fi;
 if ! check_for_file "${1}"; then
 message "Unable to find file used to set the dialog variable." "No-Dialog File Error";
 return 1;
 fi;
 if ${grep} -q "no_dialog" ${1}; then
 no_dialog=0;
 else
 no_dialog=1;
 fi;
 return 0
}
_ENV["move_dir"] => () {  if [ $# -ne 2 ]; then
 message "Usage: move_dir <dir> <path to new name>" "move_dir";
 return 1;
 fi;
 if [ -d "${1}" ]; then
 local dest_dir;
 dest_dir="`${echo} ${2} | ${tr} ' ' '_'`";
 if ! ${mv} ${1} ${dest_dir} &>/dev/null; then
 :;
 else
 message "Directory renamed to ${dest_dir}." "Move Directory";
 fi;
 fi;
 return 0
}
_ENV["kill_please_wait"] => () {  `${ps} -p ${please_wait_pid} &> /dev/null` && kill -SIGINT ${please_wait_pid};
 return 0
}

PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file:  LICENSE

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.


Build environment

OS:
Linux - Linux tw0001 3.2.6 #1 SMP Tue Apr 24 12:56:11 MDT 2012 i686

Autoconf:
autoconf (GNU Autoconf) 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

Bundled Libtool:
ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)

Copyright (C) 2008  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

System Libtool:
libtool (GNU libtool) 2.4.2
Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996

Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiler:
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib
Thread model: posix
gcc version 4.6.2 (GCC) 

Bison:
bison (GNU Bison) 2.5
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Libraries:
	linux-gate.so.1 =>  (0xb77c1000)
	libcrypt.so.1 => /lib/libcrypt.so.1 (0xb778a000)
	libresolv.so.2 => /lib/libresolv.so.2 (0xb776f000)
	librt.so.1 => /lib/librt.so.1 (0xb7765000)
	libgdbm.so.4 => /usr/lib/libgdbm.so.4 (0xb775c000)
	libz.so.1 => /lib/libz.so.1 (0xb7744000)
	libm.so.6 => /lib/libm.so.6 (0xb7719000)
	libnsl.so.1 => /lib/libnsl.so.1 (0xb76fe000)
	libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0xb769e000)
	libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0xb74e2000)
	libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb7397000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7391000)
	libc.so.6 => /lib/libc.so.6 (0xb71fa000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb71df000)
	/lib/ld-linux.so.2 (0xb77c2000)


User's E-mail: