steffen: server obmtool,NONE,1.1 obmtool.conf,NONE,1.1
cvs at intevation.de
cvs at intevation.de
Sun Apr 4 22:36:52 CEST 2004
Author: steffen
Update of /kolabrepository/server
In directory doto:/tmp/cvs-serv18013
Added Files:
obmtool obmtool.conf
Log Message:
obmtool script + conf for building the server
--- NEW FILE: obmtool ---
#!/bin/sh
##
## obmtool -- OpenPKG poor man's Boot, Build & Management Tool
## based on Ralf S. Engelschall's "obmtool -- Development Tool"
## Copyright (c) 2003 Thomas Lotterer <thomas at lotterer.net>
## $Id: obmtool,v 1.1 2004/04/04 20:36:50 steffen Exp $
##
# default parameters
prg="$0"
silent=0
verbose=0
debug=0
help=0
query=0
force=0
file=""
logs=""
cmd=""
cmdargs=""
# iterate over argument line
while [ $# -gt 0 ]; do
opt="$1"
arg=""
arg=`echo "${opt}" | sed -e 's;^[^=]*=*;;'`
num=`echo "${arg}" | sed -e 's;^ *\([0-9]*\).*$;\1;'`
opt=`echo "${opt}" | sed -e 's;=.*$;;'`
[ ".${debug}" = .1 ] && echo "DEBUG: main: opt=$opt, arg=$arg, num=$num" #FIXME
[ ".${num}" = . ] && num=1
case $opt in
-s|--silent ) silent=${num} ;;
-v|--verbose ) verbose=${num} ;;
-d|--debug ) debug=${num} ;;
-h|--help ) help="USAGE" ;;
-q|--query ) query=${num} ;;
-f|--force ) force=${num} ;;
-c|--conf ) if [ ".${arg}" = . ]; then
if [ ".$2" != . ]; then
shift 2>/dev/null
conf="$1"
fi
else
file="${arg}"
fi ;;
-l|--logs ) if [ ".${arg}" = . ]; then
if [ ".$2" != . ]; then
shift 2>/dev/null
logs="$1"
fi
else
logs="${arg}"
fi ;;
-* ) help="ERROR" ;;
* ) break;
esac
shift
done
cmd="$1"
if [ ".$1" != . ]; then
shift
fi
cmdargs="$@"
# display error or usage message
if [ ".$help" != .0 ]; then
echo "obmtool:$help: obmtool [-s|--silent] [-v|--verbose] [-d|--debug] [-h|--help]" 1>&2
echo " [-q|--query] [-f|--force]" 1>&2
echo " [-c|--conf <file>] [-l|--logs <dir>]" 1>&2
echo " <cmd> [<arg> ...]" 1>&2
if [ ".$help" = "USAGE" ]; then
exit 0
else
exit 1
fi
fi
# check for configuration file
if [ ".${file}" = . ]; then
file="`echo ${prg} | sed -e 's;^.*/;./;'`.conf"
fi
if [ ! -r ${file} ]; then
file=
echo "obmtool:ERROR: configuration file ${file} not readable" 1>&2
exit 1
fi
[ ".${debug}" = .1 ] && echo "DEBUG: main: prg=\"$prg\" silent=\"$silent\" verbose=\"$verbose\" debug=\"$debug\" help=\"$help\" query=\"$query\" force=\"$force\" file=\"$file\" logs=\"$logs\" cmd=\"$cmd\" cmdargs=\"$cmdargs\""; #FIXME
cmdline=`grep "^%${cmd}" ${file}`
if [ ".$cmdline" = . ]; then
echo "obmtool:ERROR: command ${cmd} not found in configuration file ${file}" 1>&2
exit 1
fi
tmpdir="/tmp"; [ ".$TMPDIR" != . ] && tmpdir="$TMPDIR"
tmpfile="$tmpdir/rc.$$.tmp"
rm -f $tmpfile
(
sed <"${prg}" -e '1,/^## obmtool.func {/d' -e '/^## } obmtool.func/,$d';
echo " @prolog";
sed <"${file}" -e "1,/^%common/d" -e '/^%.*/,$d';
echo " @epilog";
sed <"${file}" -e "1,/^%${cmd}/d" -e '/^%.*/,$d'
) \
| sed -e 's;^\(.*[ ]*\)@\([a-z].*\)$;\1obmtool_\2;' >$tmpfile
#i $tmpfile
export prg silent verbose debug help query force file logs cmd cmdargs tmpfile tmpdir
sh $tmpfile
rc=$?
rm -f $tmpfile
exit $rc
## obmtool.func { # is now embedded. This line used as cutting point. Do not remove.
##
## obmtool.func -- OpenPKG poor man's Boot, Build & Management Tool Functions
## based on Ralf S. Engelschall's "obmtool.func -- Development Tool Functions"
## Copyright (c) 2003 Thomas Lotterer <thomas at lotterer.net>
##
#locate package
# supports CURRENT and STABLE trunk - autodetected by release id
# supports RELEASE and SOLID updates - autodetected by release id
# supports PLUS packages - prefix with '+'
# supports packages in CWD - prefix with './'
# supports private repository - prefix with '=' and set URL
#
@locate ()
{
LOC="."
PKG="$1"
ADD=""
shift
@archostag "$@"
# packages in CWD
echo "${PKG}" | ${EGREP} >/dev/null '^\.\/'
if [ $? -eq 0 ]; then
PKG=`echo "${PKG}" | sed 's/^\.\///'` # strip off leading "./", take relative path verbatim
return
fi
# private repository
echo "${PKG}" | ${EGREP} >/dev/null '^='
if [ $? -eq 0 ]; then
PKG=`echo "${PKG}" | sed 's/^=//'` # strip off leading "=", add URL to private repository
LOC="$URL"
return
fi
# prepare for PLUS packages
echo "${PKG}" | ${EGREP} >/dev/null '^\+'
if [ $? -eq 0 ]; then
ADD="/PLUS"
PKG=`echo "${PKG}" | sed 's/^\+//'` # strip off leading "+"
fi
# CURRENT
echo ${PKG} | ${EGREP} >/dev/null -- '-200[0-9][0-9]{4}$'
if [ $? -eq 0 ]; then
LOC="ftp://ftp.openpkg.org/current/SRC"
return
fi
# STABLE
echo ${PKG} | ${EGREP} >/dev/null -- '-[0-9][0-9]*\.200[0-9][0-9]{4}$'
if [ $? -eq 0 ]; then
LOC="ftp://ftp.openpkg.org/stable/SRC"
return
fi
# RELEASE (including PLUS)
echo ${PKG} | ${EGREP} >/dev/null -- '-[1-9][0-9]*\.[0-9][0-9]*\.0$'
if [ $? -eq 0 ]; then
LOC="`echo ${PKG} | sed -e 's;^.*-\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9][0-9]*$;ftp://ftp.openpkg.org/release/\1.\2/SRC;'`$ADD"
return
fi
# UPDATE (for CORE and BASE)
echo ${PKG} | ${EGREP} >/dev/null -- '-[1-9][0-9]*\.[0-9][0-9]*\.[1-9][0-9]*$'
if [ $? -eq 0 ]; then
LOC="`echo ${PKG} | sed -e 's;^.*-\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.[0-9][0-9]*$;ftp://ftp.openpkg.org/release/\1.\2/UPD;'`"
return
fi
echo "obmtool:ERROR: locate() does not understand how to handle \"${PKG}\"" 1>&2
exit 1
}
#wipe out existing binary rpm
@wiperpm ()
{
@locate "$@"
echo "wiperpm ${PKG}"
if [ ".$CHECKONLY" != ".yes" ]; then
if [ -f ${PREFIX}/RPM/PKG/${PKG}.*-${TAG}.rpm ]; then
rm ${PREFIX}/RPM/PKG/${PKG}.*-${TAG}.rpm
fi
fi
}
#rebuild only, no install
@rebuild ()
{
@locate "$@"
shift
if [ ".$CHECKONLY" != ".yes" ]; then
if [ ".${TERM}" = .xterm ]; then
echo "]0;`uname -n | sed -e 's;\..*$;;'` rebuild ${PKG} [`date '+%Y-%m-%d %H:%M:%S'`]rebuild ${PKG}"
else
echo "rebuild ${PKG}"
fi
if [ ! -f ${PREFIX}/RPM/PKG/${PKG}.${ARCH}-${OS}-${TAG}.rpm -a ! -f ./${PKG}.${ARCH}-${OS}-${TAG}.rpm ]; then
if [ -f ${HOME}/.rpmmacros ]; then
echo "obmtool:ERROR: rebuild() detected a \"${HOME}/.rpmmacros\". Please remove it." 1>&2
exit 1
fi
BUILDARGS=""
if [ -x ${PREFIX}/bin/openpkg ]; then
if [ ".${LOC}" = .. ]; then
LOCPRESU=${PWD:-`pwd`}
else
LOCPRESU=${LOC}
fi
BUILDUSER=`${PREFIX}/bin/openpkg rpm --eval '%{?l_musr:%{l_musr}}'`
BUILDEXEC="${PREFIX}/bin/openpkg rpm $@ --rebuild ${LOCPRESU}/${PKG}.src.rpm 2>&1"
BUILDEXEC=`echo ${BUILDEXEC} | sed -e 's;--\([^=][^=]*\)=;--\1 ;g'`
echo "BUILDEXEC=$BUILDEXEC" #FIXME ; read DUMMY
if [ ".${BUILDUSER}" = . ]; then
eval "${BUILDEXEC}" | tee /tmp/${PRG}-${PKG}.rebuild.log
else
su - "${BUILDUSER}" -c "${BUILDEXEC}" | tee /tmp/${PRG}-${PKG}.rebuild.log || true
fi
fi
echo "rebuild ${PKG} $?" >>/tmp/${PRG}.log
fi
if [ ".${TERM}" = .xterm ]; then
echo "]0;`uname -n | sed -e 's;\..*$;;'`:$0"
fi
fi
}
#force rebuild
@forcere ()
{
@wiperpm "$@"
@rebuild "$@"
}
#install, rebuilds if necessary, forcibly overwrite existing
@forcein ()
{
@locate "$@"
TRACK="${TRACK} ${PKG}"
if [ ".$CHECKONLY" != ".yes" ]; then
echo "forcein ${PKG}"
@rebuild "$@"
if [ -f ${HOME}/.rpmmacros ]; then
mv ${HOME}/.rpmmacros ${HOME}/.rpmmacros.${PRG}.save
fi
${PREFIX}/bin/rpm -Uvh --oldpackage --nodeps --force ${PREFIX}/RPM/PKG/${PKG}.*-${TAG}.rpm 2>&1 | tee /tmp/${PRG}-${PKG}.forcein.log
echo "forcein ${PKG} $?" >>/tmp/${PRG}.log
fi
}
#install, rebuilds if necessary
@install ()
{
ARGS="$@"
@locate "$@"
TRACK="${TRACK} ${PKG}"
if [ ".$CHECKONLY" != ".yes" ]; then
#check for special package "openpkg", detect new or broken hierarchy and bootstrap
echo "${PKG}" | ${EGREP} >/dev/null '^openpkg-[^-]+-[^-]+$'
if [ $? -eq 0 ]; then
echo "bootstrap check/execution"
if [ ! -d ${PREFIX} -o ! -x ${PREFIX}/bin/rpm ]; then
echo "did not find rpm executable, checking for binary sh"
tmpdir="/tmp"; test ".$TMPDIR" != . && tmpdir="$TMPDIR"
touch .writetest 2>/dev/null
if [ $? -eq 0 ]; then
rm .writetest
writedir="."
else
writedir="$tmpdir"
echo "CWD not writable, working in $tmpdir assuming to have approx. 300MB space there"
fi
if [ ! -f ${PKG}.${ARCH:-*}-${OS:-*}-${TAG:-*}.sh ]; then
echo "did not find binary sh, checking for source sh"
if [ ! -f $writedir/${PKG}.src.sh ]; then
echo "did not find source sh, trying to download source sh"
echo "$LOC/" | ${EGREP} >/dev/null '^\.\/'
if [ $? -eq 0 ]; then
echo "trying download from local using cp"
cp ${LOC}/${PKG}.src.sh $writedir/${PKG}.src.sh
else
echo "checking for curl"
if [ `which curl | ${EGREP} '^/' | wc -l` -ne 0 ]; then
echo "trying download from remote using curl"
curl -o $writedir/${PKG}.src.sh ${LOC}/${PKG}.src.sh
fi
fi
if [ ! -f $writedir/${PKG}.src.sh ]; then
[ ".$writedir" = .. ] && writedir=`pwd`
echo "obmtool:ERROR: please download ${LOC}/${PKG}.src.sh to $writedir manually and restart ${PRG}" 1>&2
exit 1
fi
fi
shift
if [ "$writedir" = . ]; then
TMPDIR=$tmpdir sh ${PKG}.src.sh $@ 2>&1 | tee /tmp/${PRG}-${PKG}.rebuild.log
if [ $? -ne 0 ]; then
echo "obmtool:ERROR: bootstrapping from . \"${PKG}.src.sh\" failed to build from source" 1>&2
exit 1
fi
else
if [ ! -f $writedir/${PKG}.src.sh ]; then
cp ${PKG}.src.sh $writedir/${PKG}.src.sh
fi
( cd $writedir && TMPDIR=$tmpdir sh ${PKG}.src.sh $@ 2>&1 | tee /tmp/${PRG}-${PKG}.rebuild.log )
if [ $? -ne 0 ]; then
echo "obmtool:ERROR: bootstrapping from $writedir \"${PKG}.src.sh\" failed to build from source" 1>&2
exit 1
fi
fi
fi
if [ "$writedir" = . ]; then
ALL=`( echo ${PKG}.${ARCH:-*}-${OS:-*}-${TAG:-*}.sh )`
for i in $ALL; do
if [ ".`
${EGREP} <$i . \
| sed -e '/parse command line options/,$d' \
| egrep -v '^ *#' \
| egrep '^(p|prefix|l_prefix)=' \
| sed -e 's;^[^=]*=.;;' -e 's;.$;;'`" = ".${PREFIX}" ]; then
sh ${i} 2>&1 | tee /tmp/${PRG}-${PKG}.install.log
if [ $? -ne 0 ]; then
echo "obmtool:ERROR: bootstrapping from . \"${PKG}.*-${TAG:-*}.sh\" failed to install from binary" 1>&2
exit 1
fi
# NAME - VERSION - RELEASE . ARCH - OS - TAG
F_NAME=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\1;'`
F_VERSION=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\2;'`
F_RELEASE=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\3;'`
F_ARCH=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\4;'`
F_OS=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\5;'`
F_TAG=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\6;'`
mv ${F_NAME}-${F_VERSION}-${F_RELEASE}.src.sh ${PREFIX}/RPM/PKG/ || true
mv ${F_NAME}-${F_VERSION}-${F_RELEASE}.src.rpm ${PREFIX}/RPM/PKG/ || true
mv ${F_NAME}-${F_VERSION}-${F_RELEASE}.${F_ARCH}-${F_OS}-${F_TAG}.sh ${PREFIX}/RPM/PKG/ || true
mv ${F_NAME}-${F_VERSION}-${F_RELEASE}.${F_ARCH}-${F_OS}-${F_TAG}.rpm ${PREFIX}/RPM/PKG/ || true
break;
fi
done
else
ALL=`( cd $writedir && echo ${PKG}.${ARCH:-*}-${OS:-*}-${TAG:-*}.sh )`
for i in $ALL; do
if [ ".`
${EGREP} <$writedir/$i . \
| sed -e '/parse command line options/,$d' \
| egrep -v '^ *#' \
| egrep '^(p|prefix|l_prefix)=' \
| sed -e 's;^[^=]*=.;;' -e 's;.$;;'`" = ".${PREFIX}" ]; then
( cd $writedir && sh ${i} 2>&1 | tee /tmp/${PRG}-${PKG}.install.log )
if [ $? -ne 0 ]; then
echo "obmtool:ERROR: bootstrapping from . \"${PKG}.*-${TAG:-*}.sh\" failed to install from binary" 1>&2
exit 1
fi
# NAME - VERSION - RELEASE . ARCH - OS - TAG
F_NAME=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\1;'`
F_VERSION=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\2;'`
F_RELEASE=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\3;'`
F_ARCH=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\4;'`
F_OS=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\5;'`
F_TAG=`echo "${i}" | sed -e 's;^\(..*\)-\([^-][^-]*\)-\([^-][^-]*\)\.\([^-][^-]*\)-\([^-][^-]*\)-\([^-][^-]*\)\.sh$;\6;'`
mv $writedir/${F_NAME}-${F_VERSION}-${F_RELEASE}.src.sh ${PREFIX}/RPM/PKG/ || true
mv $writedir/${F_NAME}-${F_VERSION}-${F_RELEASE}.src.rpm ${PREFIX}/RPM/PKG/ || true
mv $writedir/${F_NAME}-${F_VERSION}-${F_RELEASE}.${F_ARCH}-${F_OS}-${F_TAG}.sh ${PREFIX}/RPM/PKG/ || true
mv $writedir/${F_NAME}-${F_VERSION}-${F_RELEASE}.${F_ARCH}-${F_OS}-${F_TAG}.rpm ${PREFIX}/RPM/PKG/ || true
break;
fi
done
fi
else
if [ ".${TAGFMT}" = . ]; then
ARGS="$1"
else
ARGS="$1 --tag=${TAGFMT}"
fi
fi
fi
echo "install ${PKG}"
${PREFIX}/bin/rpm -q >/dev/null ${PKG}
if [ $? -ne 0 ]; then
@rebuild ${ARGS}
if [ -f ${HOME}/.rpmmacros ]; then
mv ${HOME}/.rpmmacros ${HOME}/.rpmmacros.${PRG}.save
fi
if [ -f ${PREFIX}/RPM/PKG/${PKG}.${ARCH}-${OS}-${TAG}.rpm ]; then
${PREFIX}/bin/rpm -Uvh --oldpackage --nodeps ${PREFIX}/RPM/PKG/${PKG}.${ARCH}-${OS}-${TAG}.rpm 2>&1 | tee /tmp/${PRG}-${PKG}.install.log
elif [ -f ./${PKG}.${ARCH}-${OS}-${TAG}.rpm ]; then
${PREFIX}/bin/rpm -Uvh --oldpackage --nodeps ./${PKG}.${ARCH}-${OS}-${TAG}.rpm 2>&1 | tee /tmp/${PRG}-${PKG}.install.log
else
echo "obmtool:ERROR: ${PKG}.${ARCH}-${OS}-${TAG}.rpm missing" 1>&2
exit 1
fi
echo "install ${PKG} $?" >>/tmp/${PRG}.log
fi
fi
}
#trigger force rebuild, force install
@trigger ()
{
@forcere "$@"
@forcein "$@"
}
@prolog ()
{
[ ".${debug}" = .1 ] && echo "DEBUG: prolog: prg=\"$prg\" silent=\"$silent\" verbose=\"$verbose\" debug=\"$debug\" help=\"$help\" query=\"$query\" force=\"$force\" file=\"$file\" logs=\"$logs\" cmd=\"$cmd\" cmdargs=\"$cmdargs\""; #FIXME
##
## obmtool has the call to the prolog() function hardcoded as the
## prolog of the %common scriplet. It is placed immediately after the
## obmtool.func has been read.
##
#M prolog() initializes variables which can be used throughout the scriptlets
#M
#M PRG = name of the program as seen in $0 of the obm but with leading path stripped off
#M CMD = name of the command as seen in $1 of the obm
#M URL = URL to private packages
#M TRACK = whitespace separated list of tracked packages, preinitialized to empty string
#M EGREP = name of egrep(1) program
#M CHECKONLY = yes|no; set to yes if --query option given
#M ERASESURPLUS = yes|no; set to yes if --force option given
#M HASX11 = yes|no; set to yes if X11 client libs available (xauth probed)
#M PREFIX = /openpkg; default can be overridden in %common scriptlet
#M NODE = dv1.dev.de.cw.net; uname -n
PRG="`echo ${prg} | sed -e 's/.*\///'`"
CMD="${cmd}"
URL=""
TRACK=""
if [ -x /usr/xpg4/bin/egrep ]; then
EGREP=/usr/xpg4/bin/egrep
else
EGREP=egrep
fi
if [ -d /usr/ccs/bin ]; then
PATH=/usr/ccs/bin:${PATH}
export PATH
fi
CHECKONLY="no"
if [ ".${query}" = .1 ]; then
CHECKONLY="yes"
fi
ERASESURPLUS="no"
if [ ".${force}" = .1 ]; then
ERASESURPLUS="yes"
fi
HASX11=""
if [ -x /usr/X11R6/bin/xauth -o -x /usr/openwin/bin/xauth -o -x /usr/bin/X11/xauth ]; then
# search for include and Intrinsic.h taken from x11-1.3.1-1.3.1
# search for include directory
for incdir in \
/usr/openwin/include \
/usr/openwin/share/include \
/usr/[xX]/include \
/usr/[xX]11*/include \
/usr/[xX]386/include \
/usr/[xX]ree86/include \
/usr/include \
/usr/include/[xX] \
/usr/include/[xX]11* \
/usr/include/[xX]386 \
/usr/include/[xX]free86 \
/usr/local/include \
/usr/local/include/[xX] \
/usr/local/include/[xX]11* \
/usr/local/include/[xX]386 \
/usr/local/include/[xX]free86 \
/usr/local/[xX]/include \
/usr/local/[xX]11*/include \
/usr/local/[xX]386/include \
/usr/local/[xX]ree86/include \
/usr/athena/include \
/usr/unsupported/include \
; do
if [ -f "$incdir/X11/Intrinsic.h" ]; then
x11_incdir="$incdir"
HASX11="yes"
break
fi
done
fi
# remove double slashes and trailing slashes
PREFIX=`echo "${PREFIX}" | sed -e 's;//*;/;g' -e 's;/$;;'`
NODE="`uname -n`"
@archostag
echo "${PRG}:${CMD}:NOTICE: restart `date '+%Y-%m-%d %H:%M:%S'`" >>/tmp/${PRG}.log
}
@epilog ()
{
[ ".${debug}" = .1 ] && echo "DEBUG: epilog: prg=\"$prg\" silent=\"$silent\" verbose=\"$verbose\" debug=\"$debug\" help=\"$help\" query=\"$query\" force=\"$force\" file=\"$file\" logs=\"$logs\" cmd=\"$cmd\" cmdargs=\"$cmdargs\""; #FIXME
##
## obmtool has the call to the epilog() function hardcoded as the
## epilog of the %common scriplet. It is placed immediately after the
## %common scriptlet.
##
#M epilog() initializes variables which can be used throughout the scriptlets
@archostag
# check whether a obsolete obmtool.conf tries to use us
error=0
for var in CWUSER CWGROUP TARGET_PATH TAGFMT CWMUID CWRUID CWNUID CWMGID CWRGID CWNGID; do
val=`eval "echo \\$${var}"`
if [ ".${val}" != . ]; then
echo "obmtool:WARNING: obsolete variable ${var} set to \"${val}\"" 1>&2
error=1
fi
done
if [ ${error} = 1 ]; then
echo "obmtool:ERROR: variables used which are no longer supported by obmtool" 1>&2
exit 1
fi
}
@hasfeature ()
{
missing=""
for feature in "$@"; do
case $feature in
TAGFMT) ;;
*) missing="$missing $feature";;
esac
done
if [ ".$missing" != . ]; then
echo "obmtool:WARNING: ${file} requires \"$missing\" feature(s) which this obmtool does not provide" 1>&2
return 1
fi
return 0
}
@locationid ()
{
echo "obmtool:ERROR: ${file} calls locationid which is deprecated by archostag()" 1>&2
exit 1
}
@tagfmtfromargs ()
{
TAGFMT=""
for i in "$@"; do
case $i in
--tag=*) TAGFMT=`echo $i | sed -e 's;^--tag=;;'` ;;
esac
done
}
@archostag ()
{
#M archostag() initializes variables which can be used throughout the scriptlets
#M they are queried from a rpm installed below PREFIX, if available.
#M Otherwise they are set to an empty string.
#M
#M TAG = cw; locationid (OpenPKG v1.x) or tag (OpenPKG v2.x)
#M ARCH = ix86; architecture
#M OS = freebsd4.8; operating system
@tagfmtfromargs "$@"
if [ ".${PREFIX}" != . -a -x ${PREFIX}/bin/rpm ]; then
ARCH=`${PREFIX}/bin/rpm -q --qf "%{ARCH}" openpkg`
OS=`${PREFIX}/bin/rpm --eval "%{?l_host_os:%{l_host_os}}"`
if [ ".${OS}" = . ]; then
OS=`${PREFIX}/bin/rpm -q --qf "%{OS}" openpkg`
fi
if [ ".${TAGFMT}" = . ]; then
TAG=`${PREFIX}/bin/rpm --eval '%{?l_tag:%{l_tag}}%{!?l_tag:%{l_location}}'`
else
TAG=`${PREFIX}/bin/rpm --define "l_tag_fmt ${TAGFMT}" --eval '%{?l_tag:%{l_tag}}%{!?l_tag:%{l_location}}'`
fi
else
ARCH=""
OS=""
TAG=""
fi
}
@status ()
{
${PREFIX}/etc/rc all status | grep active
}
@check ()
{
INSTALL=""
MISSING=""
SURPLUS=""
if [ ! -d ${PREFIX} -o ! -x ${PREFIX}/bin/rpm ]; then
MISSING="${TRACK}"
else
ALL=`${PREFIX}/bin/rpm -qa`
for i in ${TRACK}
do
${PREFIX}/bin/rpm -q $i 2>&1 >/dev/null
if [ $? -eq 0 ]; then
INSTALL="${INSTALL} $i"
ALL=`echo "${ALL}" | ${EGREP} -v "^$i"`
else
MISSING="${MISSING} $i"
fi
done
fi
if [ ".${ALL}" != "." ]; then
for i in ${ALL}
do
echo "$i" | ${EGREP} "^gpg-pubkey-" 2>&1 >/dev/null || SURPLUS="${SURPLUS} $i"
done
if [ ".${ERASESURPLUS}" = ".yes" ]; then
echo "---- erasing ----"
echo ${SURPLUS}
${PREFIX}/bin/rpm -e ${SURPLUS} 2>&1 >/dev/null
fi
fi
SUMMARY=""
DATE="`date '+%Y-%m-%d/%H:%M:%S'`"
if [ ".${TERM}" = .xterm ]; then
SUMMARY="${SUMMARY}]0;NODE=${NODE}; DATE=${DATE}; DONE"
fi
SUMMARY="${SUMMARY}NODE=${NODE}; DATE=${DATE}; HASX11=${HASX11}; DONE"
INSTALL="`echo ${INSTALL}`"
MISSING="`echo ${MISSING}`"
SURPLUS="`echo ${SURPLUS}`"
echo "INSTALL: ${INSTALL:-none}"
echo "MISSING: ${MISSING:-none}"
echo "SURPLUS: ${SURPLUS:-none}"
echo "SUMMARY: ${SUMMARY:-none}"
}
## } obmtool.func # is now embedded. This line used as cutting point. Do not remove.
--- NEW FILE: obmtool.conf ---
##
## obmtool.conf -- OpenPKG poor man's Boot, Build & Management Tool Configuration
##
## Package listing for Kolab
##
## based on Ralf S. Engelschall's "obmtool.conf -- Development Tool Configuration"
## Copyright (c) 2004 Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
## Copyright (c) 2003 Thomas Lotterer <thomas at lotterer.net>
##
%common
@hasfeature TAGFMT || exit # require obmtool to support TAGFMT
TMPDIR=/ltmp # large tmp with 300MB space
URL="ftp://ftp.zfos.org/brew/kolab/SRC" # used for non-ftp://ftp.openpkg.org/ packages
%kolab
echo "---- boot/build ${NODE} %${CMD} ----"
PREFIX=/${CMD};
loc='./' # '' (empty) for ftp.openpkg.org, '=' for URL, './' for CWD or absolute path
with_genuine=no
# start from scratch or upgrade within 2.0.x
@install ${loc}openpkg-20040324-20040324 \
--tag="zfos" \
--prefix="${PREFIX}" \
--user="${CMD}" --group="${CMD}" \
--muid="19414" --ruid="19415" --nuid="19416" \
--mgid="19414" --rgid="19415" --ngid="19416"
@install ${loc}make-3.80-20040207
@install ${loc}binutils-2.14-20040207
@install ${loc}gcc-3.3.3-20040218
@install ${loc}fsl-1.4.0-20040310
@install ${loc}mm-1.3.0-20040207
@install ${loc}perl-5.8.3-20040318
@install ${loc}perl-openpkg-5.8.3-20040318
@install ${loc}perl-conv-5.8.3-20040318
@install ${loc}lzo-1.08-20040207
@install ${loc}readline-4.3.5-20040211
@install ${loc}sharutils-4.2.1-20040207
@install ${loc}ncurses-5.4.20040328-20040329
@install ${loc}perl-term-5.8.3-20040323
@install ${loc}perl-ds-5.8.3-20040329
@install ${loc}perl-util-5.8.3-20040329
@install ${loc}perl-mail-5.8.3-20040330
@install ${loc}perl-crypto-5.8.3-20040318
@install ${loc}perl-net-5.8.3-20040323
@install ${loc}zlib-1.2.1-20040207
@install ${loc}bzip2-1.0.2-20040207
@install ${loc}perl-comp-5.8.3-20040318
@install ${loc}expat-1.95.7-20040207
@install ${loc}perl-xml-5.8.3-20040401
@install ${loc}perl-www-5.8.3-20040323
@install ${loc}perl-time-5.8.3-20040318
@install ${loc}openssl-0.9.7d-20040318
@install ${loc}imap-2004rc7-20040225
@install ${loc}perl-ssl-5.8.3-20040318
@install ${loc}procmail-3.22-20040311
@install ${loc}db-4.2.52.2-20040207
@install ${loc}openldap-2.2.8-20040329
@install ${loc}sasl-2.1.18-20040315 --with=ldap --with=login
@install ${loc}getopt-20030307-20040207
@install ${loc}proftpd-1.2.9-20040207 --with=ldap
@install ${loc}pcre-4.5-20040207
@install ${loc}gdbm-1.8.3-20040207
@install ${loc}dbtool-1.6-20040207
@install ${loc}postfix-2.0.19-20040313 --with=ldap --with=sasl --with=ssl
@install ${loc}perl-sys-5.8.3-20040325
@install ${loc}perl-ldap-5.8.3-20040318
@install ${loc}perl-db-5.8.3-20040318
@install ${loc}perl-kolab-5.8.3-20040319
@install ${loc}imapd-2.2.3-20040328 --with=group
@install ${loc}m4-1.4o-20040209
@install ${loc}bison-1.35-20040212
@install ${loc}flex-2.5.4a-20040331
@install ${loc}libiconv-1.9.2-20040207
@install ${loc}gettext-0.14.1-20040209
@install ${loc}openpkg-tool-20040217-20040218
@install ${loc}patch-2.5.9-20040207
@install ${loc}sed-4.0.9-20040215
@install ${loc}apache-1.3.29-20040327 \
--with=mod_auth_ldap \
--with=mod_dav \
--with=mod_php \
--with=mod_php_gdbm \
--with=mod_php_gettext \
--with=mod_php_imap \
--with=mod_php_openldap \
--with=mod_php_pear \
--with=mod_php_xml \
--with=mod_ssl
@install ${loc}spamassassin-2.63-20040218
@install ${loc}amavisd-20030616p8-20040309
@install ${loc}clamav-0.66-20040211
@install ${loc}kolab-1.9.0-20040404 --without=genuine
@check
%dump
echo "PRG = \"$PRG\""
echo "CMD = \"$CMD\""
echo "URL = \"$URL\""
echo "TRACK = \"$TRACK\""
echo "EGREP = \"$EGREP\""
echo "CHECKONLY = \"$CHECKONLY\""
echo "ERASESURPLUS = \"$ERASESURPLUS\""
echo "HASX11 = \"$HASX11\""
echo "PREFIX = \"${PREFIX}\""
echo "ARCH = \"${ARCH}\""
echo "OS = \"${OS}\""
echo "TAG = \"${TAG}\""
echo "TMPDIR=\"${TMPDIR}\""
More information about the commits
mailing list