#!/bin/sh #(c)2004 Barry Kauler, www.goosee.com/puppy #third script to create Puppy Linux image.gz pwd | grep "sources2" &>/dev/null if [ $? -eq 0 ];then echo "You must first copy/move this script up one level, so that it is in the" echo "same directory as createpuppy0, busybox.links, sources0/, sources1/, etc." echo -e "Then open a terminal window in that directory and run \"# ./createpuppy2\"" echo echo -n "Press ENTER to exit: " exit fi PUPPYDIR="`pwd`" #/root/puppy SOURCESDIR="$PUPPYDIR/sources2" 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 "The script createpuppy0 must be run first. It creates a basic Puppy" echo "that can boot to the commandline." echo "Script createpuppy1 adds further programs to rootfs-complete/ folder" echo "to allow Puppy to run in X graphics mode, with a desktop and basic" echo "X applications." echo "Script createpuppy2 adds more apps to Puppy." echo -n "Press ENTER to continue this script (CTRL-C to quit): " read vvv echo echo -e "Would you like to cleanup sources2/ 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 sources2/, anything else not to: " read mmm if [ "$mmm" = "y" ];then echo "Please wait..." cd $PUPPYDIR/sources2/cdrtools-2.00.3 make clean &>/dev/null cd $PUPPYDIR/sources2/dillo-0.8.1 make clean &>/dev/null cd $PUPPYDIR/sources2/netpbm-10.11.10 make clean &>/dev/null cd $PUPPYDIR/sources2/figurine-1.0.5 make distclean &>/dev/null cd $PUPPYDIR/sources2/gaby-1.0.6 make distclean &>/dev/null cd $PUPPYDIR/sources2/gcombust-0.1.55 make distclean &>/dev/null cd $PUPPYDIR/sources2/gftp-2.0.9 make distclean &>/dev/null cd $PUPPYDIR/sources2/gkdial-1.5.14 make distclean &>/dev/null cd $PUPPYDIR/sources2/gpasman-1.3.1 make distclean &>/dev/null cd $PUPPYDIR/sources2/gphone-0.5.2 make distclean &>/dev/null cd $PUPPYDIR/sources2/gtkdiff-0.7.0 make distclean &>/dev/null cd $PUPPYDIR/sources2/memtester-2.93.1 make clean &>/dev/null cd $PUPPYDIR/sources2/tidy make clean &>/dev/null cd $PUPPYDIR/sources2/turma-0.1 make distclean &>/dev/null cd $PUPPYDIR/sources2/usbview-1.0 make distclean &>/dev/null cd $PUPPYDIR/sources2/xcut-0.2 make distclean &>/dev/null cd $PUPPYDIR/sources2/xpaint-2.7.0 make distclean &>/dev/null cd $PUPPYDIR/sources2/xtar make clean &>/dev/null cd $PUPPYDIR/sources2/xtmix-0.4 make clean &>/dev/null echo "...cleaned sources1/ folder. Exiting script..." exit fi if [ ! -d $DESTDIR ];then echo echo "$DESTDIR does not exist. This means that you have not yet" echo "run createpuppy0 script." echo -n "Press ENTER to quit: " read vvv exit fi echo echo "This script compiles the applications in $PUPPYDIR/sources2" echo "and also copies binaries directly out of the host system and" echo "builds the final Puppy filesystem as a compressed file image.gz." echo echo "Do you want to recompile everything in sources2/ 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 echo echo "Please be sure to follow instructions exactly." echo -en "If you see a red " echo -en "\\033[1;31mfailed" echo -en "\\033[0;39m" echo " message, you may have to abort" echo "the script with CTRL-C and find out why." echo "(or, you may wish to make a note of the file that failed to" echo " compile and just keep going with the script)" echo "(note, the script may have found a default file from the host," echo " so that failed file may already be in rootfs-complete)" echo -n "Press ENTER key to continue: " read vvv fi echo skip_key cdrtools if [ "$nnn" ];then FILECDREC="`which cdrecord 2>/dev/null`" if [ "$FILECDREC" ];then echo "The host already has cdrtools/cdrecord installed, so won't compile it." echo "Grabbing the files from the host..." for SRCFILE in cdda2wav cdrecord devdump isodump isoinfo isovfy mkisofs readcd scgcheck do rm -f $DESTDIR/usr/bin/$SRCFILE 2>/dev/null cp -afv "`which $SRCFILE 2>/dev/null`" $DESTDIR/usr/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/bin/$SRCFILE" done else echo "Compiling and installing cdrtools..." echo "NOTE: config is very odd, it may be configuring for a 686 cpu." echo "NOTE: will not compile on Mandrake 9.2. ...maybe need later package?" #you can do "make distclean", then wait a long time, it seems to distclean #then "make" also. "make install" does the actual compiling. rm -fr /opt/schily &>/dev/null sync cd $PUPPYDIR/sources2/cdrtools-2.00.3 #do not do make distclean. make clean &>/dev/null make &>logbuild.txt make install &>loginstall.txt echo "...installs everything to /opt/schily" echo "Now installing to Puppy..." FLAGFAILED=0 for SRCFILE in cdda2wav cdrecord devdump isodump isoinfo isovfy mkisofs readcd scgcheck do cp -afv /opt/schily/bin/$SRCFILE $DESTDIR/usr/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/bin/$SRCFILE" done if [ $FLAGFAILED -eq 1 ];then echo "Ok, so it failed! You should install the cdrtools package on the host," echo "then run this script again and it will detect it and use the files from" echo "the host." echo "Alternatively, I suspect that the version of cdrtools is not most recent" echo "and you could try the latest source tarball." fi fi fi echo echo "Note, dillo configure looks for libpng12-config, and will then use libpng12" echo "however I only want libpng.so.xxx library in Puppy, so createpuppy1 renamed" echo "/usr/bin/libpng12-config to hide it." skip_key dillo if [ "$nnn" ];then echo "Compiling and installing Dillo..." echo "Note, also installs dillo to host (so you can use in host)." cd $PUPPYDIR/sources2/dillo-0.8.1 make uninstall &>/dev/null make distclean &>/dev/null ./configure --build=i486-pc-linux-gnu --enable-cookies --enable-png --enable-jpeg --enable-gif &>logconfig.txt make &>logbuild.txt make install &>loginstall.txt cp -afv /usr/local/bin/dillo $DESTDIR/usr/local/bin/;check_status $? cp -afv /usr/local/bin/dpid $DESTDIR/usr/local/bin/;check_status $? cp -afv /usr/local/bin/dpidc $DESTDIR/usr/local/bin/;check_status $? #dillo v0.8.0 has these plugins... cp -afv /usr/local/lib/dillo/dpi/bookmarks/bookmarks.dpi $DESTDIR/usr/local/lib/dillo/dpi/bookmarks/;check_status $? cp -afv /usr/local/lib/dillo/dpi/downloads/downloads.dpi $DESTDIR/usr/local/lib/dillo/dpi/downloads/;check_status $? cp -afv /usr/local/lib/dillo/dpi/ftp/ftp.filter.dpi $DESTDIR/usr/local/lib/dillo/dpi/ftp/;check_status $? cp -afv /usr/local/lib/dillo/dpi/hello/hello.filter.dpi $DESTDIR/usr/local/lib/dillo/dpi/hello/;check_status $? cp -afv /usr/local/lib/dillo/dpi/https/https.filter.dpi $DESTDIR/usr/local/lib/dillo/dpi/https/;check_status $? sync binstripfunc "$DESTDIR/usr/local/lib/dillo/dpi/bookmarks/bookmarks.dpi" binstripfunc "$DESTDIR/usr/local/lib/dillo/dpi/downloads/downloads.dpi" binstripfunc "$DESTDIR/usr/local/lib/dillo/dpi/ftp/ftp.filter.dpi" binstripfunc "$DESTDIR/usr/local/lib/dillo/dpi/hello/hello.filter.dpi" binstripfunc "$DESTDIR/usr/local/lib/dillo/dpi/https/https.filter.dpi" binstripfunc "$DESTDIR/usr/local/bin/dillo" #binstripfunc "$DESTDIR/usr/local/bin/dpidc" binstripfunc "$DESTDIR/usr/local/bin/dpid" fi echo skip_key netpbm if [ "$nnn" ];then echo "Compiling and installing netpbm..." echo "Note, installs to /tmp/netpbmpkg in host, does not touch existing install." echo "this may take awhile..." # rm -fr /tmp/netpbmpkg &>/dev/null # sync cd $PUPPYDIR/sources2/netpbm-10.11.10 make clean &>/dev/null make &>logbuild.txt make package pkgdir=/tmp/netpbmpkg &>loginstall.txt echo "the ppm/pnm/pgm conversions apps are located in /tmp/netpbmpkg" echo "as is the shared library libnetpbm.so. Copying library to Puppy..." cp -afv /tmp/netpbmpkg/lib/libnetpbm.so.10 $DESTDIR/usr/lib/;check_status $? cp -afv /tmp/netpbmpkg/lib/libnetpbm.so.10.11 $DESTDIR/usr/lib/;check_status $? sync libstripfunc "$DESTDIR/usr/lib/libnetpbm.so.10.11" echo "copying selected conversion apps to Puppy..." for SRCFILE in anytopnm giftopnm jpegtopnm pgmramp pgmtopbm pgmtoppm pbmtoxbm pngtopnm pnmalias pnmcat pnmconvol pnmcut pnmnlfilt pnmrotate pnmscale pnmsmooth pnmtops pnmtotiff pnmtojpeg pnmtopng ppmdither ppmrainbow ppmtogif ppmtopgm ppmtoxpm ppmtobmp ppmquant pstopnm tifftopnm xbmtopbm xpmtoppm xwdtopnm do cp -afv /tmp/netpbmpkg/bin/$SRCFILE $DESTDIR/usr/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/bin/$SRCFILE" #sync done rm -fr /tmp/netpbmpkg &>/dev/null fi echo skip_key figurine if [ "$nnn" ];then echo "Compiling and installing figurine..." cd $PUPPYDIR/sources2/figurine-1.0.5 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu &>logconfig.txt make &>logbuild.txt sync cp -afv src/figurine $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/figurine" fi echo skip_key gaby if [ "$nnn" ];then echo "Compiling and installing gaby..." cd $PUPPYDIR/sources2/gaby-1.0.6 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu --disable-nls &>logconfig.txt make &>logbuild.txt sync cp -afv src/gaby $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gaby" fi echo skip_key gcombust if [ "$nnn" ];then echo "Compiling and installing gcombust..." cd $PUPPYDIR/sources2/gcombust-0.1.55 make distclean &>/dev/null ./configure --build=i486-pc-linux-gnu --disable-nls &>logconfig.txt make &>logbuild.txt sync cp -afv src/gcombust $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gcombust" fi echo skip_key gftp if [ "$nnn" ];then echo "Compiling and installing gftp..." cd $PUPPYDIR/sources2/gftp-2.0.9 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu --disable-nls &>logconfig.txt make &>logbuild.txt sync cp -afv src/gtk/gftp-gtk $DESTDIR/usr/local/bin/gftp;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gftp" fi echo skip_key gkdial if [ "$nnn" ];then echo "Compiling and installing gkdial..." echo "Note, some files edited." cd $PUPPYDIR/sources2/gkdial-1.5.14 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu --disable-nls --enable-gnome=no &>logconfig.txt make &>logbuild.txt sync cp -afv src/gkdial $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gkdial" fi echo skip_key gpasman if [ "$nnn" ];then echo "Compiling and installing gpasman..." echo "Note, some files edited." cd $PUPPYDIR/sources2/gpasman-1.3.1 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu &>logconfig.txt make &>logbuild.txt sync cp -afv src/gpasman $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gpasman" fi echo skip_key gphone if [ "$nnn" ];then echo "Compiling and installing gphone..." echo "Note, some files edited." echo "Note, uses libpopt and libgsm." cd $PUPPYDIR/sources2/gphone-0.5.2 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu --with-gsm=/usr/lib &>logconfig.txt make &>logbuild.txt sync cp -afv gphone/gphone $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gphone" fi echo skip_key gtkdiff if [ "$nnn" ];then echo "Compiling and installing gtkdiff..." echo "Note, some files edited." echo "Note, uses libpopt and libgsm." cd $PUPPYDIR/sources2/gtkdiff-0.7.0 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu &>logconfig.txt make &>logbuild.txt sync cp -afv gtkdiff $DESTDIR/usr/local/bin/;check_status $? echo "gtkdiff is a frontend for the diff program, getting from host..." cp -afv "`which diff 2>/dev/null`" $DESTDIR/usr/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/gtkdiff" binstripfunc "$DESTDIR/usr/bin/diff" fi echo skip_key memtester if [ "$nnn" ];then cd $PUPPYDIR/sources2/memtester-2.93.1 make clean &>/dev/null make &>logbuild.txt sync cp -afv memtest $DESTDIR/usr/sbin/;check_status $? sync binstripfunc "$DESTDIR/usr/sbin/memtest" fi echo skip_key tidy if [ "$nnn" ];then echo "Compiling and installing tidy..." echo "Note, installs to host also." cd $PUPPYDIR/sources2/tidy make uninstall &>/dev/null make distclean &>/dev/null ./configure --disable-utf16 --disable-asian --prefix=/usr --build=i486-pc-linux-gnu &>logconfig.txt make &>logbuild.txt make install &>loginstall.txt sync cp -afv console/.libs/tidy $DESTDIR/usr/bin/;check_status $? cp -afv console/.libs/tab2space $DESTDIR/usr/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/bin/tidy" binstripfunc "$DESTDIR/usr/bin/tab2space" cp -afv src/.libs/libtidy.so $DESTDIR/usr/lib/;check_status $? cp -afv src/.libs/libtidy-0.99.so.0 $DESTDIR/usr/lib/;check_status $? cp -afv src/.libs/libtidy-0.99.so.0.0.0 $DESTDIR/usr/lib/;check_status $? sync libstripfunc "$DESTDIR/usr/lib/libtidy-0.99.so.0.0.0" fi echo skip_key turma if [ "$nnn" ];then echo "Compiling and installing turma..." cd $PUPPYDIR/sources2/turma-0.1 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu --disable-nls &>logconfig.txt make &>logbuild.txt sync cp -afv src/turma $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/turma" fi echo skip_key usbview if [ "$nnn" ];then echo "Compiling and installing usbview..." cd $PUPPYDIR/sources2/usbview-1.0 make distclean &>/dev/null ./configure --host=i486-pc-linux-gnu &>logconfig.txt make &>logbuild.txt sync cp -afv usbview $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/usbview" fi echo skip_key xcut if [ "$nnn" ];then echo "Compiling and installing xcut..." cd $PUPPYDIR/sources2/xcut-0.2 make distclean &>/dev/null xmkmf &>/dev/null make &>logbuild.txt sync cp -afv xcut $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/xcut" fi echo skip_key xpaint if [ "$nnn" ];then echo "Compiling and installing xpaint..." cd $PUPPYDIR/sources2/xpaint-2.7.0 make distclean &>/dev/null xmkmf &>/dev/null make Makefiles &>/dev/null make depend &>/dev/null readlink /usr/X11R6/lib/libXaw.so | grep "libXaw95" if [ $? -eq 0 ];then #=0 found make xaw95 &>logbuild.txt else make xaw &>logbuild.txt fi sync cp -afv xpaint $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/xpaint" fi echo skip_key xtar if [ "$nnn" ];then cd $PUPPYDIR/sources2/xtar make clean &>/dev/null make &>logbuild.txt sync cp -afv xtar $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/xtar" fi echo skip_key xtmix if [ "$nnn" ];then cd $PUPPYDIR/sources2/xtmix-0.4 make clean &>/dev/null make &>logbuild.txt sync cp -afv xtmix $DESTDIR/usr/local/bin/;check_status $? sync binstripfunc "$DESTDIR/usr/local/bin/xtmix" fi #echo #skip_key mpg123 #if [ "$nnn" ];then # cd $PUPPYDIR/sources2/mpg123-0.59r # make clean &>/dev/null # make linux-i486 &>logbuild.txt # sync # cp -afv mpg123 $DESTDIR/usr/bin/;check_status $? # rm -f $DESTDIR/usr/local/bin/madplay # sync # binstripfunc "$DESTDIR/usr/bin/mpg123" # ln -s /usr/bin/mpg123 $DESTDIR/usr/local/bin/madplay #fi ############################### echo echo "Now the script will build image.gz. You don't have to build" echo "image.gz now, especially if you want to go ahead and compile" echo "and install apps from sources3,etc." echo -ne "Press ENTER to continue, \"n\" to exit script now: " read vvv if [ "$vvv" = "n" ];then exit fi echo echo "Copying a modified .fvwm95rc from sources2/ to rootfs-complete/root0/..." cd $PUPPYDIR/sources2 cp -fv fvwm95rc $DESTDIR/root0/.fvwm95rc echo 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####