#!/bin/sh #(c)2004 Barry Kauler, www.goosee.com/puppy #ninth script to create Puppy Linux image.gz PUPPYDIR="`pwd`" #/root/puppy SOURCESDIR="$PUPPYDIR/sources8" DESTDIR="$PUPPYDIR/rootfs-complete" FSSIZE=`cat $PUPPYDIR/rootfs-skeleton/root0/.etc/ramdisksize` echo "Files failed to strip:" > $SOURCESDIR/logstriperr.txt binstripfunc() { #param passed in is full path and filename, no wildchars allowed. #note, do not put quotes around the $1, fails if asterisks if [ ! -h $1 ];then #-h test if symbolic link. strip --strip-unneeded $1 > /dev/null 2>&1 if [ ! $? -eq 0 ];then echo "$1" >> $SOURCESDIR/logstriperr.txt fi fi } libstripfunc() { #param passed in is full path and filename, no wildchars allowed. #note, do not put quotes around the $1, fails if asterisks #WARNING: do not strip all symbols, as this script strips some #lib files at their source, in the host system. if [ ! -h $1 ];then #-h test if symbolic link. strip --strip-debug $1 > /dev/null 2>&1 if [ ! $? -eq 0 ];then echo "$1" >> $SOURCESDIR/logstriperr.txt fi fi } check_status() { /bin/echo -en "\\033[65G" if [ $1 -eq 0 ] then /bin/echo -en "\\033[1;32mdone" else /bin/echo -en "\\033[1;31mfailed" FLAGFAILED=1 fi /bin/echo -e "\\033[0;39m" } skip_key() { if [ "$FIRSTTIME" = "yes" ];then echo -n "Press ENTER to continue (and compile/install $1): " read mmm nnn="y" else echo -en "To compile/install $1, press \"y\", else \"ENTER\" to skip: " read nnn fi } echo echo -e "Would you like to cleanup sources8/ folder by running \"make clean\"" echo -e "or \"make distclean\" in all the packages? This will remove all the" echo "configuration and compiled files. You probably only want to do this" echo "if you want to make everything into a tarball for distribution, or" echo " you need to save space on the drive." echo -e "This script will cleanup then exit if you choose \"y\"." echo -ne "Press \"y\" to clean sources8/, anything else not to: " read mmm if [ "$mmm" = "y" ];then echo "Please wait..." sync echo "...cleaned sources6/ folder. Exiting script..." exit fi echo echo "Do you want to recompile everything in sources8/ folder and install" echo "into rootfs-complete/ folder?" echo "If you just press ENTER, you will asked about each package, whether" echo "you want to compile and install it." echo "IF THIS IS THE VERY FIRST TIME THAT YOU ARE RUNNING THIS SCRIPT," echo -e "YOU MUST TYPE \"y\" TO BUILD EVERYTHING!" echo echo -en "Type \"y\" for everything or just press ENTER only for no: " read nnn if [ "$nnn" ];then FIRSTTIME="yes" cd $PUPPYDIR fi echo echo "WARNING: /usr/lib/ has tcl, tk and tix folders. I put them into" echo " rootfs-skeleton when I compiled them myself, for uclibc." echo " However Mandrake has slightly different versions, and maybe" echo " I should put code to overwrite with the Mandrake folders." echo skip_key tcl if [ "$nnn" ];then echo "Compiling/installing tcl..." #cd $PUPPYDIR/sources8/ echo "This should be in the host and copied to Puppy in createpuppy1." echo "However, Mandrake 9.2 seems to have a bug, /usr/lib/libtcl.so exists" echo "but does not point to the actual library. Fixing..." FILEREAL="`find /usr/lib -maxdepth 1 -type f -name libtcl8*.so | head -n 1`" rm -f /usr/lib/libtcl.so &>/dev/null ln -s $FILEREAL /usr/lib/libtcl.so libstripfunc "$FILEREAL" rm -f $DESTDIR/usr/lib/libtcl*.so sync cp -af /usr/lib/libtcl*.so $DESTDIR/usr/lib/ echo "...done." echo "Copying tclsh to Puppy..." cp -afv /usr/bin/tclsh* $DESTDIR/usr/bin/;check_status $? fi echo skip_key tk if [ "$nnn" ];then echo "Compiling/installing tk..." #cd $PUPPYDIR/sources8/ echo "tk is already in the host, libtk copied to Puppy in createpuppy1." echo "However, Mandrake 9.2 seems to have a bug, /usr/lib/libtk.so exists" echo "but does not point to the actual library. Fixing..." FILEREAL="`find /usr/lib -maxdepth 1 -type f -name libtk8*.so | head -n 1`" rm -f /usr/lib/libtk.so &>/dev/null ln -s $FILEREAL /usr/lib/libtk.so libstripfunc "$FILEREAL" rm -f $DESTDIR/usr/lib/libtk*.so sync cp -af /usr/lib/libtk*.so $DESTDIR/usr/lib/ echo "...done." echo "Now copy wish executable..." cp -afv /usr/bin/wish* $DESTDIR/usr/bin/;check_status $? fi echo skip_key mp3shell if [ "$nnn" ];then echo "mp3shell is pure tcl/tk code and already installed in rootfs-skeleton/." fi echo skip_key tix if [ "$nnn" ];then echo "tix is in the host and copied to Puppy in createpuppy1." echo "Copying tixwish to Puppy..." cp -afv /usr/bin/tixwish* $DESTDIR/usr/bin/;check_status $? fi echo skip_key vtcl if [ "$nnn" ];then echo "This is pure tcl/tk and already installed in rootfs-skeleton." echo "vtcl also contains bwidget and rootfs-skeleton has a link" echo "/usr/lib/bwidget-1.3.1 to /usr/lib/vtcl-1.6.0/lib/bwidget" echo "...this provides bwidget for all apps to use. Note, vtcl has to" echo "use that particular bwidget as it is modified." fi echo skip_key Img if [ "$nnn" ];then echo "Compiling/installing Img..." cd $PUPPYDIR/sources8/img1.2.4 echo "Using v1.2.4 cannot use later version as darn thing no longer uses system" echo "libjpeg, libpng, libtiff libz libs, but uses its own." echo "Various things hacked in this package." echo "Installation is a hack. I edited rootfs-skeleton/usr/lib/Img1.2/pkIndex.tcl" make clean &>/dev/null make distclean &>/dev/null ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --host=i486-pc-linux-gnu --with-tcl=/usr/lib --with-tk=/usr/lib &>logconfig.txt make &>logbuild.txt rm -f $DESTDIR/usr/lib/libimg.so cp -afv libimg1.2.so $DESTDIR/usr/lib/;check_status $? sync ln -s libimg1.2.so $DESTDIR/usr/lib/libimg.so libstripfunc "$DESTDIR/usr/lib/libimg1.2.so" fi #echo #skip_key tkhtml #if [ "$nnn" ];then # echo "Compiling/installing tkhtml..." # cd $PUPPYDIR/sources8/ #fi echo skip_key snack if [ "$nnn" ];then echo "Compiling/installing snack..." cd $PUPPYDIR/sources8/snack2.2.5/unix make uninstall make distclean ./configure --with-tcl=/usr/lib --with-tk=/usr/lib --localstatedir=/var --prefix=/usr &>logconfig.txt make install cp -afv /usr/lib/snack2.2 $DESTDIR/usr/lib/snack2.2;check_status $? #there is /usr/lib/libsnackstub2.2.a, don't copy to Puppy. ls /usr/lib/libsnackstub2.2.a;check_status $? sync libstripfunc "$DESTDIR/usr/lib/snack2.2/libsnack.so" libstripfunc "$DESTDIR/usr/lib/snack2.2/libsound.so" fi echo skip_key abacus if [ "$nnn" ];then echo "Compiling/installing abacus..." echo "Note, some files edited." cd $PUPPYDIR/sources8/abacus-0.9.13 make clean make dep make fi ############################### echo echo "Now the script will build image.gz. " echo -ne "Press ENTER to continue, \"n\" to exit script now: " read vvv if [ "$vvv" = "n" ];then exit fi echo echo "Only do this once to rootfs-complete/ ..." echo -n "Apply fixups specific to Mandrake 9.2 y/n [n]: " read vvv if [ "$vvv" = "y" ];then rm -f $DESTDIR/usr/lib/libcrypto.so.0.9.6 rm -f $DESTDIR/usr/lib/libcrypto.so.0 sync ln -s libcrypto.so.0.9.7 $DESTDIR/usr/lib/libcrypto.so.0 rm -f $DESTDIR/usr/lib/libdb.so.3 rm -f $DESTDIR/usr/lib/libpthread.so rm -f $DESTDIR/usr/lib/libz.so rm -f $DESTDIR/usr/X11R6/lib/libfontconfig.so* #also in /usr/lib rm -f $DESTDIR/usr/lib/libssl.so.0.9.6 rm -f $DESTDIR/usr/lib/libssl.so.0 sync ln -f libssl.so.0.9.7 $DESTDIR/usr/lib/libssl.so.0 echo "...done." fi ###################### echo "Copying rootfs-complete/ to rootfs-tmp1/..." cd $PUPPYDIR rm -fr rootfs-tmp1 2>/dev/null sync cp -af rootfs-complete rootfs-tmp1 sync echo "Converting rootfs-tmp1/usr/ folder to cramfs image file..." cd $PUPPYDIR/rootfs-tmp1 $PUPPYDIR/mkcramfs usr usr-cramfs sync rm -f -r usr sync cd $PUPPYDIR rm -fr rootfs-tmp2 2>/dev/null sync mkdir rootfs-tmp2 echo "Making ext2 filesystem on rootfs-tmp2/, size $FSSIZE Kbytes..." dd if=/dev/zero of=image bs=1k count=$FSSIZE sync losetup /dev/loop0 image mke2fs -m 0 /dev/loop0 sync mount -t ext2 /dev/loop0 rootfs-tmp2 echo "Copying everything from rootfs-tmp1/ to rootfs-tmp2/..." cp -a rootfs-tmp1/* rootfs-tmp2/ sync echo "Creating compressed file image.gz..." umount rootfs-tmp2 losetup -d /dev/loop0 dd if=image | gzip -9 > image.gz sync rm -f image rm -fr rootfs-tmp1 rm -fr rootfs-tmp2 sync echo "image.gz created!" ####END####