Skip to content

Commit

Permalink
chore: add install script
Browse files Browse the repository at this point in the history
  • Loading branch information
oneofthezombies committed Feb 12, 2024
1 parent 916f009 commit 712d296
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions installs/linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
find_bin_path() {
for dir in /usr/local/bin /usr/bin /bin; do
if echo "$PATH" | grep -qE "(^|:)$dir(:|$)"; then
echo $dir
return
fi
done
}

set -e

echo "Installing kill-tree..."

bin_path=$(find_bin_path)
if [ -z "$bin_path" ]; then
echo "No bin path found in PATH"
exit 1
fi

temp_dir=$(mktemp -d)
cd $temp_dir

curl -L -s https://api.github.com/repos/oneofthezombies/kill-tree/releases/latest | \
grep "kill-tree-linux-x86_64" | \
grep "browser_download_url" | \
cut -d '"' -f 4 | \
xargs curl -L -s -o kill-tree && \
chmod +x kill-tree && \
mv kill-tree $bin_path/kill-tree && \
rm -rf $temp_dir

echo "kill-tree install location: $bin_path/kill-tree"

echo "try printing version..."
kill-tree --version

echo "kill-tree installed successfully."
exit 0


0 comments on commit 712d296

Please sign in to comment.