Author Topic: Titchy Updater.sh Decoded?  (Read 2745 times)

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Titchy Updater.sh Decoded?
« on: October 18, 2007, 05:08:48 am »
Hi,
Could someone decode the updater.sh from Titchy into a text file, please?
I badly need this to get access into the Debian ISO image to fix my root account setting, without being forced to reformat the disk before that.    
A million thanks in advance!

 [ Invalid Attachment ]
« Last Edit: October 18, 2007, 05:10:00 am by ZDevil »

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

tux

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
    • http://
Titchy Updater.sh Decoded?
« Reply #1 on: October 18, 2007, 05:36:42 am »
Quote from: ZDevil
Hi,
Could someone decode the updater.sh from Titchy into a text file, please?
I badly need this to get access into the Debian ISO image to fix my root account setting, without being forced to reformat the disk before that.    
A million thanks in advance!

 [ Invalid Attachment ]
 On the Titchylinux site, if you poke around are three files that I found. Two of them are .py files that decode and encode the updater file. or so it says. The updater file is there also. I'm trying to attach them all now. Hope they help.   I'm obviously going to have to put a fake .deb on the end of them. The real name and type should be obvious.  

So just remove the .deb extension and you should be able to use them on your desktop to do what you want. I presume the process is decode, edit, encode and apply?

Cheers!

By the way, if the attachment bug bites, you can find them at the Neil's site if you wander about. I found them. On the Installing page, scroll down to the bottom of the screen and click on attachments. The files are there.  Take a bit of discovering though!

Must emphasize, the updater file I have uploaded is the original!
« Last Edit: October 18, 2007, 06:03:45 am by tux »
3200 aka BigZ, swapped in 16GB Sandisk Extreme III CF, Cacko 1.23 full,  new SDHC >2GB module,
SL860 Cacko 1.23 full, new SDHC >2GB module,
6000L SharpRom 1.12 + Tetsu kernel,
5500 TKC home on SD x 2 (with SD>1GB),
Archos PMA30 with OPEN PMA (Giraffe),
Nokia 770 (Hackers Edition)
Nokia 800 (ITOS 2008), 4GB SDHC x 2
Asus eeepc 4G (black), with 1GB ram, dual boot Xandros on SSD with Ubuntu Lucid Lynx on 16 GB SDHC,
Tmobile G1 Android (black), with Cyanogen's  Firerat's MTD script and Amon Ra Recovery 1.7.0
Tmobile HTC Wildfire.. rooted and on Cyanogen's 7.3 nightly Rom
Kopi/Kapi on everything bar the phone and the Nokias, there is a beta for the nokias...

All the above are retired

Samsung Note 8 N5110
Samsung Note N7105
FBreader on the lot!

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Titchy Updater.sh Decoded?
« Reply #2 on: October 18, 2007, 06:04:58 am »
Thanks!  

Ok, now I would like to make a new updater.sh by disabling the automatic disk formatting actions.

Here is the full decoded updater.sh from titchy:
Code: [Select]
#!/bin/sh

DATAPATH=$1
TMPPATH=/tmp/update
TMPDATA=$TMPPATH/tmpdata.bin
TMPHEAD=$TMPPATH/tmphead.bin

WFLG_KERNEL=0
WFLG_INITRD=0
WFLG_HDD=0

RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
if [ "$RO_MTD_LINE" = "" ]; then
    RO_MTD_LINE=`cat /proc/mtd | grep "\.*\<2\>" | tail -n 1`
fi
RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2`
RO_MTD=/dev/mtd$RO_MTD_NO
RO_MTDBLK=/dev/mtdblock$RO_MTD_NO
RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /`

RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
if [ "$RW_MTD_LINE" = "" ]; then
    RW_MTD_LINE=`cat /proc/mtd | grep "\.*\<2\>" | tail -n 1`
