Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ##See related post: http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- #this script shows howto use pupngo to build your own new puppy
- #this is a very rough demo - ajust script and functions to your own needs.
- #061210goingnuts
- CURDIR=$(pwd)
- TITLE="pUPnGO 041210-rebuilder"
- TYPE="cli" #dialog or cli
- [ $(which dialog) ] && TYPE="dialog" && DIALOG=dialog
- [ $(which Xdialog) ] && [ "$DISPLAY" ] && DIALOG=Xdialog
- [ "$DISPLAY" ] && [ "$(tty | grep not)" ] && [ ! "${DIALOG}" = "Xdialog" ] && exec rxvt -e sh -c $0
- message_fc () { #message function
- #clear
- if [ "${TYPE}" = "dialog" ]; then
- "${DIALOG}" --title "${TITLE}" --msgbox "${TEXT} Press OK to continue/quit." 0 0
- fi
- if [ "${TYPE}" = "cli" ]; then
- echo "${TITLE}"
- echo "${TEXT}"
- echo "Press any key to continue/quit."
- read dummy
- fi
- }
- find_libs () {
- TARGETDIR="$CURDIR/myadds_412/"
- echo "Scanning directory:
- $TARGETDIR
- Please wait..."
- echo
- TEXT=""
- [ $(which upx) ] && UPX="no"
- cd $TARGETDIR
- echo -n > /tmp/liblist
- find . -type f | while read x; do
- [ "${UPX}" = "yes" ] && upx -d -q "$x" >/dev/null 2>&1;
- ldd "$x" >> /tmp/liblist 2>&1;
- done
- cd $CURDIR
- sed -i "s/\/\//\//g" /tmp/liblist
- sed -i "s/\t/ /g" /tmp/liblist
- cat /tmp/liblist | grep "=>" > /tmp/liblist
- cat /tmp/liblist | cut -d " " -f 4 | sort -u | grep "lib" > /tmp/liblist
- #list missing libs
- NEEDED="$(cat /tmp/liblist)"
- for lib in $NEEDED; do
- if [ ! -f $TARGETDIR$lib ]; then
- echo "Missing : $lib"
- TEXT="$TEXT
- Missing : $lib"
- fi
- done
- echo "------------------------------------------"
- TEXT="$TEXT
- ------------------------------------------
- "
- #list present needed libs
- for lib in $NEEDED; do
- if [ -f $TARGETDIR$lib ]; then
- echo "Present and needed : $lib"
- TEXT="$TEXT
- Present and needed : $lib"
- fi
- done
- #find all libs present
- cd $TARGETDIR
- echo -n > /tmp/liblist
- for y in lib usr/lib usr/X11R7/lib; do
- find $y -type f >> /tmp/liblist
- done
- cat /tmp/liblist | grep "so" | sort -u > /tmp/liblist
- #list all libs present
- PRESENT="$(cat /tmp/liblist)"
- echo -n > /tmp/liblist
- for lib in $PRESENT; do
- echo "/$lib" >> /tmp/liblist
- done
- PRESENT="$(cat /tmp/liblist)"
- echo "------------------------------------------"
- TEXT="$TEXT
- ------------------------------------------
- "
- #list unused libs
- for needed in $NEEDED; do
- cat /tmp/liblist | grep -v $needed > /tmp/liblist
- #find symlink target
- if [ -h $TARGETDIR$needed ]; then
- REAL=$(readlink $TARGETDIR$needed)
- cat /tmp/liblist | grep -v $REAL > /tmp/liblist
- fi
- done
- UNUSED="$(cat /tmp/liblist)"
- for lib in $UNUSED; do
- echo "Unused : $lib"
- TEXT="$TEXT
- Unused : $lib"
- if [ ! "$(echo $lib | grep libgcc)" = "" ]; then
- echo "NB: $lib might be needed although not a direct dependency"
- TEXT="$TEXT
- NB: $lib might be needed although not a direct dependency"
- fi
- done
- TEXT="$TEXT
- You should copy any missing libraries into folder
- $CURDIR/myadds_412.
- If libc is listed above (missing or needed) you
- also need /lib/ld-linux.so.2.
- If libraries present and not used you can delete
- them...
- "
- message_fc
- }
- http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- #start main program
- http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- #check we have the iso
- if [ ! -f $CURDIR/pUPnGO_V412_041210.iso ]; then
- TEXT="You need to have the pUPnGO_V412_041210.iso in
- the same directory as this script is running
- ($CURDIR).
- Or move this script to the directory where the iso is.
- "
- message_fc
- exit
- fi
- TEXT="Welcome to this small demo of howto
- modify pUPnGO_041210 to contain the programs
- YOU want."
- message_fc
- #first we need to create the construction area
- for DIR in isomaster output myadds_412 tmpmntpoint pets; do
- [ ! -d $DIR ] && mkdir -p $DIR
- done
- #mount the iso
- mount -t iso9660 -o loop pUPnGO_V412_041210.iso tmpmntpoint
- #copy main-things to isomaster - add glibc2.6_412.sfs, GUI_412.sfs and links_static.pet if you need them as well...
- for FILE in boot.msg initrd.gz isolinux.bin isolinux.cfg pup_412pupngo.sfs vmlinuz zdrv_412.sfs; do
- cp -f tmpmntpoint/$FILE isomaster/
- done
- umount tmpmntpoint
- http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- TEXT="You can now build the additional filestructure in directory http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- '$CURDIR/myadds'
- by either adding directly or place pet files in directory
- '$CURDIR/pets'.
- Do this before pressing OK/Enter.
- "
- message_fc
- #check if pets placed in pets-dir
- PETS=$(ls pets/)
- echo $PETS
- if [ "$PETS" = "" ]; then
- echo "empty"
- else
- #unpack pets and move to myadds_412
- for ARCHIVES in $PETS; do
- cp -a $CURDIR/pets/${ARCHIVES} tmpmntpoint
- cd tmpmntpoint
- pet2tgz ${ARCHIVES}
- tar -zxf ${ARCHIVES/.pet/}.tar.gz
- cd ${ARCHIVES/.pet/}
- cp -af * $CURDIR/myadds_412/
- rm -rf $CURDIR/tmpmntpoint/*
- done
- fi
- #check for missing libs
- TEXT="Now I will try to test if some libraries are missing.
- This is not a fool-proof test - there might be some dependencies
- that can not be found directly."
- message_fc
- find_libs
- #create sfs-file with the new stuffhttp://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- rm -f ${CURDIR}/isomaster/myadds_412.sfs #clean up
- mksquashfs ${CURDIR}/myadds_412/ ${CURDIR}/isomaster/myadds_412.sfs -noappend
- http://www.murga-linux.com/puppy/viewtopic.php?p=473814#473814
- #rebuild the iso
- mkisofs -o ${CURDIR}/output/output.iso -jcharset iso-8859-1 -R -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ${CURDIR}/isomaster
- TEXT="Finished. You new ISO-image is in
- $CURDIR/output.
- Run in qemu (recommended!) or burn a cd and test it.
- After booting/login run 'firstboot', chose 'configure' and choose
- 'Install programs' - choose 'cancel' and 'exit'. At the prompt
- enter 'pkginstall.sh /mnt/cdrom/myadds_412.sfs' to install.
- Or reboot, create personal savefile - and the myadds_412.sfs
- will be loaded at next boot.
- "
- message_fc
Advertisement
Add Comment
Please, Sign In to add comment