-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·39 lines (32 loc) · 1.06 KB
/
install.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.06 KB
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
37
38
#!/bin/bash
TMP_DIR=/tmp
# Check Xcode.app and command line tools existence
if [ $(uname) == "Darwin" ]; then
if [ ! -e "$(xcode-select -p)" ]; then
echo "*** [Error] There is no Xcode.app, please install it first ***"
exit 1
fi
if [ ! -e "$(xcrun --show-sdk-path)/usr/include/zlib.h" ]; then
echo "*** [Error] There is no Xcode command line tools, please install it by `$ xcode-select --install` ***"
exit 1
fi
fi
echo "*** Installation start ***"
# Move to temporary dir
pushd ${TMP_DIR} > /dev/null
# Download dotfiles from master
BRANCH=${1:-master}
curl -LSfs -O https://github.com/supistar/dotfiles/archive/${BRANCH}.zip
# Unzip
ARCHIVE="$(echo ${BRANCH} | awk -F/ '{print $NF}').zip"
unzip ${ARCHIVE}
DIRECTORY="dotfiles-$(echo ${BRANCH} | sed -e 's/\//-/g')"
cd ${DIRECTORY}
# Do install
sh ./scripts/init.sh $2
# Post-process
if [ -n "${TMP_DIR}" -a -n "${DIRECTORY}" -a -n "${TMP_DIR}/${ARCHIVE}" ]; then
rm -rf "${TMP_DIR}/${DIRECTORY}" "${TMP_DIR}/${ARCHIVE}"
fi
popd > /dev/null
echo "*** Installation completed! ***"