Skip to content

Commit

Permalink
Improved install.sh.
Browse files Browse the repository at this point in the history
Allows the install script to be curled directly from GitHub for easy install:

	curl http://URL/TO/install.sh | sh
  • Loading branch information
JoeNyland committed Jul 22, 2014
1 parent 93e73a1 commit 6e649db
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/sh
# Installs ssh-copy-id into /usr/local/bin

cp ssh-copy-id.sh /usr/local/bin/ssh-copy-id;
chmod +x /usr/local/bin/ssh-copy-id;
if [[ $(id -u) != 0 ]]; then
if command -v sudo >/dev/null 2>&1; then
SUDO="sudo"
else
echo >&2 "Requires sudo but it's not installed. Aborting."
exit 1
fi
fi

if git ls-files >& /dev/null && [[ -f ssh-copy-id.sh ]]; then
$SUDO cp ssh-copy-id.sh /usr/local/bin/ssh-copy-id || { echo "Failed to install ssh-copy-id into /usr/local/bin."; exit 1; }
else
$SUDO curl -L https://raw.github.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh -o /usr/local/bin/ssh-copy-id || { echo "Failed to install ssh-copy-id into /usr/local/bin."; exit 1; }
$SUDO chmod +x /usr/local/bin/ssh-copy-id || { echo "Failed to install ssh-copy-id into /usr/local/bin."; exit 1; }
fi
echo "Installed ssh-copy-id into /usr/local/bin."; exit 0;

0 comments on commit 6e649db

Please sign in to comment.