From 6854042f03605e04aa9844ac4a5eff79130d68ed Mon Sep 17 00:00:00 2001 From: Takenori Nakagawa Date: Thu, 29 Dec 2016 00:29:42 +0900 Subject: [PATCH 1/2] support systemctl --- install.sh | 37 +++++++++++++++++++++++++++++++++---- wercker.yml | 5 ++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 248272f..0ea036e 100755 --- a/install.sh +++ b/install.sh @@ -10,11 +10,40 @@ case $ARCH in i386) ARCH="386";; esac OS=$(uname | tr '[:upper:]' '[:lower:]') -if [ $OS = "windows" ]; then +if [ "$OS" = "windows" ]; then EXT=".exe" fi VERSION=$(curl -sL https://raw.githubusercontent.com/ww24/lirc-web-api/master/wercker.yml | grep 'API_VERSION="v' | awk -F\" '{print $2}') -curl -sLo api "https://github.com/ww24/lirc-web-api/releases/download/${VERSION}/api_${OS}_${ARCH}${EXT}" -chmod +x api +curl -Lo /tmp/lirc-web-api "https://github.com/ww24/lirc-web-api/releases/download/${VERSION}/api_${OS}_${ARCH}${EXT}" +chmod +x /tmp/lirc-web-api -echo "installed at $(pwd)/api $(./api -v)" +if [ "$OS" = "linux" ] && hash systemctl; then + INSTALL_DIR=/usr/local/bin + mkdir -p $INSTALL_DIR + INSTALL_PATH="$INSTALL_DIR/lirc-web-api" + sudo mv /tmp/lirc-web-api $INSTALL_PATH + + cat < Date: Thu, 29 Dec 2016 01:32:08 +0900 Subject: [PATCH 2/2] fix --- install.sh | 6 +++++- wercker.yml | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 0ea036e..9466420 100755 --- a/install.sh +++ b/install.sh @@ -13,8 +13,12 @@ OS=$(uname | tr '[:upper:]' '[:lower:]') if [ "$OS" = "windows" ]; then EXT=".exe" fi + VERSION=$(curl -sL https://raw.githubusercontent.com/ww24/lirc-web-api/master/wercker.yml | grep 'API_VERSION="v' | awk -F\" '{print $2}') -curl -Lo /tmp/lirc-web-api "https://github.com/ww24/lirc-web-api/releases/download/${VERSION}/api_${OS}_${ARCH}${EXT}" + +DOWNLOAD_URL="https://github.com/ww24/lirc-web-api/releases/download/${VERSION}/api_${OS}_${ARCH}${EXT}" +echo "Downloading $DOWNLOAD_URL" +curl -Lo /tmp/lirc-web-api "$DOWNLOAD_URL" chmod +x /tmp/lirc-web-api if [ "$OS" = "linux" ] && hash systemctl; then diff --git a/wercker.yml b/wercker.yml index 47e65af..0eab971 100644 --- a/wercker.yml +++ b/wercker.yml @@ -2,9 +2,6 @@ box: golang build: steps: - - shellcheck: - files: install.sh - - script: name: set API_VERSION code: export API_VERSION="v0.2.6" @@ -79,6 +76,9 @@ build: code: | cp "$WERCKER_SOURCE_DIR/README.md" "$WERCKER_OUTPUT_DIR" + - shellcheck: + files: install.sh + deploy: steps: - install-packages: