From 3d20f0c59170354154291ffdc76156bd2f9f7e97 Mon Sep 17 00:00:00 2001 From: Vinrobot Date: Sat, 6 Jul 2019 01:08:37 +0200 Subject: [PATCH] Make scripts work with sh --- .keys/generate-keys.sh | 3 ++- build.sh | 5 +++-- src/licenseGen/build.sh | 5 +++-- src/licenseGen/run.sh | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.keys/generate-keys.sh b/.keys/generate-keys.sh index 7a9cf36..d460c13 100755 --- a/.keys/generate-keys.sh +++ b/.keys/generate-keys.sh @@ -3,7 +3,8 @@ # Check for openssl command -v openssl >/dev/null 2>&1 || { echo >&2 "openssl required but not found. Aborting."; exit 1; } -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DIR=`dirname "$0"` +DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd` # Remove any existing key files [ ! -e "$DIR/cert.pem" ] || rm "$DIR/cert.pem" diff --git a/build.sh b/build.sh index 629e605..fdfda45 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,7 @@ -#!/bin/bash +#!/bin/sh -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DIR=`dirname "$0"` +DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd` # If there aren't any keys, generate them first. [ -e "$DIR/.keys/cert.cert" ] || "$DIR/.keys/generate-keys.sh" diff --git a/src/licenseGen/build.sh b/src/licenseGen/build.sh index 0837edb..31d08ac 100755 --- a/src/licenseGen/build.sh +++ b/src/licenseGen/build.sh @@ -1,5 +1,6 @@ -#!/bin/bash +#!/bin/sh -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DIR=`dirname "$0"` +DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd` docker build -t bitbetter/licensegen "$DIR" # --squash diff --git a/src/licenseGen/run.sh b/src/licenseGen/run.sh index 144e4e1..ebfdd58 100755 --- a/src/licenseGen/run.sh +++ b/src/licenseGen/run.sh @@ -1,6 +1,7 @@ -#!/bin/bash +#!/bin/sh -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd)" +DIR=`dirname "$0"` +DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd` # Grab the absolute path to the default pfx location cert_path="$DIR/.keys/cert.pfx"