-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote-install.sh
executable file
·37 lines (30 loc) · 988 Bytes
/
remote-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env sh
######################################################################
# @author : hg (https://github.com/hghann)
# @file : remote-install.sh
# @created : Tue 28 Dec 23:08:25 2021
#
# @description : remote install script for my dotfiles
######################################################################
SOURCE="https://github.com/hghann/osxrice"
TARBALL="$SOURCE/tarball/master"
TARGET="$HOME/.dotfiles"
TAR_CMD="tar -xzv -C "$TARGET" --strip-components=1 --exclude='{.gitignore}'"
is_executable() {
type "$1" > /dev/null 2>&1
}
if is_executable "git"; then
CMD="git clone $SOURCE $TARGET"
elif is_executable "curl"; then
CMD="curl -#L $TARBALL | $TAR_CMD"
elif is_executable "wget"; then
CMD="wget --no-check-certificate -O - $TARBALL | $TAR_CMD"
fi
if [ -z "$CMD" ]; then
echo "No git, curl or wget available. Aborting."
else
echo "Installing dotfiles..."
mkdir -p "$TARGET"
eval "$CMD"
fi
# vim: set tw=78 ts=2 et sw=2 sr: