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
116 additions
and
4 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
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,81 @@ | ||
#!/bin/sh | ||
# | ||
# Installation script for Unix platforms. To run installation, type : | ||
# | ||
# $ sh -c "$(curl http://sweetohm.net/dist/${NAME}/install)" | ||
# | ||
# or (if you don't have curl installed): | ||
# | ||
# $ sh -c "$(wget -O - http://sweetohm.net/dist/${NAME}/install)" | ||
|
||
set -e | ||
|
||
NAME="dotrun" | ||
|
||
# get OS and ARCH and build binary name | ||
os=`uname | tr '[:upper:]' '[:lower:]'` | ||
arch=`uname -m` | ||
|
||
if [ "$arch" = "i386" ]; then | ||
arch="386" | ||
elif [ "$arch" = "x86_64" ]; then | ||
arch="amd64" | ||
elif [ "$arch" = "arm" ]; then | ||
arch="arm" | ||
fi | ||
|
||
echo "os: ${os}" | ||
echo "arch: ${arch}" | ||
|
||
binary="${NAME}-${os}-${arch}" | ||
|
||
# set default installation directory | ||
if [ -d "/opt/local/bin" ] | ||
then | ||
DEFAULT_DIR="/opt/local/bin" | ||
elif [ -d "/opt/bin" ] | ||
then | ||
DEFAULT_DIR="/opt/bin" | ||
elif [ -d "/usr/local/bin" ] | ||
then | ||
DEFAULT_DIR="/usr/local/bin" | ||
elif [ -d "/usr/bin" ] | ||
then | ||
DEFAULT_DIR="/usr/bin" | ||
else | ||
DEFAULT_DIR="/bin" | ||
fi | ||
|
||
# select command to download binary | ||
if hash curl 2>/dev/null | ||
then | ||
command="curl -o" | ||
elif hash wget 2>/dev/null | ||
then | ||
command="wget -O" | ||
else | ||
echo "You must install curl or wget to run this installation script" | ||
exit 1 | ||
fi | ||
|
||
# download binary in /tmp/${NAME} and make it executable | ||
${command} /tmp/${NAME} http://sweetohm.net/dist/${NAME}/${binary} | ||
chmod +x /tmp/${NAME} | ||
|
||
# prompt for installation directory | ||
read -p "Installation directory [${DEFAULT_DIR}]? " directory | ||
if [ -z "$directory" ] | ||
then | ||
directory=${DEFAULT_DIR} | ||
fi | ||
|
||
# copy binary to installation directory | ||
if [ -w "${directory}" ] | ||
then | ||
mv /tmp/${NAME} ${directory} | ||
else | ||
sudo mv /tmp/${NAME} ${directory} | ||
sudo chown root: ${directory}/${NAME} | ||
fi | ||
|
||
echo "${NAME} installed in '${directory}' directory" |