From 27f71aba7b121f8474242feba80c62350eed8f25 Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 14 Oct 1997 22:02:54 +0000 Subject: [PATCH] Do a sanity check on BuildRoot CVS patchset: 1856 CVS date: 1997/10/14 22:02:54 --- build/build.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; } -- 2.7.4