From: marc Date: Tue, 14 Oct 1997 22:02:54 +0000 (+0000) Subject: Do a sanity check on BuildRoot X-Git-Tag: rpm-4.4-release~3879 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27f71aba7b121f8474242feba80c62350eed8f25;p=platform%2Fupstream%2Frpm.git Do a sanity check on BuildRoot CVS patchset: 1856 CVS date: 1997/10/14 22:02:54 --- diff --git a/build/build.c b/build/build.c index 5b900ce..49cd842 100644 --- a/build/build.c +++ b/build/build.c @@ -117,6 +117,17 @@ struct Script *openScript(Spec spec, int builddir, char *name) fprintf(script->file, "cd %s\n\n", build_subdir); } + /* We do a litte sanity check here just to make sure we do not wipe */ + /* the system by accident... */ + if (rpmGetVar(RPMVAR_BUILDROOT)) { + fprintf(script->file, "if [ -z \"$RPM_BUILD_ROOT\" -o \"$RPM_BUILD_ROOT\" = \"/\" ]; then\n"); + fprintf(script->file, " echo\n"); + fprintf(script->file, " echo 'Warning: Spec contains BuildRoot: tag that is either empty or is set to \"/\"'\n"); + fprintf(script->file, " echo\n"); + fprintf(script->file, " exit 1\n"); + fprintf(script->file, "fi\n"); + } + return script; }