-echo "Dsc $PKG . Product $PRODUCT"
-echo "Ubuntu distros: $UBUNTU_DIST"
-echo "Debian distros: $DEBIAN_DIST"
-echo "Centos distros: $CENTOS_DIST"
-if test "${SUDO_USER}"; then
- echo "Running as sudo."
- echo "Tip: You can avoid it by adding the following in /etc/sudoers"
- echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
- HOME_EXPORT=/home/${SUDO_USER}
+if test "$CENTOS_DIST"; then
+ centos=true
+ RNAME=`awk '/Name:/ {print $2}' *.spec`
+ if test "$NAME" -a "$NAME" != "$RNAME"; then
+ echo "NAME in IDMETA ($NAME) does not match RPM spec NAME ($RNAME)"
+ exit 1
+ fi
+ PRODUCT=$RNAME
+ if test ! -d ~/rpmbuild; then
+ echo "Creating ~/rpmbuild"
+ mkdir -p ~/pmbuild/BUILD
+ mkdir -p ~/rpmbuild/RPMS/noarch
+ mkdir -p ~/rpmbuild/RPMS/x86_64
+ mkdir -p ~/rpmbuild/SOURCES
+ mkdir -p ~/rpmbuild/SPECS
+ mkdir -p ~/rpmbuild/SRPMS
+ fi
+ if test ! -f ~/.rpmmacros; then
+ echo "Creating ~/.rpmmacros"
+ echo "%_topdir $HOME/rpmbuild" >~/.rpmmacros
+ echo "%_source_filedigest_algorithm 0" >>~/.rpmmacros
+ echo "%_binary_filedigest_algorithm 0" >>~/.rpmmacros
+ fi