Author: Paul_R
Date: 2008-09-09 16:17:29 +0200 (Tue, 09 Sep 2008)
New Revision: 1833

Modified:
   software_suite_v2/tuxware/installers/unix/trunk/Installer.sh
Log:
* Changed URL according with the changes made on the FTP
* Added a function to retreive the distro
* Added a new installer with the distro specific stuff
  and removed the init script installation.


Modified: software_suite_v2/tuxware/installers/unix/trunk/Installer.sh
===================================================================
--- software_suite_v2/tuxware/installers/unix/trunk/Installer.sh        
2008-09-09 09:30:48 UTC (rev 1832)
+++ software_suite_v2/tuxware/installers/unix/trunk/Installer.sh        
2008-09-09 14:17:29 UTC (rev 1833)
@@ -14,24 +14,33 @@
 DONE="\033[80D\033[72C[\033[32m DONE \033[00m]\n"
 BUSY="\033[80D\033[72C[\033[33m BUSY \033[00m]"
 
-FIRMWARE_URL=http://www.kysoh.com/download/installers/unix32/tuxup_firmware
-SERVER_URL=http://www.kysoh.com/download/installers/unix32/tux_http_server
-ACAP_SHARED_URL=http://www.kysoh.com/download/installers/unix32/acapela_shared_libraries
-PYTHON_API_URL=http://www.kysoh.com/download/installers/unix32/python_tuxisalive
-CONTROL_CENTER_URL=http://www.kysoh.com/download/applications/linux/control_center
-VOICES_URL=http://www.kysoh.com/download/resources/tts_voices/tarball
-JRE_URL=http://www.kysoh.com/download/installers/unix32/jre
-GADGET_URL=http://www.kysoh.com/download/gadgets
-TOOLS_URL=http://www.kysoh.com/download/installers/unix32/misc
-CC_DEP_URL=http://www.kysoh.com/download/installers/unix32/deps
-INIT_URL=http://www.kysoh.com/download/installers/unix32/init
+## URLs
+KYSOH_URL=http://www.kysoh.com/download
+INST_DIR=installers/unix32
+DEP_DIR=$INST_DIR/deps
+APP_DIR=applications
+GADGET_DIR=gadgets
+RES_DIR=resources
 
-FIRMWARE_DIR=/opt/tuxdroid/firmware
-SERVER_DIR=/opt/tuxdroid/tuxhttpserver
-TUX_LIB_DIR=/opt/tuxdroid/lib
-CONTROL_CENTER_DIR=/opt/tuxdroid/controlcenter
-TUX_BIN_DIR=/opt/tuxdroid/bin
-TUX_DIR=/opt/tuxdroid
+FIRMWARE_URL=$KYSOH_URL/$INST_DIR/firmwares
+SERVER_URL=$KYSOH_URL/$INST_DIR/httpserver
+ACAP_SHARED_URL=$KYSOH_URL/$INST_DIR/acapela_libs
+PYTHON_API_URL=$KYSOH_URL/$INST_DIR/python_api
+CONTROL_CENTER_URL=$KYSOH_URL/$APP_DIR/linux/control_center
+VOICES_URL=$KYSOH_URL/$RES_DIR/tts_voices/tarball
+JRE_URL=$KYSOH_URL/$INST_DIR/java_jre
+GADGET_URL=$KYSOH_URL/$GADGET_DIR
+TOOLS_URL=$KYSOH_URL/$INST_DIR/tools
+CC_DEP_URL=$KYSOH_URL/$DEP_DIR/common
+DEP_URL=$KYSOH_URL/$DEP_DIR
+
+# DIRs
+ROOT_DIR=/opt/tuxdroid
+FIRMWARE_DIR=$ROOT_DIR/firmware
+SERVER_DIR=$ROOT_DIR/tuxhttpserver
+TUX_LIB_DIR=$ROOT_DIR/lib
+CONTROL_CENTER_DIR=$ROOT_DIR/controlcenter
+TUX_BIN_DIR=$ROOT_DIR/bin
 BIN_DIR=/usr/bin
 
 ##
@@ -135,8 +144,13 @@
 # Base installation - main function
 ##
 baseInstall() {
+    findSystem
     createTemp
     createFileArch
+    if [ $SYSTEM != "unknow" ]
+    then
+        downloadDependencies
+    fi
     downloadFirmwares
     downloadServer
     downloadPythonAPI
@@ -145,7 +159,6 @@
     downloadVoices
     testJre
     createExec
-    installInit
     clearTemp
 }
 
