#!/bin/sh # # rpmdev-wipetree -- erase all files within the rpm build dir # # Copyright (c) Warren Togami , # Ville Skyttä # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Sanity Check: Forbid root user if [ $(id -u) -eq 0 ]; then echo echo "ERROR: You should not be building RPMS as the superuser!" echo "Please use rpmdev-setuptree as a normal user and build" echo "packages as that user. If package building fails, then" echo "the package is improper and needs fixing." echo exit 255 fi # Wipe RPM Build Directory clean echo "Removing all build files..." rm -rf $(rpm --eval "%{_builddir}")/* rm -rf $(rpm --eval "%{_sourcedir}")/* rm -rf $(rpm --eval "%{_srcrpmdir}")/* rm -rf $(rpm --eval "%{_specdir}")/* find $(rpm --eval "%{_rpmdir}") -name "*.rpm" | xargs rm -f