diff options
Diffstat (limited to 'sdk/bin')
-rwxr-xr-x | sdk/bin/clean | 22 | ||||
-rwxr-xr-x | sdk/bin/config | 175 | ||||
-rwxr-xr-x | sdk/bin/config.sub | 38 | ||||
-rwxr-xr-x | sdk/bin/diag | 171 | ||||
-rwxr-xr-x | sdk/bin/dist | 63 | ||||
-rwxr-xr-x | sdk/bin/disthtml | 31 | ||||
-rwxr-xr-x | sdk/bin/install.bind | 55 | ||||
-rwxr-xr-x | sdk/bin/install.help | 12 | ||||
-rwxr-xr-x | sdk/bin/install.make | 112 | ||||
-rwxr-xr-x | sdk/bin/instinit | 61 | ||||
-rwxr-xr-x | sdk/bin/instman | 32 | ||||
-rwxr-xr-x | sdk/bin/instso | 39 | ||||
-rwxr-xr-x | sdk/bin/instsvc | 27 | ||||
-rwxr-xr-x | sdk/bin/rootsudo | 6 |
14 files changed, 844 insertions, 0 deletions
diff --git a/sdk/bin/clean b/sdk/bin/clean new file mode 100755 index 0000000..2667461 --- /dev/null +++ b/sdk/bin/clean @@ -0,0 +1,22 @@ +#!/bin/sh +flist=`find . -name core -follow -print` +if [ ! -z "$flist" ] ; then + rm $flist +fi + +flist=`find . -name "*~" -follow -print` +if [ ! -z "$flist" ] ; then + rm $flist +fi + +flist=`find . -name "*.tar.gz" -follow -print` +if [ ! -z "$flist" ] ; then + rm $flist +fi + +flist=`find . -name "config.c*" -follow -print` +if [ ! -z "$flist" ] ; then + rm $flist +fi + + diff --git a/sdk/bin/config b/sdk/bin/config new file mode 100755 index 0000000..a701bc8 --- /dev/null +++ b/sdk/bin/config @@ -0,0 +1,175 @@ +#!/bin/sh + +# +# Reload defaults +# + +BUILD=sdk +CONFIG=sdk/config.h + +if test -f config.cache ; then + . ./config.cache +fi +echo -n >config.cache + +if test -f config.pkg ; then + . ./config.pkg +fi + +# +# Load bindings +# + +if test -f config.pkg ; then + . ./config.pkg +fi + +if test -f config.make ; then + echo -n >config.make +fi + +if test -f $CONFIG ; then + echo -n >$CONFIG +fi + +if test -f $BUILD/bin/config.sub ; then + . $BUILD/bin/config.sub +fi + +BIND_OPTS='host' + +if test -z "$CONFIG_HOST" ; then + if test -d /usr/local/include ; then + CONFIG_HOST=/usr/local + fi + if test -d /usr/include ; then + CONFIG_HOST=/usr + fi +fi + +opt_host() { + CONFIG_HOST="$1" + return 0 +} + +if test ! -z "$BIND" ; then + for bind in $BIND ; do + if test -d $BUILD/$bind ; then + . $BUILD/$bind/bind.conf + else + . $BUILD/bin/$bind.bind + fi + done +fi + +# +# Parse command line arguments. +# +err='' + +if test ! -z "$CONFIG_FLAGS" ; then + for arg in $CONFIG_FLAGS ; do + for opt in $BIND_OPTS ; do + case "$arg" in + $opt=* | -$opt=* | --$opt=* ) + opt_$opt `echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` + break + ;; + esac + done + done +fi + + +if test ! -z "$*" ; then + for arg in $* ; do + err=$arg + for opt in $BIND_OPTS ; do + case "$arg" in + $opt=* | -$opt=* | --$opt=* ) + opt_$opt `echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` + err='' + break + ;; + esac + done + if test ! -z "$err" ; then + break + fi + done +fi + +CONFIG_FLAGS='' + +if test ! -z "$err" ; then + echo "config: $err: invalid option." + echo + echo "Valid Options:" + echo -n >config.help + if test ! -z "$BIND" ; then + for use in $BIND ; do + if test -f $BUILD/$use/help.conf ; then + cat $BUILD/$use/help.conf >>config.help + fi + if test -f $BUILD/bin/$use.help ; then + cat $BUILD/bin/$use.help >>config.help + fi + done + sort <config.help + rm -f config.help + fi + exit -1 +fi + +echo "#ifndef __CONFIG_H__" >>$CONFIG +echo "#define __CONFIG_H__" >>$CONFIG + +CONFIG_LIBS="" + +if test ! -z "$BIND" ; then + for bind in $BIND ; do + if test -d $BUILD/$bind ; then + . $BUILD/$bind/make.conf + CONFIG_LIBS='-l'$bind' '"$CONFIG_LIBS" + MAKEFILES="$MAKEFILES"' '$BUILD/$bind/Makefile + else + . $BUILD/bin/$bind.make + fi + done +fi + +if test ! -z "$CONFIG_LIBS" ; then + echo "LIBS=$CONFIG_LIBS" >>config.make +fi + +if test ! -z "$MAKEFILES" ; then + for makefile in $MAKEFILES ; do + cat config.make >$makefile + cat $makefile.in >>$makefile + done +fi + +echo "#endif" >>$CONFIG + + +if test -z "$CONFIG_CACHE" ; then + CONFIG_CACHE='config.cache' + CONFIG_FLAGS='' +else + CONFIG_FIRST='' +fi + +echo "CONFIG_CACHE="$CONFIG_CACHE >>config.cache + +if test -f conftest.c ; then + rm -f conftest.c +fi + +if test -f conftest.o ; then + rm conftest.o +fi + +if test ! -z "$CONFIG_FIRST" ; then + $CONFIG_FIRST +fi + diff --git a/sdk/bin/config.sub b/sdk/bin/config.sub new file mode 100755 index 0000000..81a7488 --- /dev/null +++ b/sdk/bin/config.sub @@ -0,0 +1,38 @@ +fn_find_fpath() { + save_ifs="$IFS" + IFS="${IFS}:" + for dir in $3 ; do + if test $1 $dir/$2 ; then + IFS="$save_ifs" + return 0 + fi + done + IFS="$save_ifs" + return 1 +} + +fn_find_type() { + fail=$1 + shift + text=$1 + shift + for fn in $* ; do + if test -f "$fn" ; then + grep "$text" <$fn >/dev/null + if test ! $? = 1 ; then + return 1 + fi + fi + done + echo "#define "$fail >>$CONFIG + return 0 +} + +fn_find_file() { + if test ! -f $2 ; then + echo "#define "$1 >>$CONFIG + return 1 + fi + return 0 +} + diff --git a/sdk/bin/diag b/sdk/bin/diag new file mode 100755 index 0000000..aa56844 --- /dev/null +++ b/sdk/bin/diag @@ -0,0 +1,171 @@ +#!/bin/sh + +files='' +ldd='no' +gcc='no' +hardware='no' +startup='no' +drivers='no' +symbols='no' +tracer='' + +if [ -f /usr/bin/strace ] ; then + tracer='strace' +fi + +if [ -f /bin/strace ] ; then + tracer='strace' +fi + +if [ -f /sbin/strace ] ; then + tracer='strace' +fi + +if [ -f /bin/ldd ] ; then + ldd='yes' +fi + +if [ -f /usr/bin/ldd ] ; then + ldd='yes' +fi + +if [ -f /usr/bin/gcc ] ; then + gcc='yes' +fi + +if [ -f /usr/local/bin/gcc ] ; then + gcc='yes' +fi + +if [ -f config.diag ] ; then + . ./config.diag +fi + +if [ ! -z "$title" ] ; then + echo $title +fi + +if [ ! -z "$strace" ] ; then + for trace in $strace ; do + echo + ls -l $trace + if [ $ldd = 'yes' ] ; then + echo + echo "Library map for " $trace + ldd $trace + fi + if [ $symbols = 'yes' ] ; then + echo + nm $trace + fi + if [ ! -z "$tracer" ] ; then + echo + $tracer $opts $trace 2>&1 + fi + done +fi + +echo +echo -n "System Type: " +uname -s + +echo -n "Achitecture: " +uname -m + +echo -n "Release: " +uname -r + +if [ $gcc = 'yes' ] ; then + echo + echo "GCC Information:" + gcc -v 2>&1 +fi + +if [ -f /proc/meminfo ] ; then + echo + echo "Memory:" + cat /proc/meminfo +fi + +echo "" +echo "Disks:" +df + +if [ $startup = 'yes' ] ; then + + if [ -d /etc/rc.d ] ; then + echo + echo "Services:" + ls -l /etc/rc.d + if [ -d /etc/rc.d/rc3.d ] ; then + echo + echo "Startup:" + ls /etc/rc.d/rc3.d + fi + fi +fi + +if [ -f config.cache ] ; then + echo + echo "Configuration:" + cat config.cache +fi + +if [ -f config.cc ] ; then + echo + echo "Compiler:" + cat config.cc +fi + +if [ ! -z "$files" ] ; then + for file in $files ; do + if [ -f $file ] ; then + echo + echo "Found: " $file + echo + cat $file + fi + done +fi + +if [ $drivers = 'yes' ] ; then + + if [ -f /proc/modules ] ; then + echo + echo "Modules:" + cat /proc/modules + fi +fi + +if [ $hardware = 'yes' ] ; then + + if [ -f /proc/devices ] ; then + echo + echo "Devices:" + cat /proc/devices + fi + + if [ -f /proc/ioports ] ; then + echo + echo "Ports:" + cat /proc/ioports + fi + + if [ -f /proc/interrupts ] ; then + echo + echo "Interrupts:" + cat /proc/interrupts + fi + + if [ -f /proc/dma ] ; then + echo + echo "DMA:" + cat /proc/dma + fi + + if [ -f /proc/cpuinfo ] ; then + echo + cat /proc/cpuinfo + fi +fi + diff --git a/sdk/bin/dist b/sdk/bin/dist new file mode 100755 index 0000000..43c6ef9 --- /dev/null +++ b/sdk/bin/dist @@ -0,0 +1,63 @@ +#!/bin/sh + +if test ! -f config.dist ; then + echo "dist: config.dist missing!" +fi + +# defaults! + +distdir=$1 +config="config.dist config.pkg build" +exclude="*.o *.a config.cc config.cache config *.tar.gz *~ core Makefile" +exclude_exe="true" +exclude_files=".EXCLUDE" + +. ./config.dist + +root=`pwd` +dist=$package'-'$version +cd .. + +if test ! $dist = $root ; then + rm -f $dist + ln -s $root $dist +fi + +xlist=$dist/.EXCLUDE +echo -n >$xlist +for file in $exclude_files ; do + echo $dist/$file >>$xlist +done + +flist="" + +for cfg in $include $config ; do + flist=$flist' '$dist/$cfg +done + +for dir in $examine ; do + flist=$flist' '$dist/$dir + if test $exclude_exe = "true" ; then + find $dist/$dir -perm +1 -type f -follow -print >>$xlist + fi + for deny in $exclude ; do + find $dist/$dir -follow -name $deny -print >>$xlist + done +done + +target=$dist/$dist.tar.gz +if test -d $distdir ; then + rm -f $distdir/${package}*.tar.gz + target=$distdir/$dist.tar.gz + if test -f $dist/$package'.lsm' ; then + cp -f $dist/$package'.lsm' $distdir + fi +fi + +tar -X $xlist -cvhzf $target $flist + +if [ ! $dist = $root ] ; then + rm $dist +fi + + diff --git a/sdk/bin/disthtml b/sdk/bin/disthtml new file mode 100755 index 0000000..4caa151 --- /dev/null +++ b/sdk/bin/disthtml @@ -0,0 +1,31 @@ +#!/bin/sh + +manprefix=$2 + +if test -f config.dist ; then + . ./config.dist +fi + +if test -z $htmlhome ; then + htmlhome=$1/$package +else + htmlhome=$1/$htmlhome +fi + +man2html $manprefix $manpages $htmlhome + +for lsmpage in $lsmpages ; do + echo "Creating $lsmpage.html..." + lsm2html $lsmpage >$htmlhome/$lsmpage.html +done + +for txtpage in $txtpages ; do + echo "Creating $txtpage.txt" + cp $txtpage $htmlhome/$txtpage.txt +done + +for htmlpage in $htmlpages ; do + echo "Copying $htmlpage" + cp -f html/$htmlpage $htmlhome/$htmlpage +done + diff --git a/sdk/bin/install.bind b/sdk/bin/install.bind new file mode 100755 index 0000000..1a00236 --- /dev/null +++ b/sdk/bin/install.bind @@ -0,0 +1,55 @@ +BIND_OPTS=$BIND_OPTS' prefix eprefix share bindir sbindir confdir mandir infodir libdir slibdir root htmldir distdir' + +opt_prefix() { + CONFIG_PREFIX="$1" +} + +opt_eprefix() { + CONFIG_EPREFIX="$1" +} + +opt_share() { + CONFIG_SHARE="$1" +} + +opt_bindir() { + CONFIG_BINDIR="$1" +} + +opt_sbindir() { + CONFIG_SBINDIR="$1" +} + +opt_confdir() { + CONFIG_CONFDIR="$1" +} + +opt_root() { + CONFIG_ROOT="$1" +} + +opt_libdir() { + CONFIG_LIBDIR="$1" +} + +opt_slibdir() { + CONFIG_SLIBDIR="$1" +} + +opt_mandir() { + CONFIG_MANDIR="$1" +} + +opt_infodir() { + CONFIG_INFODIR="$1" +} + +opt_htmldir() { + CONFIG_HTMLDIR="$1" +} + +opt_distdir() { + CONFIG_DISTDIR="$1" +} + + diff --git a/sdk/bin/install.help b/sdk/bin/install.help new file mode 100755 index 0000000..6907439 --- /dev/null +++ b/sdk/bin/install.help @@ -0,0 +1,12 @@ +--root= Installation root offset (NONE) +--prefix= Default installation prefix (/usr) +--eprefix= Execution installation prefix (/usr) +--bindir= Bin directory ($exec-prefix/bin) +--sbindir= System bin directory ($exec-prefix/sbin) +--libdir= Library directory ($exec-prefix/lib) +--slibdir= System library directory ($exec-prefix/lib) +--confdir= Config file directory (/etc) +--share= Shared data directory ($prefix/share) +--mandir= Manual directory ($share/man) +--infodir= Info file directory ($share/info) +--htmldir= HTML Documentation ($share/html) diff --git a/sdk/bin/install.make b/sdk/bin/install.make new file mode 100755 index 0000000..fc63cc6 --- /dev/null +++ b/sdk/bin/install.make @@ -0,0 +1,112 @@ +echo "root="$CONFIG_ROOT >>config.make + +if test -z "$CONFIG_PREFIX" ; then + echo 'prefix=$(root)'$CONFIG_HOST >>config.make +else + echo 'prefix=$(root)'$CONFIG_PREFIX >>config.make +fi + +if test -z "$CONFIG_EPREFIX" ; then + echo 'eprefix=$(prefix)' >>config.make +else + echo 'eprefix=$(root)'$CONFIG_EPREFIX >>config.make +fi + +if test -z "$CONFIG_SHARE" ; then + if test -d $CONFIG_HOST/share ; then + echo 'share=$(prefix)/share' >>config.make + else + echo 'share=$(prefix)' >>config.make + fi +else + echo 'share=$(root)'$CONFIG_SHARE >>config.make +fi + + +if test -z "$CONFIG_CONFDIR" ; then + echo 'SYSCONFDIR=$(root)/etc' >>config.make +else + echo 'SYSCONFDIR=$(root)'$CONFIG_CONFDIR >>config.make +fi + +if test -z "$CONFIG_BINDIR" ; then + echo 'BINDIR=$(eprefix)/bin' >>config.make +else + echo 'BINDIR=$(root)'$CONFIG_BINDIR >>config.make +fi + +if test -z "$CONFIG_SBINDIR" ; then + if test -d $CONFIG_HOST/sbin ; then + echo 'SBINDIR=$(eprefix)/sbin' >>config.make + else + echo 'SBINDIR=$(root)/etc' >>config.make + fi +else + echo 'SBINDIR=$(root)'$CONFIG_SBINDIR >>config.make +fi + +if test -z "$CONFIG_LIBDIR" ; then + echo 'LIBDIR=$(eprefix)/lib' >>config.make +else + echo 'LIBDIR=$(root)'$CONFIG_LIBDIR >>config.make +fi + +if test -z "$CONFIG_SLIBDIR" ; then + echo 'SLIBDIR=$(root)/lib' >>config.make +else + echo 'SLIBDIR=$(root)'$CONFIG_SLIBDIR >>config.make +fi + +if test -z "$CONFIG_MANDIR" ; then + if test -d $CONFIG_HOST/share/man ; then + echo 'MANDIR=$(share)/man' >>config.make + else + echo 'MANDIR=$(prefix)/man' >>config.make + fi +else + echo 'MANDIR=$(root)'$CONFIG_MANDIR >>config.make +fi + +if test -z "$CONFIG_INFODIR" ; then + if test -d $CONFIG_HOST/share/info ; then + echo 'INFODIR=$(share)/info' >>config.make + else + echo 'INFODIR=$(prefix)/info' >>config.make + fi +else + echo 'INFODIR=$(root)'$CONFIG_INFODIR >>config.make +fi + +if test -z "$CONFIG_HTMLDIR" ; then + if test -d $CONFIG_HOST/share/html ; then + echo 'HTMLDIR=$(share)/html' >>config.make + else + echo 'HTMLDIR=$(prefix)/html' >>config.make + fi +else + echo 'HTMLDIR=$(root)'$CONFIG_HTMLDIR >>config.make +fi + +if test -z "$CONFIG_DISTDIR" ; then + if test -d $CONFIG_HOST/share/dist ; then + echo 'DISTDIR=$(share)/dist' >>config.make + else + echo 'DISTDIR=$(prefix)/dist' >>config.make + fi +else + echo 'DISTDIR=$(root)'$CONFIG_DISTDIR >>config.make +fi + +echo "CONFIG_ROOT="$CONFIG_ROOT >>config.cache +echo "CONFIG_PREFIX="$CONFIG_PREFIX >>config.cache +echo "CONFIG_EPREFIX="$CONFIG_EPREFIX >>config.cache +echo "CONFIG_SHARE="$CONFIG_SHARE >>config.cache +echo "CONFIG_CONFDIR="$CONFIG_CONFDIR >>config.cache +echo "CONFIG_BINDIR="$CONFIG_BINDIR >>config.cache +echo "CONFIG_SBINDIR="$CONFIG_SBINDIR >>config.cache +echo "CONFIG_LIBDIR="$CONFIG_LIBDIR >>config.cache +echo "CONFIG_SLIBDIR="$CONFIG_SLIBDIR >>config.cache +echo "CONFIG_INFODIR="$CONFIG_INFODIR >>config.cache +echo "CONFIG_MANDIR="$CONFIG_MANDIR >>config.cache +echo "CONFIG_HTMLDIR="$CONFIG_HTMLDIR >>config.cache +echo "CONFIG_DISTDIR="$CONFIG_DISTDIR >>config.cache diff --git a/sdk/bin/instinit b/sdk/bin/instinit new file mode 100755 index 0000000..fdd0899 --- /dev/null +++ b/sdk/bin/instinit @@ -0,0 +1,61 @@ +#!/bin/sh +run=/etc/rc.d +levels="" +base=$1 + +if [ ! -d $run ] ; then + exit 0 +fi + +if [ -d $run/init.d ] ; then + levels=$run + init='../init.d/'$1'.init' + run=$run/init.d + target=$1'.init' +else + target='rc.'$1 + levels='false' +fi + +source=$1'.init' +shift + +if [ ! -f "$run/$target" ] ; then + echo 'Adding '$target' to '$run + if [ -f /etc/sudo.conf ] ; then + sudo root install -o root -m 0700 $source $run/$target + else + su root -c "install -o root -m 0700 $source $run/$target" + fi +else + exit 0 +fi + +if [ -z "$BASH" ] ; then + exit 0 +fi + +if [ -z "$levels" ] ; then + exit 0 +fi + +initial=$1 +shift + +for level in $* ; do + runlvl=$levels'/rc'$level'.d' + if [ ! -d $runlvl ] ; then + continue + fi + cd $runlvl + count=$initial + while [ -f *$count* ] ; do + count=$[count + 1] + done + target='S'$count$base + echo 'Adding '$target' to '$runlvl + ln -s $init $target +done + + + diff --git a/sdk/bin/instman b/sdk/bin/instman new file mode 100755 index 0000000..d8ca6f7 --- /dev/null +++ b/sdk/bin/instman @@ -0,0 +1,32 @@ +#!/bin/sh +prefix=$1 +set=$2 +shift +shift + +for page in $* ; do + source=$page'.'$set + target="" + if [ -d $prefix/man$set ] ; then + mandir=$prefix/man$set + target=$mandir/$page'.'$set + fi + if [ -z $target ] ; then + roff=nroff + if [ -f /usr/lib/groff ] ; then + roff="groff -Tascii" + fi + if [ -f /usr/local/lib/groff ] ; then + roff="groff -Tascii" + fi + if [ -d $prefix/cat$set ] ; then + mandir=$prefix/cat$set + target=$mandir/$page.set + $roff -man <$source >$page'.man' + source=$page'.man' + fi + fi + echo 'Adding '$page' to '$mandir + install -g man -m 0664 $source $target +done + diff --git a/sdk/bin/instso b/sdk/bin/instso new file mode 100755 index 0000000..148a82a --- /dev/null +++ b/sdk/bin/instso @@ -0,0 +1,39 @@ +#!/bin/sh + +prefix=$1 +libname=$2 +version=$3 + +# find project root. + +root=`dirname $0` +root=`dirname $root` + +# fetch package 'version' level from project root (config.dist). + +if [ -f $root/config.dist ] ; then + . $root/config.dist +fi + +if [ ! -d $(prefix)/lib ] ; then + prefix=$/usr + if [ ! -d /usr/lib ] ; then + exit 0 + fi +fi + +prefix=$prefix/lib +echo 'Installing '$libname'.so to '$prefix +cp -f $libname'.so' $(prefix)/$(libname)'.so.'$version +ldconfig -n $(prefix) + +liblist=`find $(prefix) -name "$(libname).so.*" -type f -print` +for lib in $liblist ; do + if [ ! $lib = $libname'.so.'$version ] ; then + rm $lib + fi +done + +ldconfig -n $(prefix) + + diff --git a/sdk/bin/instsvc b/sdk/bin/instsvc new file mode 100755 index 0000000..468fe2a --- /dev/null +++ b/sdk/bin/instsvc @@ -0,0 +1,27 @@ +#!/bin/sh + +etc='/etc' + +if [ ! -d "$etc" ] ; then + etc='' + if [ -d /config ] ; then + etc='/config' + fi +fi + +if [ -z "$etc" ] ; then + exit 0 +fi + +svc=$etc/$1 +shift +base=$1 +shift +line=$base" $*" + +grep "^$base" <$svc >/dev/null +if [ $? = 1 ] ; then + echo "Adding $base to $svc" + echo $line >>$svc +fi + diff --git a/sdk/bin/rootsudo b/sdk/bin/rootsudo new file mode 100755 index 0000000..3ff65f1 --- /dev/null +++ b/sdk/bin/rootsudo @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -f /etc/sudo.conf ] ; then + sudo root $* +else + su root -c "$*" +fi |