rpm-build/rpminit

39 lines
718 B
Plaintext
Raw Normal View History

2002-12-30 02:28:33 +03:00
#!/bin/sh -e
#
# Written by Solar Designer <solar at owl.openwall.com> and placed in the
# public domain.
# Further modifications by ldv, still public domain.
2002-12-30 02:28:33 +03:00
verbose=
Verbose()
{
[ -n "$verbose" ] || return 0
echo "${0##*/}: $*" >&2
}
if [ "$1" = "-v" -o "$1" = "--verbose" ]; then
verbose=-v
shift
fi
2002-12-30 02:28:33 +03:00
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"
2002-12-30 02:28:33 +03:00
if [ ! -e "$RPMMACROS" ]; then
cat >"$RPMMACROS" <<EOF
%_topdir $RPMDIR
%_tmppath $RPMTMP
EOF
Verbose "Wrote $RPMMACROS:"
[ -z "$verbose" ] || cat "$RPMMACROS" >&2
2002-12-30 02:28:33 +03:00
fi