#!/bin/sh # Set initial variables: CWD=`pwd` if [ "$TMP" = "" ]; then TMP=/tmp fi PKG=$TMP/package-sh_utils if [ ! -d $TMP ]; then mkdir -p $TMP # location to build the source fi if [ ! -d $PKG ]; then mkdir -p $PKG # place for the package to be built fi # Explode the package framework: cd $PKG explodepkg $CWD/_sh_utils.tar.gz echo "+===============+" echo "| sh-utils-1.16 |" echo "+===============+" cd $TMP tar xzvf $CWD/sh-utils-1.16.tar.gz cd sh-utils-1.16 mkdir -p $PKG/usr/doc/sh-utils-1.16 cp -a README COPYING NEWS THANKS TODO $PKG/usr/doc/sh-utils-1.16 chmod 644 $PKG/usr/doc/sh-utils-1.16/* chown root.root $PKG/usr/doc/sh-utils-1.16/* zcat $CWD/sh-utils-1.16.diff.gz | patch -p1 -E sleep 1 ./configure --prefix=/usr make CFLAGS=-O2 LDFLAGS=-s cd src cat date > $PKG/bin/date cat echo > $PKG/bin/echo cat false > $PKG/bin/false # We use the hostname from util-linux... # cat hostname > $PKG/bin/hostname cat pwd > $PKG/bin/pwd cat stty > $PKG/bin/stty # This is in shadow.tgz... #cat su > $PKG/bin/su cat true > $PKG/bin/true cat uname > $PKG/bin/uname cat basename > $PKG/usr/bin/basename cat chroot > $PKG/usr/sbin/chroot cat dirname > $PKG/usr/bin/dirname cat env > $PKG/usr/bin/env cat expr > $PKG/usr/bin/expr cat factor > $PKG/usr/bin/factor cat groups > $PKG/usr/bin/groups cat id > $PKG/usr/bin/id cat logname > $PKG/usr/bin/logname cat nice > $PKG/usr/bin/nice cat nohup > $PKG/usr/bin/nohup cat pathchk > $PKG/usr/bin/pathchk cat printenv > $PKG/usr/bin/printenv cat printf > $PKG/usr/bin/printf cat seq > $PKG/usr/bin/seq cat sleep > $PKG/bin/sleep cat tee > $PKG/usr/bin/tee cat test > $PKG/usr/bin/test cat tty > $PKG/usr/bin/tty cat users > $PKG/usr/bin/users cat who > $PKG/usr/bin/who cat whoami > $PKG/usr/bin/whoami cat yes > $PKG/usr/bin/yes cd ../man for page in basename.1 chroot.1 date.1 dirname.1 echo.1 \ env.1 expr.1 false.1 groups.1 id.1 logname.1 nice.1 nohup.1 \ pathchk.1 printenv.1 printf.1 pwd.1 sleep.1 stty.1 tee.1 test.1 \ true.1 tty.1 uname.1 users.1 who.1 whoami.1 yes.1 ; do cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz done cd ../doc mkdir -p $PKG/usr/info cat sh-utils.info | gzip -9c > $PKG/usr/info/sh-utils.info.gz # Build the package: cd $PKG tar czvf $TMP/sh_utils.tgz . # Warn of zero-length files: for file in `find . -type f -print` ; do if [ "`filesize $file`" = "0" ]; then echo "WARNING: zero length file $file" fi if [ "`filesize $file`" = "20" ]; then echo "WARNING: possible empty gzipped file $file" fi done # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP/sh-utils-1.16 rm -rf $PKG fi