@@ -161,7 +174,7 @@
     DIR=`sed s/.tar.gz//g version.txt`
     
     cd $DIR
-    source install.sh >/dev/null
+    source install.sh 
     cd - >/dev/null
    
     rm version.txt 
@@ -170,11 +183,52 @@
 }
 
 ##
+# Find the system
+##
+findSystem () {
+    SYSTEM=unknow
+    cat /etc/issue |grep Ubuntu >/dev/null
+    if  [ $? == 0 ]
+    then
+        echo "Ubuntu"
+        SYSTEM=ubuntu
+    fi
+    
+    cat /etc/issue |grep SUSE >/dev/null
+    if [ $? == 0 ]
+    then
+        echo "OpenSUSE"
+        SYSTEM=suse
+    fi
+    
+    cat /etc/issue |grep Fedora >/dev/null
+    if [ $? == 0 ]
+    then
+        echo "Fedora"
+        SYSTEM=fedora
+    fi
+
+    cat /etc/issue |grep Mint >/dev/null
+    if [ $? == 0 ]
+    then
+        echo "Mint"
+        SYSTEM=mint
+    fi
+    
+    cat /etc/issue |grep PCLinuxOS >/dev/null
+    if [ $? == 0 ]
+    then
+        echo "PC Linux OS"
+        SYSTEM=pclos
+    fi
+}
+
+##
 # Create the file architecture on /opt/
 ##
 createFileArch () {
     printf "Create file architecture $BUSY"
-    mkdir -p $TUX_DIR
+    mkdir -p $ROOT_DIR
     mkdir -p $TUX_BIN_DIR
     mkdir -p $SERVER_DIR
     mkdir -p $CONTROL_CENTER_DIR
@@ -183,6 +237,15 @@
     printf "$DONE"
 }
 
+##
+# Download distribution dependencies
+##
+downloadDependencies () {
+    printf "Downloading dependencies $BUSY"
+    installFile $DEP_URL/$SYSTEM
+    printf "$DONE" 
+    
+}
 
 ##
 # Download the firmware Kysoh ftp 
@@ -300,11 +363,15 @@
 
 
 testJre () {
+    # Test if java is installed, and store the version string
     java -version 2>version>version
     if [ $? != 0 ]
     then
         installJre
     fi
+
+    # Parse the version string to know the version of the current version 
+    # of the JRE.
     VER=`cat version |grep java |cut -f 2 -d'"' |cut -f 2 -d "."` 1>/dev/null
     if [ $VER -lt 6 ]
     then
@@ -312,6 +379,7 @@
     fi
 }
 
+# Download and install the JRE v1.6
 installJre () {
     printf "Downloading JRE $BUSY"
     wget -q $JRE_URL/version.txt
@@ -328,19 +396,16 @@
     ln -sf /opt/jre*/bin/* $BIN_DIR/ 
     printf "$DONE"
 }
+
 ##
 # Create the executables files and symlinks
 ##
 createExec () {
     printf "Creating executables $BUSY"
-    echo "#!/bin/bash">/opt/tuxdroid/bin/tuxhttpserver
-    echo "python /opt/tuxdroid/tuxhttpserver/tuxhttpserver.py" |tee -a \
-    /opt/tuxdroid/bin/tuxhttpserver>/dev/null
-    chmod +x /opt/tuxdroid/bin/tuxhttpserver
 
     echo "#!/bin/bash">/opt/tuxdroid/bin/controlcenter
-    echo "java -jar /opt/tuxdroid/controlcenter/control_center_0.0.1.jar 
>/dev/null" |tee -a \
-    /opt/tuxdroid/bin/controlcenter>/dev/null
+    echo "java -jar $ROOT_DIR/controlcenter/control_center_0.0.1.jar" \
+    |tee -a $TUX_BIN_DIR/controlcenter>/dev/null
     chmod +x /opt/tuxdroid/bin/controlcenter
 
     ln -sf $TUX_BIN_DIR/tuxup $BIN_DIR/tuxup
@@ -351,12 +416,6 @@
     printf "$DONE"
 }
 
-installInit () {
-    printf "Installing initialization script $BUSY"
-    installFile $INIT_URL
-    printf "$DONE"
-}
-
 #------------------------------------------------------------------------------
 ##
 # Update gadget - main function


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to