-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
4 changed files
with
125 additions
and
118 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
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
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,67 @@ | ||
#!/bin/bash | ||
|
||
### variables ### | ||
|
||
folder="${HOME}/bin2" | ||
|
||
|
||
### functions ### | ||
|
||
function del { | ||
if [ -f "$1" ]; then rm -f "$1"; fi | ||
} | ||
|
||
function setArchAndPlatform { | ||
PLATFORM="$(uname -s | tr '[:upper:]' '[:lower:]')" | ||
ARCH=$(uname -m) | ||
case $ARCH in | ||
armv5*) ARCH_ALT="armv5";; | ||
armv6*) ARCH_ALT="armv6";; | ||
armv7*) ARCH_ALT="arm";; | ||
aarch64) ARCH_ALT="arm64";; | ||
x86) ARCH_ALT="386";; | ||
x86_64) ARCH_ALT="amd64";; | ||
i686) ARCH_ALT="386";; | ||
i386) ARCH_ALT="386";; | ||
esac | ||
} | ||
|
||
function downloadAndInstall { | ||
url="$1" | ||
name="$2" | ||
if [ ! -z $url ]; then | ||
del $name | ||
if [ ! -z $(echo $url | grep 'tar.gz') ]; then | ||
# it's tar.gzipped | ||
curl -L $url | tar xz | ||
elif [ ! -z $(echo $url | grep 'zip') ]; then | ||
# it's zipped | ||
curl -o "$name.zip" -L $url | ||
unzip "$name.zip" | ||
rm -f "$name.zip" | ||
else | ||
# not compressed | ||
curl -o ./$name -L $url | ||
fi | ||
chmod +x $name | ||
else | ||
echo "Unsupported OS. Skipping $name installation..." | ||
fi | ||
} | ||
|
||
function welcome { | ||
echo " | ||
Running as : $(whoami) | ||
Home folder: $HOME | ||
Install dir: $folder | ||
Platform : $PLATFORM | ||
Arch : $ARCH (aka ${ARCH_ALT}) | ||
" | ||
} | ||
|
||
function createDir { | ||
folder="$1" | ||
# creating target dir if it doesn't exist | ||
# it should've been created in prev script | ||
if [ -d $folder ]; then mkdir -p $folder; fi | ||
} |
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