From: James E. F. <jf...@ac...> - 2002-05-13 06:11:54
Attachments:
install.sh
|
Hey All ... I just wrote a quick start on an install script, it doesn't do anything yet, just collect info. I want to test it on as many systems as possible and see how well it guesses install paths and such. (Also to make sure it works on systems other than mine). You can run it from anywhere, it doesn't have to be in a phpESP directory. Take a look, test, fix, patch, complain. :-) -James |
From: Roman J. <cit...@ma...> - 2002-05-13 06:48:51
|
First, it looks like you had DOS returns there, which stopped the script from running on OS X (BSD Darwin). It raised a question tho. What about Windows users? See attachment for detailed output. James, keep up the good work. -Roman |
From: James E. F. <jf...@ac...> - 2002-05-13 13:21:09
|
No DOS line feed unless your email client added them. I think it is an issue with the 'sh' on OS X. Can you look in the man page for 'sh' and tell me what the syntax for the builtin command "read" is? (Are OS X man pages online anywhere?) I think I might end up switching to perl for the install script -- I wanted to avoid it, but I think that it is more likely that everyone will have perl, than everyone having compatible utils (sed, grep, sh, cut). Thanks for the quick reply. :-) -James On Mon, 13 May 2002, Roman Jasin wrote: > First, it looks like you had DOS returns there, which stopped the script > from running on OS X (BSD Darwin). It raised a question tho. What about > Windows users? > See attachment for detailed output. > > James, keep up the good work. > > -Roman > |
From: Matthew G. <gr...@mu...> - 2002-05-21 18:53:29
|
Just tried the install script. It failed on my box on line 126 and 129. I'm running Debian(sid) and "sed" version 3.02 It looks like "sed's" "-E" has changed to "-e" in version 3.02 After swapping "-E"'s for "-e"'s it ran to completion and did a decent job making guesses. On Mon, May 13, 2002 at 02:11:48AM -0400, James E. Flemer wrote: > Hey All ... > I just wrote a quick start on an install script, it > doesn't do anything yet, just collect info. I want to test > it on as many systems as possible and see how well it > guesses install paths and such. (Also to make sure it works > on systems other than mine). You can run it from anywhere, > it doesn't have to be in a phpESP directory. Take a look, > test, fix, patch, complain. :-) > > -James > #!/bin/sh > > me=`basename "$0"` > > usage () { > echo "$me: [options]" > exit 1; > } > > cat <<EOF > ============================================================ > Welcome to phpESP -- php Easy Survey Package > ============================================================ > EOF > > euid=`id -u | sed s/\\n//` > > if [ $euid = 0 ]; then > echo 'We appear to be running as root, good!' > echo '' > else > cat <<EOF > You do not appear to be running as root. It is suggested > that you run this script as root. If you do not have root > access then press enter to continue, otherwise press ^C to > abort then run again as root. > EOF > read junk > fi > > cat <<EOF > Step One: Information > ===================== > First you will be asked several questions about where and > how you would like to install phpESP. All questions have > default values in square brackets ([]), just press enter if > you want the default. You will have a chance to confirm all > options later. > > EOF > > echo 'Database Information:' > read -p 'Host name of mysql server [localhost]: ' dbhost > read -p 'Mysql username to use [phpesp]: ' dbuser > read -p 'Mysql password for user [phpesp]: ' dbpass > read -p 'Name of database to use [phpesp]: ' dbname > read -p 'Does this database exist yet? [y/N]: ' dbdex > read -p 'Does this user exist yet? [y/N]: ' dbuex > case $dbdex in > [Yy]*) > read -p 'Has the database been initialized with phpESP.sql? [y/N]: ' dbdinit > ;; > *) > ;; > esac > if [ -z "$dbhost" ]; then dbhost='localhost'; fi > if [ -z "$dbuser" ]; then dbuser='phpesp'; fi > if [ -z "$dbpass" ]; then dbpass='phpesp'; fi > if [ -z "$dbname" ]; then dbname='phpesp'; fi > if [ -z "$dbdex" ]; then dbdex='n'; fi > if [ -z "$dbuex" ]; then dbuex='n'; fi > if [ -z "$dbdinit" ]; then dbdinit='n'; fi > > phpprefix='' > phpconfig=`which php-config 2>/dev/null` > if [ ! -z "$phpconfig" ]; then > phpprefix=`$phpconfig --prefix` > else > for i in /usr /usr/local /opt; do > if [ -d "$i/lib/php" ]; then > phpprefix="$i" > break > fi > done > fi > if [ -z "$phpprefix" ]; then > defpath="$HOME/phpESP" > else > defpath="$phpprefix/lib/php/contrib/phpESP" > fi > > htdocs='' > for i in /www /var/www /usr/www /usr/local/www /usr/local/apache "$HOME/public_html"; do > if [ -d "$i/htdocs" ]; then > htdocs="$i/htdocs" > break > elif [ -d "$i" -a x"$i" != x"/usr/local/apache" ]; then > htdocs="$i" > break > fi > done > if [ -z "$htdocs" ]; then htdocs='/usr/local/apache/htdocs'; fi > > cat <<EOF > > Filesystem Path Information: > NOTE: Do not install phpESP (the first question) in a web > accessable directory. This means do *not* put it inside a > 'htdocs/' or inside a 'public_html/' directory. If you do > so, you risk leaking sensative database passwords! > Do install the management stub and the survey stub inside > a 'htdocs/' or 'public_html/' directory (second & third > questions). > EOF > read -p "Path to install phpESP [$defpath]: " ipath > read -p "Path to install management stub [$htdocs/phpESP]: " mpath > read -p "Path to install survey stub [$htdocs/surveys]: " spath > if [ -z "$ipath" ]; then ipath="$defpath"; fi > if [ -z "$mpath" ]; then mpath="$htdocs/phpESP"; fi > if [ -z "$spath" ]; then spath="$htdocs/surveys"; fi > > domain=`hostname`; > if echo "$domain" | grep -q '\..*\.'; then > domain=`echo "$domain" | cut -f 2,3 -d .` > fi > > cat <<EOF > > Web Path Information: > These questions all apply to URLs. A best guess will be > made for you and made the default, but please check them! > EOF > tmp="www.$domain" > read -p "Host name of webserver [$tmp]: " webhost > if [ -z "$webhost" ]; then webhost="$tmp"; fi > tmp="http://$webhost"`echo "$mpath" |sed -E 's,.*/(www|htdocs|public_html)/,/,'` > read -p "URL to management stub [$tmp]: " murl > if [ -z "$murl" ]; then murl="$tmp"; fi > tmp="http://$webhost"`echo "$spath" |sed -E 's,.*/(www|htdocs|public_html)/,/,'` > read -p "URL to survey stub [$tmp]: " surl > if [ -z "$surl" ]; then surl="$tmp"; fi > > cat <<EOF > > Configuration Options: > EOF > read -p "Enable phpESP to send email (for backup) [y/N]: " allowemail > read -p "Use authentication for survey management [Y/n]: " authdesign > read -p "Allow authentication for survey taking [Y/n]: " authresponse > read -p "Default language [en]: " lang > if [ -z "$allowemail" ]; then allowemail="n"; fi > if [ -z "$authdesign" ]; then authdesign="y"; fi > if [ -z "$authresponse" ]; then authresponse="y"; fi > if [ -z "$lang" ]; then lang="en"; fi > > cat <<EOF > > Step Two: Review > ================ > Press enter to see a summary of the installation settings. > Each one will be numbered, to change a setting enter the > number and press enter. To continue enter "0" or just press > enter. > EOF > while true; do > cat <<EOF > > 1) Mysql server: $dbhost > 2) Mysql username: $dbuser > 3) Mysql password: $dbpass > 4) Mysql database: $dbname > 5) Database exists? $dbdex > 6) DB User exists? $dbuex > > 7) Install path: $ipath > 8) Management path: $mpath > 9) Survey path: $spath > > 10) Webserver name: $webhost > 11) Management URL: $murl > 12) Survey URL: $surl > > 13) Allow Email? $allowemail > 14) Auth managment? $authdesign > 15) Auth surveys? $authresponse > 16) Language: $lang > EOF > > read -p "Enter a number or press enter: " number > if [ -z "$number" -o x"$number" = x"0" ]; then > break > fi > done -- brought to you by, Matthew Gregg... one of the friendly folks in the IT Lab. --------------------------------------\ The IT Lab (http://www.itlab.musc.edu) \____________________ Probably the world's premier software development center. Serving: Programming, Tools, Ice Cream, Seminars |