rpm-build/rpminit

40 lines
725 B
Bash
Executable File

#!/bin/sh -e
# $Id$
#
# Written by Solar Designer <solar at owl.openwall.com> and placed in the
# public domain.
# Further modifications by ldv, still public domain.
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