Author: ks156 Date: 2008-12-01 14:54:15 +0100 (Mon, 01 Dec 2008) New Revision: 2965
Modified: software_suite_v2/tuxware/installers/unix/branches/prefix_install/build.sh software_suite_v2/tuxware/installers/unix/branches/prefix_install/build_deps/common/updater/tux_updater Log: * Updated the tux_updater script Modified: software_suite_v2/tuxware/installers/unix/branches/prefix_install/build.sh =================================================================== --- software_suite_v2/tuxware/installers/unix/branches/prefix_install/build.sh 2008-12-01 13:47:51 UTC (rev 2964) +++ software_suite_v2/tuxware/installers/unix/branches/prefix_install/build.sh 2008-12-01 13:54:15 UTC (rev 2965) @@ -11,9 +11,6 @@ KYSOH_URL=http://94.23.16.55/apps -GADGET_DIR=gadgets -APP_DIR=applications -INST_DIR=installers/unix32 CONTROL_CENTER_URL=$KYSOH_URL/applications/common/control_center GADGET_URL=$KYSOH_URL/gadgets @@ -138,7 +135,6 @@ createUsrDir () { echo "Creating /usr directory" mkdir -p $MIRROR_DIR/usr - cp -rf build_deps/common/launcher/* $MIRROR_DIR/usr/ } # Create the $PREFIX dir @@ -329,6 +325,7 @@ echo "-- Copying the gadget updater" sed "s;PREFIX=;PREFIX=$PREFIX;g" build_deps/common/updater/tux_updater\ >$MIRROR_DIR/$PREFIX/$UPDATER_DIR/tux_updater + cp getRules.py $MIRROR_DIR/$PREFIX/$UPDATER_DIR } # Install the templates from local FS Modified: software_suite_v2/tuxware/installers/unix/branches/prefix_install/build_deps/common/updater/tux_updater =================================================================== --- software_suite_v2/tuxware/installers/unix/branches/prefix_install/build_deps/common/updater/tux_updater 2008-12-01 13:47:51 UTC (rev 2964) +++ software_suite_v2/tuxware/installers/unix/branches/prefix_install/build_deps/common/updater/tux_updater 2008-12-01 13:54:15 UTC (rev 2965) @@ -5,24 +5,22 @@ ## PREFIX= -VERSION=0.0.2 +VERSION=0.0.3 STATE= -## 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 -CONTROL_CENTER_DIR=$PREFIX/controlcenter +KYSOH_URL=http://94.23.16.55/apps -CONTROL_CENTER_URL=$KYSOH_URL/$APP_DIR/common/control_center -JRE_URL=$KYSOH_URL/$INST_DIR/java_jre -GADGET_URL=$KYSOH_URL/$GADGET_DIR -TOOLS_URL=$KYSOH_URL/$INST_DIR/tools -ATT_URL=$KYSOH_URL/$INST_DIR/attitunes +CONTROL_CENTER_URL=$KYSOH_URL/applications/common/control_center +GADGET_URL=$KYSOH_URL/gadgets +TOOLS_URL=$KYSOH_URL/tools +TEMPLATES_URL=$KYSOH_URL/resources/templates +SKIN_URL=$KYSOH_URL/resources/skins +ATT_URL=$KYSOH_URL/resources/attitunes +HELP_URL=$KYSOH_URL/resources/helps +LIBS_URL=$KYSOH_URL/resources/libs/acapela +OS_INT_URL=$KYSOH_URL/resources/os_integration +TMP_RULES_FILE=/tmp/tuxtmp ## # Display the header @@ -70,58 +68,6 @@ } ## -# Remove "index.html" file presents after the function wget -r -l x -## -remove_index () { - find $1 -name "index.html">filelist - for i in `cat filelist` - do - rm "$i" - done - rm filelist -} - -## -# Install files from an URL -## -installFile () { - wget -q $1/$VER - - FILE=`cat $VER` - wget -q $1/$FILE - tar -xf $FILE - DIR=`sed s/.tar.gz//g $VER` - - cd $DIR - `source install.sh $PREFIX` - cd - >/dev/null - - rm $VER - rm -rf $DIR - rm $FILE -} - -## -# Download the ControlCenter from Kysoh ftp -## -downloadControlCenter () { - printf "Downloading Control Center $BUSY" - - wget -q $CONTROL_CENTER_URL/$VER - FILE=`cat $VER` - wget -q $CONTROL_CENTER_URL/$FILE - chmod +x $FILE - if [ `whoami` == "root" ]; then - mv $FILE $PREFIX/share/tuxdroid/resources/control_center/controlcenter.jar - else - mv $FILE $CONTROL_CENTER_DIR/controlcenter.jar - fi - rm $VER - - printf "$DONE" -} - -## # Verify if /home/$USER/MyTux already exist ## isUserDirectory () { @@ -153,86 +99,134 @@ rm -r /home/$USER/MyTux/MyTuxTools fi } -## -# Update the gadgets -## -updateGadgets () { - printf "Updating gadgets $BUSY" - wget -q -r -l 2 -A txt $GADGET_URL/common/ - find www.kysoh.com -name "$VER" > filelist - for URL in `cat filelist`; do - FILE=`cat $URL` - URL=`echo $URL | sed "s/$VER//g"` - if [ `whoami` == "root" ]; then - wget -q $URL/$FILE -P $PREFIX/share/tuxdroid/resources/gadgets - else - wget -q $URL/$FILE -P $HOME/MyTux/MyTuxGadgets - fi - done - rm -rf filelist www.kysoh.com - - printf "$DONE" + +update_uuid () { + cp /etc/tuxdroid/tuxdroid.conf /tmp/tuxdroid.conf + sed '/IUUID=/d' /tmp/tuxdroid.conf > /etc/tuxdroid/tuxdroid.conf + UUID=`uuidgen` + echo "IUUID=$UUID" >> /etc/tuxdroid/tuxdroid.conf + rm /tmp/tuxdroid.conf } -updateLinuxGadgets () { - printf "Updating linux gadgets $BUSY" - wget -q -r -l 2 -A txt $GADGET_URL/linux - find www.kysoh.com -name "$VER">filelist - for URL in `cat filelist` - do - FILE=`cat $URL` - URL=`echo $URL | sed "s/$VER//g"` - wget -q $FILE - if [ `whoami` == "root" ]; then - wget -q $URL/$FILE $PREFIX/share/tuxdroid/resources/gadgets - else - wget -q $URL/$FILE $HOME/MyTux/MyTuxGadgets - fi - done - rm -rf filelist www.kysoh.com - - printf "$DONE" + +installFromZip () { + file=${url##*/} + wget -q $url -O /tmp/$file + unzip -q /tmp/$file -d /tmp/tux_tmp + rm /tmp/$file + verifyUser + cp -r /tmp/tux_tmp/* $path/ + chmod -R 755 $path + rm -rf /tmp/tux_tmp +} + +installFromFtp () { + # Retrieve the filename from the PATH + file=${path##*/} + # Substract the filename to the path + path=${path%%$file} + verifyUser + wget -q $url -O $path/$file + chmod -R 755 $path/$file } -## -# Update the tools -## -updateTools () { - printf "Updating tools $BUSY" - installFile $TOOLS_URL - printf "$DONE" +verifyUser () { + if [ `whoami` != "root" ]; then + echo $line |grep gadgets >/dev/null + if [ $? == 0 ]; then + path=~/MyTux/MyTuxGadgets + echo $line |grep attitunes > /dev/null + fi + if [ $? == 0 ]; then + path=~/MyTux/MyTuxAttitunes + fi + echo $line |grep tools > /dev/null + if [ $? == 0 ]; then + path=~/MyTux/MyTuxTools + fi + else + if [ ! -d $MIRROR_DIR/$path ]; then + mkdir -p $MIRROR_DIR/$path + fi + fi } -updateAttitunes () { - printf "Updating attitunes $BUSY" - installFile $ATT_URL - printf "$DONE" +retrieveFiles () { + python /usr/share/tuxdroid/tux_updater/getRules.py $VERSION_TYPE LINUX $1 $TMP_RULES_FILE + # Remplace all | by ; to avoid pipelining + sed 's/|/;/g' $TMP_RULES_FILE > /tmp/tuxtmp1 + while read line; do + # sed : + # I have to replace $PREFIX (ascii sequence) by the environment + # variable. + echo $line|cut -d ';' -f 3 |sed "s/\$PREFIX/\\${PREFIX}/g" >path + path=`cat path` + rm path + echo $line|cut -d ';' -f 4 |sed "s/\$PREFIX/\\${PREFIX}/g" >url + url=`cat url` + rm url + if [ `echo $line|cut -d ';' -f 1` == COPY ]; then + installFromFtp + elif [ `echo $line|cut -d ';' -f 1` == ZIP ]; then + installFromZip + fi + done < /tmp/tuxtmp1 + rm /tmp/tuxtmp1 $TMP_RULES_FILE } -update_uuid () { - cp /etc/tuxdroid/tuxdroid.conf /tmp/tuxdroid.conf - sed '/IUUID=/d' /tmp/tuxdroid.conf > /etc/tuxdroid/tuxdroid.conf - UUID=`uuidgen` - echo "IUUID=$UUID" >> /etc/tuxdroid/tuxdroid.conf - rm /tmp/tuxdroid.conf +parseFtp () { + if [ `whoami` == "root" ]; then + printf "Downloading control center $BUSY" + retrieveFiles $CONTROL_CENTER_URL + printf "$DONE" + printf "Downloading gadgets $BUSY" + retrieveFiles $GADGET_URL + printf "$DONE" + printf "Downloading tools $BUSY" + retrieveFiles $TOOLS_URL + printf "$DONE" + printf "Downloading attitunes $BUSY" + retrieveFiles $ATT_URL + printf "$DONE" + printf "Downloading help files $BUSY" + retrieveFiles $HELP_URL + printf "$DONE" + printf "Downloading skin $BUSY" + retrieveFiles $SKIN_URL + printf "$DONE" + else + isUserDirectory + printf "Downloading gadgets $BUSY" + retrieveFiles $GADGET_URL + printf "$DONE" + printf "Downloading tools $BUSY" + retrieveFiles $TOOLS_URL + printf "$DONE" + printf "Downloading attitunes $BUSY" + retrieveFiles $ATT_URL + printf "$DONE" + fi } + ############################### MAIN FUNCTION ############################### function usage () { echo " Tux Droid sotware suite v2 updater tool" echo "" echo " Usage :" - echo " ./tux_updater [chmnoqwx]" + echo " tux_updater [chmnoqwx]" echo "" echo " Parameters :" echo " -c : Clean the user directory before updating" echo " -h : Display this help and exit" - echo " -m : Download the control center only (root)" echo " -n : Disable the shell coloration" echo " -o : Old versions" echo " -q : QC versions" echo " -w : Work versions" - echo " -x : Exclude the control center" + echo " Launch this application as root user to update the system." + echo " (Control Center, Help files, Gadgets, Tools, Attitunes" + echo " Launch this application as normal user to update the user installation" + echo " (Gadgets, Attitunes, Tools)" exit 0 } @@ -242,25 +236,23 @@ CC_ONLY=FALSE COLOR=TRUE VER=version.txt +VERSION_TYPE=Online -if [ `whoami` != "root" ]; then - EXCL_CC=TRUE -fi ## Search for options -while getopts "chmnoqwx" options; do +while getopts "chnoqw" options; do case $options in - x) - EXCL_CC=TRUE - ;; w) VER=versionWork.txt + VERSION_TYPE=Work ;; q) VER=versionQC.txt + VERSION_TYPE=QC ;; o) VER=versionOld.txt + VERSION_TYPE=Old ;; n) COLOR=FALSE @@ -270,9 +262,6 @@ cleanUserDirectory fi ;; - m) - CC_ONLY=TRUE - ;; h) usage ;; @@ -290,20 +279,8 @@ BUSY="\033[80D\033[72C[\033[33m BUSY \033[00m]" fi -if [ $EXCL_CC == FALSE ]; then - downloadControlCenter -fi +parseFtp -if [ $CC_ONLY == FALSE ]; then - if [ `whoami` != "root" ]; then - isUserDirectory - fi - updateGadgets - updateLinuxGadgets - updateTools - updateAttitunes -fi - if [ `whoami` == "root" ]; then update_uuid fi ------------------------------------------------------------------------- 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
