All pastes #2118325 Raw Edit

Miscellany

public text v1 · immutable
#2118325 ·published 2012-02-17 03:57 UTC
rendered paste body
[sphaaz@domU-12-31-39-07-C4-55 scripts]$ cat build-tcz-package.sh
#!/bin/bash
#This is TinyCoreLinux autobuild script!!
#it builds from specified url that contains tar.gz
#source files, todo is to add cheching routines
#so far it only downloads tar.gz source
#copies it to /tmp, makes tmp/package
#untars it enters dir configures, does make -j3
#and make install to /tmp/package, then strips binaries
#removes any usr/local/share/doc and /usrlocal/share/man
#squashes it to a specified name
#
#
#Usage: build-tcz-package sourceurl tczname

#Source URL
SOURCE_URL=$1

#Source tarball
SOURCE_TGZ=$(echo $LINK | rev | cut -d/ -f1 | rev)
SOURCE_DIR=$(echo $SOURCE | rev | cut -d. -f2- | rev)

#TCZ filename
PACKAGE_NAME=$2

#Downloading source tarball
wget $SOURCE_URL

#Copy source tarball to /tmp
cp $SOURCE_TGZ /tmp

#Untar source tarball
tar xvf $SOURCE_TGZ

#Cleaning and creating our temp package dir
sudo rm -R /tmp/package
mkdir /tmp/package

#Entering Source dir tree
cd $SOURCE_DIR

#Configuring the sources,making them and installing to /tmp/package
./configure --prefix=/usr/local

make -j3

make DESTDIR=/tmp/package install

#Entering dir we installed int to strip binaries and libs
cd /tmp/package

find . | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null

#Removing doc and man files
sudo rm -R /tmp/package/usr/local/share/man
sudo rm -R /tmp/package/usr/local/share/doc

#Making file list and exiting package dir
find `ls` -not -type d  > $PACKAGE_NAME.list
mv $PACKAGE_NAME.list /tmp
cd ..

#Creating TCZ usig squashfs-tools
mksquashfs /tmp/package $PACKAGE_NAME

#Creating md5sum for TCZ
md5sum $PACKAGE_NAME > $PACKAGE_NAME.md5.txt

#Creating info file for TCZ
echo Title:           > $PACKAGE_NAME.info
echo Description:     >> $PACKAGE_NAME.info
echo Version:         >> $PACKAGE_NAME.info
echo Author:          >> $PACKAGE_NAME.info
echo Original-site:   >> $PACKAGE_NAME.info
echo Copying-policy:  >> $PACKAGE_NAME.info
echo Size:            >> $PACKAGE_NAME.info
echo Extension_by:    >> $PACKAGE_NAME.info
echo Comments:        >> $PACKAGE_NAME.info
echo Change-log:      >> $PACKAGE_NAME.info
echo Current:         >> $PACKAGE_NAME.info



[sphaaz@domU-12-31-39-07-C4-55 scripts]$