home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Set initial variables:
- CWD=`pwd`
- if [ "$TMP" = "" ]; then
- TMP=/tmp
- fi
- PKG=$TMP/package-sh_utils
- SRC=/devel/manpagesrc
- INFO=$PKG/usr/info
- TEX=/devel/texinfo-docs
-
- 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
-
- # Function to handle manpage source:
- man2gz () { # $1 is source page name, $2 is target name for preformatted
- # output (full path && name) and $3 is the same, but for the
- # source.
- mkdir -p `dirname $2`
- groff -Tascii -mandoc $1 | gzip -9c > $2
- if [ ! "$3" = "" ]; then
- mkdir -p `dirname $3`
- cat $1 > $3
- fi
- }
-
- echo "+===============+"
- echo "| sh-utils-1.12 |"
- echo "+===============+"
- cd $TMP
- tar xzvf $CWD/sh-utils-1.12.tar.gz
- cd sh-utils-1.12
- 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
- cat su > $PKG/bin/su
- cat true > $PKG/bin/true
- cat uname > $PKG/bin/uname
- cat basename > $PKG/usr/bin/basename
- cat dirname > $PKG/usr/bin/dirname
- cat env > $PKG/usr/bin/env
- cat expr > $PKG/usr/bin/expr
- 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 sleep > $PKG/usr/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 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 su.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 $INFO
- cat sh-utils.info | gzip -9c > $INFO/sh-utils.info.gz
- cp sh-utils.texi $TEX/sh-utils.texi
-
- # Build the package:
- cd $PKG
- tar czvf $TMP/sh_utils.tgz .
-
- # Clean up the extra stuff:
- if [ "$1" = "--cleanup" ]; then
- rm -rf $TMP/sh-utils-1.12
- rm -rf $PKG
- fi
-