rpm-build/rpminit

36 lines
579 B
Bash
Executable File

#!/bin/sh -e
# $Id$
verbose=
Verbose()
{
[ -n "$verbose" ] || return 0
echo "${0##*/}: $*" >&2
}
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
verbose=-v
shift
fi
RPMMACROS=~/.rpmmacros
if [ -e "$RPMMACROS" ]; then
RPMDIR=`rpm --eval %_topdir`
RPMTMP=`rpm --eval %_tmppath`
else
RPMDIR=~/RPM
RPMTMP="$RPMDIR/tmp"
fi
mkdir -p $verbose "$RPMDIR"/{BUILD,SOURCES,SPECS,SRPMS,RPMS/noarch} "$RPMTMP"
if [ ! -e "$RPMMACROS" ]; then
cat >"$RPMMACROS" <<EOF
%_topdir $RPMDIR
%_tmppath $RPMTMP
EOF
Verbose "Wrote $RPMMACROS:"
[ -z "$verbose" ] || cat "$RPMMACROS" >&2
fi