--- air-1.2.5/install-air-1.2.5 2004-08-12 02:16:24.000000000 +0930 +++ install-air-1.2.5 2004-09-16 22:58:01.859773960 +0930 @@ -1,18 +1,33 @@ #!/bin/sh VERSION="1.2.5" -PERLTK_VER="804.027" +if [ "$PERLTK_VERz" = "z" ] ; then + PERLTK_VER="804.027" +fi TK_SOURCE="http://www.cpan.org/modules/by-module/Tk" -TK_FILE='Tk-804.027.tar.gz' -TEMP_DIR="/tmp" -TK_DIR=$TEMP_DIR/Tk-804.027 -ICON_DIR="/usr/local/share/air/bitmaps" -LOG_DIR="/usr/local/share/air/logs" -INSTALL_LOG="/tmp/air-install.log" +TK_FILE=Tk-$PERLTK_VER.tar.gz +if [ "$TEMP_DIRz" = "z" ] ; then + TEMP_DIR="/tmp" +fi +TK_DIR=$TEMP_DIR/Tk-$PERLTK_VER +if [ "$INSTALL_DIRz" = "z" ]; then + INSTALL_DIR="/usr/local" +fi +if [ "$FINAL_INSTALL_DIRz" = "z" ]; then + FINAL_INSTALL_DIR=$INSTALL_DIR +fi +ICON_DIR="$INSTALL_DIR/share/air/bitmaps" +LOG_DIR="$INSTALL_DIR/share/air/logs" +INSTALL_LOG="$TEMP_DIR/air-install.log" echo "Install Log for AIR Version $VERSION" > $INSTALL_LOG date >> $INSTALL_LOG -cat /etc/redhat-release >> $INSTALL_LOG +[ -f /etc/redhat-release ] && cat /etc/redhat-release >> $INSTALL_LOG +[ -f /etc/gentoo-release ] && cat /etc/gentoo-release >> $INSTALL_LOG +echo PERLTK_VER=$PERLTK_VER >> $INSTALL_LOG +echo TEMP_DIR=$TEMP_DIR >> $INSTALL_LOG +echo INSTALL_DIR=$INSTALL_DIR >> $INSTALL_LOG +echo FINAL_INSTALL_DIR=$FINAL_INSTALL_DIR >> $INSTALL_LOG cat /proc/cpuinfo >> $INSTALL_LOG free >> $INSTALL_LOG @@ -59,7 +74,7 @@ if [ $? -ne 0 ] ; then CUR_VER="0" fi -if [ $CUR_VER == $PERLTK_VER ] ; then +if [ $CUR_VER = $PERLTK_VER ] ; then echo "Perl/Tk ($CUR_VER) is already installed on your system, so" echo "this installer will only update the other components of AIR." UPGRADE="yes" @@ -76,13 +91,15 @@ fi echo "Perl/Tk version: $TK_VER" >> $INSTALL_LOG -echo "" -echo "If you are ready to proceed with the installation/upgrade," -echo "press ENTER." -echo "" -echo "To cancel, hit Control-C." +if [ ! "$INTERACTIVE" = "no" ] ; then + echo "" + echo "If you are ready to proceed with the installation/upgrade," + echo "press ENTER." + echo "" + echo "To cancel, hit Control-C." -read foo < /dev/tty + read foo < /dev/tty +fi if [ $UPGRADE = "no" ] ; then echo "Attempting to get the latest version of Perl/Tk..." @@ -90,7 +107,7 @@ echo "Need to download Perl/Tk:" >> $INSTALL_LOG echo "decoding snarf..." >> $INSTALL_LOG -sed 's/^X//' << 'SHAR_EOF' | uudecode -o /tmp/snarf.gz 2>> $INSTALL_LOG +sed 's/^X//' << 'SHAR_EOF' | uudecode -o $TEMP_DIR/snarf.gz 2>> $INSTALL_LOG begin 755 snarf.gz M'XL("-BW"SL``W-N87)F`.U\?WQ35;;O29N64%(2H$B1XAQ'RP^AOZCR&RS$ M%!`*(:&MOY@2VK2GM4U"<@*M6(RFG4L:,],WUW&\]SKO,N./R\SUSCAW'`=' @@ -347,7 +364,7 @@ fi echo "decoding air-counter..." >> $INSTALL_LOG -sed 's/^X//' << 'SHAR2_EOF' | uudecode -o /tmp/air-counter 2>> $INSTALL_LOG +sed 's/^X//' << 'SHAR2_EOF' | uudecode -o $TEMP_DIR/air-counter 2>> $INSTALL_LOG begin 755 air-counter M(R$O=7-R+V)I;B]P97)L"B,J*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ @@ -399,7 +416,7 @@ SHAR2_EOF echo "decoding air..." >> $INSTALL_LOG -sed 's/^X//' << 'SHAR3_EOF' | uudecode -o /tmp/air 2>> $INSTALL_LOG +sed 's/^X//' << 'SHAR3_EOF' | uudecode -o $TEMP_DIR/air 2>> $INSTALL_LOG begin 755 air M(R$O=7-R+V)I;B]P97)L(`HC*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ @@ -2041,8 +2058,16 @@ end SHAR3_EOF +if [ ! "$FINAL_INSTALL_DIR" = "/usr/local" ] ; then + mv $TEMP_DIR/air $TEMP_DIR/air.orig + echo "correcting installation directory in air to $FINAL_INSTALL_DIR" | tee -a $INSTALL_LOG + sed -e "s:/usr/local:$FINAL_INSTALL_DIR:g" $TEMP_DIR/air.orig > $TEMP_DIR/air + chmod a+x $TEMP_DIR/air + rm -f $TEMP_DIR/air.orig | tee -a $INSTALL_LOG +fi + echo "decoding icons..." >> $INSTALL_LOG -sed 's/^X//' << 'SHAR4_EOF' | uudecode -o /tmp/air-icons.tar.gz 2>> $INSTALL_LOG +sed 's/^X//' << 'SHAR4_EOF' | uudecode -o $TEMP_DIR/air-icons.tar.gz 2>> $INSTALL_LOG begin 664 air-icons.tar.gz M'XL("*3?P3T``V%I> $INSTALL_LOG -sed 's/^X//' << 'SHAR5_EOF' | uudecode -o /usr/local/bin/tailer 2>> $INSTALL_LOG +echo "decoding tailer..." >> $INSTALL_LOG +sed 's/^X//' << 'SHAR5_EOF' | uudecode -o $TEMP_DIR/tailer 2>> $INSTALL_LOG begin 755 tailer M(R$O8FEN+W-H"B,J*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ M*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BH*(R`@ @@ -2370,8 +2395,8 @@ end SHAR5_EOF -echo "decodiing split..." >> $INSTALL_LOG -sed 's/^X//' << 'SHAR6_EOF' | uudecode -o /tmp/split.gz 2>> $INSTALL_LOG +echo "decoding split..." >> $INSTALL_LOG +sed 's/^X//' << 'SHAR6_EOF' | uudecode -o $TEMP_DIR/split.gz 2>> $INSTALL_LOG begin 755 split.gz M'XL("/.S$T$``W-P;&ET`.U\#WQ4Q;7PW;"$)03O@HN-)UM;%ZKKVJU)87VT7]*:Z4)*`2" @@ -2630,12 +2655,12 @@ end SHAR6_EOF if [ $UPGRADE = "no" ] ; then - # unzip /tmp/snarf.gz - /bin/gunzip /tmp/snarf.gz + # unzip $TEMP_DIR/snarf.gz + /bin/gunzip $TEMP_DIR/snarf.gz # Use snarf to "snarf" the Perl/Tk package (It has a progress display) - /tmp/snarf -n $TK_SOURCE/$TK_FILE $TEMP_DIR/$TK_FILE + $TEMP_DIR/snarf -n $TK_SOURCE/$TK_FILE $TEMP_DIR/$TK_FILE if [ $? -ne 0 ] ; then @@ -2650,7 +2675,7 @@ echo "If the installer failed with some other error message," echo "please email steve@unixgurus.com for assistance." echo "" - rm -f /tmp/snarf* + rm -f $TEMP_DIR/snarf* exit 1 else echo "Download of Perl/Tk successful." | tee -a $INSTALL_LOG @@ -2679,6 +2704,10 @@ fi # create directories if they don't exist +if [ ! -d $INSTALL_DIR/bin ]; then + echo "creating directory $INSTALL_DIR/bin..." | tee -a $INSTALL_LOG + mkdir -p $INSTALL_DIR/bin 2>> $INSTALL_LOG +fi if [ ! -d $ICON_DIR ]; then echo "creating directory $ICON_DIR..." | tee -a $INSTALL_LOG mkdir -p $ICON_DIR 2>> $INSTALL_LOG @@ -2690,37 +2719,56 @@ # install air-counter echo "Unpacking and installing air-counter..." | tee -a $INSTALL_LOG -mv -f /tmp/air-counter /usr/local/bin/air-counter 2>> $INSTALL_LOG -chmod +x /usr/local/bin/air-counter 2>> $INSTALL_LOG -rm -f /tmp/air-counter 2>> $INSTALL_LOG +mv -f $TEMP_DIR/air-counter $INSTALL_DIR/bin/air-counter 2>> $INSTALL_LOG +chmod +x $INSTALL_DIR/bin/air-counter 2>> $INSTALL_LOG +rm -f $TEMP_DIR/air-counter 2>> $INSTALL_LOG echo "Install of air-counter is complete." | tee -a $INSTALL_LOG echo "" +# install tailer +echo "Unpacking and installing tailer..." | tee -a $INSTALL_LOG +mv -f $TEMP_DIR/tailer $INSTALL_DIR/bin/tailer 2>> $INSTALL_LOG +chmod +x $INSTALL_DIR/bin/tailer 2>> $INSTALL_LOG +rm -f $TEMP_DIR/tailer 2>> $INSTALL_LOG +echo "Install of tailer is complete." | tee -a $INSTALL_LOG +echo "" + # unzip and install icons echo "Unpacking and installing icons..." | tee -a $INSTALL_LOG -/bin/tar -C $TEMP_DIR -zxf /tmp/air-icons.tar.gz 2>> $INSTALL_LOG -mv -f /tmp/*.xbm $ICON_DIR 2>> $INSTALL_LOG -mv -f /tmp/*.gif $ICON_DIR 2>> $INSTALL_LOG -rm -f /tmp/air-icons.tar.gz 2>> $INSTALL_LOG +/bin/tar -C $TEMP_DIR -zxf $TEMP_DIR/air-icons.tar.gz 2>> $INSTALL_LOG +mv -f $TEMP_DIR/*.xbm $ICON_DIR 2>> $INSTALL_LOG +mv -f $TEMP_DIR/*.gif $ICON_DIR 2>> $INSTALL_LOG +rm -f $TEMP_DIR/air-icons.tar.gz 2>> $INSTALL_LOG echo "Install of icons is complete." | tee -a $INSTALL_LOG echo "" #unzip and install split -echo "Unpacking and installing split..." | tee -a $INSTALL_LOG -/bin/gunzip /tmp/split.gz 2>> $INSTALL_LOG -mv -f /tmp/split /usr/local/bin/split 2>> $INSTALL_LOG -chmod +x /usr/local/bin/split 2>> $INSTALL_LOG -rm -f /tmp/split 2>> $INSTALL_LOG -echo "Install of split is complete." | tee -a $INSTALL_LOG -echo "" +MY_ARCH=`uname -m` + +if [ "$MY_ARCH" = "i386" -o "$MY_ARCH" = "i486" -o "$MY_ARCH" = "i586" -o "$MY_ARCH" = "i686" ] && [ ! -x $FINAL_INSTALL_DIR/bin/split ] ; then + echo "Unpacking and installing split..." | tee -a $INSTALL_LOG + /bin/gunzip $TEMP_DIR/split.gz 2>> $INSTALL_LOG + mv -f $TEMP_DIR/split $INSTALL_DIR/bin/split 2>> $INSTALL_LOG + chmod +x $INSTALL_DIR/bin/split 2>> $INSTALL_LOG + rm -f $TEMP_DIR/split 2>> $INSTALL_LOG + echo "Install of split is complete." | tee -a $INSTALL_LOG + echo "" +else + if [ -x $FINAL_INSTALL_DIR/bin/split ] ; then + echo "$FINAL_INSTALL_DIR/bin/split already installed - not installing split." | tee -a $INSTALL_LOG + else + echo "Included $FINAL_INSTALL_DIR/split is a x86 architecture executable and current machine isn't." | tee -a $INSTALL_LOG + echo "You need $FINAL_INSTALL_DIR/bin/split to run air-imager" | tee -a $INSTALL_LOG + fi +fi if [ $UPGRADE = "yes" ] ; then echo "Updating AIR to version $VERSION..." else echo "Installing AIR $VERSION..." | tee -a $INSTALL_LOG fi -mv -f /tmp/air /usr/local/bin/air 2>> $INSTALL_LOG -rm -f /tmp/air 2>> $INSTALL_LOG +mv -f $TEMP_DIR/air $INSTALL_DIR/bin/air 2>> $INSTALL_LOG +rm -f $TEMP_DIR/air 2>> $INSTALL_LOG if [ $UPGRADE = "yes" ]; then echo "Upgrade to AIR v$VERSION complete." @@ -2737,4 +2785,4 @@ echo "" echo "All Done. Type 'air' on the command-line to begin." | tee -a $INSTALL_LOG echo "" -cat $INSTALL_LOG | mail -s "AIR v$VERSION Install Log" steve@unixgurus.com +#cat $INSTALL_LOG | mail -s "AIR v$VERSION Install Log" steve@unixgurus.com