fi
RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
RW_MTD=/dev/mtd$RW_MTD_NO
RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`

LOGOCAL_MTD=/dev/mtd1

VERBLOCK=0x48000
MVRBLOCK=0x70000

RESULT=0

Cleanup(){
    rm -f $VTMPNAME > /dev/null 2>&1
    rm -f $MTMPNAME > /dev/null 2>&1
    rm $CTRLPATH/* > /dev/null 2>&1
    exit $1
}
trap 'Cleanup 1' 1 15
trap '' 2 3

get_dev_pcmcia()
{
while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
do
    echo $DEVS
done
}
get_dev_pcmcia_slot()
{
    grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia
}
sleep 1
IDE1=`get_dev_pcmcia_slot 1`
if [ "$IDE1" = "" ]; then
    echo "Error! There is no microdrive. Now retrying..."
    while [ "$IDE1" = "" ]; do
    IDE1=`get_dev_pcmcia_slot 1`
    done
    echo "Found microdrive!"
fi

### Check model ###
/sbin/writerominfo
MODEL=`cat /proc/deviceinfo/product`
if [ "$MODEL" != "SL-C3000" ] && [ "$MODEL" != "SL-C3100" ] && [ "$MODEL" != "SL-C3200" ]
then
    echo 'Model: '$MODEL
    echo 'Error! Invalid model.'
    echo 'Please reboot.'
    while true
    do
    done
fi

mkdir -p $TMPPATH > /dev/null 2>&1

cd $DATAPATH/

#
# First do the kernel.
#
for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN
do
    if [ -e $DATAPATH/$TARGETFILE -a $WFLG_KERNEL = 0 ]
    then
        # Get the size of the kernel.
        DATASIZE=`wc -c $TARGETFILE`
        DATASIZE=`echo $DATASIZE | cut -d' ' -f1`

        echo 'Updating kernel.'
        echo $TARGETFILE':'$DATASIZE' bytes'
        /sbin/nandlogical $LOGOCAL_MTD WRITE 0xe0000 $DATASIZE \
            $TARGETFILE > /dev/null 2>&1

        WFLG_KERNEL=1

    fi
done

echo ''
echo 'Formatting microdrive...'
for s in 1 2 3; do
  if [ ! -f /hdd$s/NotAvailable ]; then
    umount /hdd$s
  fi
done
echo 0 | sfdisk /dev/${IDE1} 2>/dev/null >/dev/null
if [ "$?" != "0" ]; then
    echo "Error!"
    exit "$?"
fi
dd if=/dev/zero of=/dev/${IDE1}1 bs=512 count=1 2>/dev/null >/dev/null
mke2fs -j /dev/${IDE1}1 2> /dev/null > /dev/null
e2fsck -p /dev/${IDE1}1 > /dev/null
if [ "$?" != "0" ]; then
    echo "Error!"
    exit "$?"
fi

mount -t ext3 -o noatime /dev/${IDE1}1 /hdd1
if [ "$?" != "0" ]; then
    echo "Error!"
    exit "$?"
fi

## Debian Install CD
cd $DATAPATH/
for TARGETFILE in debian.iso DEBIAN.ISO
do
    if [ -e $DATAPATH/$TARGETFILE ]; then
        echo 'Extracting Debian installer...'
        mkdir $TMPPATH/media

        mount -o loop -t iso9660 $TARGETFILE $TMPPATH/media
        if [ "$?" != "0" ]; then
            echo "Error!"
            exit "$?"
        fi
        cp -a $TMPPATH/media/dists $TMPPATH/media/pool $DATAPATH/
        cp $TMPPATH/media/install/netwinder/initrd.gz /hdd1/tmpinitrd.gz
        umount $TMPPATH/media

        gunzip /hdd1/tmpinitrd.gz
        if [ "$?" != "0" ]; then
            echo "Error!"
            exit "$?"
        fi

        mount -o loop /hdd1/tmpinitrd $TMPPATH/media
        if [ "$?" != "0" ]; then
            echo "Error!"
            exit "$?"
        fi

        cp -R $TMPPATH/media/* /hdd1
        if [ "$?" != "0" ]; then
            echo "Error!"
            exit "$?"
        fi

        umount $TMPPATH/media
        rm /hdd1/tmpinitrd

        cat >/hdd1/lib/debian-installer-startup.d/S99cdrom <mkdir /cdrom
mount /dev/mmcblk0p1 /cdrom
cd /
for s in cdrom/*.DEB cdrom/*.deb; do
  if [ -e \$s ]; then
    ar -x \$s
    tar xzf data.tar.gz
    rm data.tar.gz control.tar.gz
  fi
done
END

    fi
done

sync
umount /hdd1

echo
echo 'Debian Installer successfully installed!'

exit 0

So my question is: Will it do to remove the lines from 107 to 130, i.e. starting from "echo '' echo 'Formatting microdrive...' ..." ?

Here is the attachment FYI.  

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

tux

  • Sr. Member
  • ****
  • Posts: 438
    • View Profile
    • http://
Titchy Updater.sh Decoded?
« Reply #3 on: October 18, 2007, 02:48:48 pm »
 Glad you found the files of help. I think you may well be ok with stripping those lines you mention. But, being too lazy to count he lines, I'm not sure whether you mean to snip the ones below?

mount -t ext3 -o noatime /dev/${IDE1}1 /hdd1
if [ "$?" != "0" ]; then
   echo "Error!"
   exit "$?"
fi


Don't they mount the drive, which I think is essential?

Any way I'm sure there must be much more expert eyes watching this thread than mine. Good luck with it.  

You'll have noticed that I appear to have cured the powering up problem with 'Big Z', I think I'll adopt that name for the surgically enhanced little fellow!
« Last Edit: October 18, 2007, 02:49:14 pm by tux »
3200 aka BigZ, swapped in 16GB Sandisk Extreme III CF, Cacko 1.23 full,  new SDHC >2GB module,
SL860 Cacko 1.23 full, new SDHC >2GB module,
6000L SharpRom 1.12 + Tetsu kernel,
5500 TKC home on SD x 2 (with SD>1GB),
Archos PMA30 with OPEN PMA (Giraffe),
Nokia 770 (Hackers Edition)
Nokia 800 (ITOS 2008), 4GB SDHC x 2
Asus eeepc 4G (black), with 1GB ram, dual boot Xandros on SSD with Ubuntu Lucid Lynx on 16 GB SDHC,
Tmobile G1 Android (black), with Cyanogen's  Firerat's MTD script and Amon Ra Recovery 1.7.0
Tmobile HTC Wildfire.. rooted and on Cyanogen's 7.3 nightly Rom
Kopi/Kapi on everything bar the phone and the Nokias, there is a beta for the nokias...

All the above are retired

Samsung Note 8 N5110
Samsung Note N7105
FBreader on the lot!