summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2015-10-01 00:18:32 +0200
committerAdam Strzelecki <ono@java.pl>2015-10-03 19:51:17 +0200
commit6cc98539354607306e213ac90b2dac7cb3e86f73 (patch)
tree41b37206ce429162973d88c42ef99292f97852ee
parent6655537c6658e39b1d44c228a2315a62f6f9fc69 (diff)
downloadNim-6cc98539354607306e213ac90b2dac7cb3e86f73.tar.gz
bootstrap: Generate final install.sh during build
This solves problem where bootstrap was simply copying ./install.sh.template
into ./install.sh. Then first call of ./install.sh was calling ./koch install
that was running extra compilation and overwriting ./install.sh with new
content.

This was overcomplicated, and also caused first `sudo ./install.sh DIR` to run
compilation under root account, leaving root owned files in working directory.

Now bootstrap calls `./koch geninstall` that just generates ./install.sh
without calling it. This ./install.sh is FINAL one, and running it does not
generate any files aside passed DIR. This makes whole process simpler.
-rwxr-xr-xbootstrap.sh7
-rw-r--r--install.sh.template9
2 files changed, 5 insertions, 11 deletions
diff --git a/bootstrap.sh b/bootstrap.sh
index ade74a9aa..7f19c2440 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -12,8 +12,11 @@ cd ".."
 
 ./bin/nim c koch
 ./koch boot -d:release
+./koch geninstall
 
-cp -f install.sh.template install.sh
-chmod +x install.sh
+set +x
+
+echo
+echo 'Install Nim using "./install.sh <dir>" or "sudo ./install.sh <dir>".'
 
 exit 0
diff --git a/install.sh.template b/install.sh.template
deleted file mode 100644
index 1292abdab..000000000
--- a/install.sh.template
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-set -x
-
-if [ "$1" != "" ]; then
-	exec ./koch install "$1"
-else
-	exec ./koch install
-fi