瀏覽代碼

Allow docker scripts to be run from other directories

Ian Goldberg 6 月之前
父節點
當前提交
b79daf99e9
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 5 0
      build-docker
  2. 5 0
      set-networking

+ 5 - 0
build-docker

@@ -1,3 +1,8 @@
 #!/bin/bash
 
+# cd into the directory containing this script (from the bash faq 028)
+if [[ $BASH_SOURCE = */* ]]; then
+  cd -- "${BASH_SOURCE%/*}/" || exit
+fi
+
 docker build $* -t floram -f Dockerfile .

+ 5 - 0
set-networking

@@ -1,5 +1,10 @@
 #!/bin/bash
 
+# cd into the directory containing this script (from the bash faq 028)
+if [[ $BASH_SOURCE = */* ]]; then
+  cd -- "${BASH_SOURCE%/*}/" || exit
+fi
+
 latency=30ms
 bw=100mbit