-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d81e3f6
commit e537f34
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-macos-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 | ||
|
||
|