Permalink
Browse files

Merge pull request #30 from adamyonk/master

Adding INSTALL_PATH option
  • Loading branch information...
2 parents 3f23a55 + 560f2cc commit 7a9dfb887a1cffa1b90bca150381c095d18b6174 @xdissent committed Sep 29, 2011
Showing with 16 additions and 2 deletions.
  1. +8 −0 README.rst
  2. +8 −2 ievms.sh
View
@@ -58,6 +58,14 @@ and rerun the install.
If nothing else, you can delete ``~/.ievms`` and rerun the install.
+Specifying the install path
+---------------------------
+
+To specify where the VMs are installed, use the INSTALL_PATH variable:
+
+ curl -s https://raw.github.com/xdissent/ievms/master/ievms.sh | INSTALL_PATH="/Path/to/.ievms" bash
+
+
Features
========
View
@@ -11,7 +11,13 @@ log() { printf "$*\n" ; return $? ; }
fail() { log "\nERROR: $*\n" ; exit 1 ; }
create_home() {
- ievms_home="${HOME}/.ievms"
+ if [[ -z "${INSTALL_PATH}" ]]
+ then
+ ievms_home="${HOME}/.ievms"
+ else
+ ievms_home="${INSTALL_PATH}"
+ fi
+
mkdir -p "${ievms_home}"
cd "${ievms_home}"
}
@@ -150,7 +156,7 @@ build_ievm() {
log "Checking for existing ${vm} VM"
if ! VBoxManage showvminfo "${vm}"
then
-
+
case $kernel in
Darwin) ga_iso="/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso" ;;
Linux) ga_iso="/usr/share/virtualbox/VBoxGuestAdditions.iso" ;;

3 comments on commit 7a9dfb8

@gwelr
gwelr commented on 7a9dfb8 Sep 29, 2011

I don't think you can have a "test -z INSTALL_PATH" right after "set -o nounset". The latter command triggers an error when expanding unset variables.
If you don't specify an INSTALL_PATH (that is, you want to install in the default INSTALL_PATH), INSTALL_PATH is unset and the script fails miserably (line 14), complaining about unbound variables.
You could:

  1. Specify in the doc that INSTALL_PATH is mandatory.
  2. Drop completely the set -o nounset
  3. place the set after the create_home function provided that there are no other test -z later in the script...
    Current version of the script does not work as long as the INSTALL_PATH is not specified.
@adamyonk

Works fine for me if set -o nounset is removed. @xdissent, is that needed anywhere else?

@xdissent
Owner

I'd rather keep set -o nounset since it really helps keep shell scripts manageable as they grow. Debugging a script like this one in particular is difficult by its very nature, so we need as much help as we can get. I pushed a commit this morning that fixes the issue by using default parameter parsing in bash. Sorry about the temporary confusion!!!

Please sign in to comment.