Generate devel/upload during build time from template
authorMichael Hanselmann <hansmi@google.com>
Mon, 5 May 2008 15:27:53 +0000 (15:27 +0000)
committerMichael Hanselmann <hansmi@google.com>
Mon, 5 May 2008 15:27:53 +0000 (15:27 +0000)
- Use variable with prefix instead of grep and sed
- Always run with /bin/bash

Reviewed-by: ultrotter

Makefile.am
configure.ac
devel/Makefile.am [new file with mode: 0644]
devel/upload.in [moved from devel/upload with 96% similarity, mode: 0644]

index b2a617c..98a7035 100644 (file)
@@ -1,6 +1,6 @@
 ACLOCAL_AMFLAGS = -I autotools
 
-SUBDIRS = man lib scripts daemons doc test tools qa
+SUBDIRS = man lib scripts daemons doc test tools qa devel
 EXTRA_DIST = NEWS DEVNOTES
 
 .PHONY: ganeti
index 4d10aa1..c41fac7 100644 (file)
@@ -114,6 +114,7 @@ fi
 AC_CONFIG_FILES([
   Makefile
   daemons/Makefile
+  devel/Makefile
   doc/Makefile
   doc/examples/Makefile
   lib/Makefile
diff --git a/devel/Makefile.am b/devel/Makefile.am
new file mode 100644 (file)
index 0000000..fe2cc43
--- /dev/null
@@ -0,0 +1,9 @@
+EXTRA_DIST = upload.in
+CLEANFILES = upload
+
+all-local: upload
+upload: upload.in
+       sed \
+         -e 's#@PREFIX@#$(prefix)#g' \
+       < $< > $@
+       chmod u+x $@
old mode 100755 (executable)
new mode 100644 (file)
similarity index 96%
rename from devel/upload
rename to devel/upload.in
index 9543ea9..e85587a
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright (C) 2006, 2007 Google Inc.
 #
@@ -38,7 +38,7 @@ echo ---
 
 echo ---
 
-PREFIX=$(cat Makefile | grep '^prefix' | sed -e 's/.*= //')
+PREFIX='@PREFIX@'
 
 # and now put it under $prefix on the target node(s)
 for host; do