-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcurl_install
executable file
·46 lines (41 loc) · 1.22 KB
/
curl_install
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
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# dotfiles directory
DOTFILES_DIRECTORY="dotfiles"
download_dotfiles() {
if [[ ! -d "${DOTFILES_DIRECTORY}" ]]; then
echo "Downloading dotfiles..."
# -p Create intermediate directories as required.
mkdir -p "${DOTFILES_DIRECTORY}"
# Get the tarball
if curl -fsSLo dotfiles.tar.gz https://github.com/MarkHershey/dotfiles/tarball/master; then
printf "Done.\n\n"
else
echo "Failed to download the dotfiles."
exit 1
fi
# Extract to the dotfiles directory
echo "Extracting the dotfiles..."
tar -zxf "dotfiles.tar.gz" --strip-components 1 -C "${DOTFILES_DIRECTORY}"
if [[ -d "${DOTFILES_DIRECTORY}" ]]; then
printf "Done.\n\n"
else
echo "Failed to extract the dotfiles."
exit 1
fi
# Remove the tarball
echo "Removing dotfiles.tar.gz..."
rm dotfiles.tar.gz
printf "Done.\n\n"
else
echo "Directory 'dotfiles' already exists in current directory."
fi
}
# download dotfiles
download_dotfiles
echo "Changing directory to ${DOTFILES_DIRECTORY}"
cd "${DOTFILES_DIRECTORY}" || { echo "Failed to change directory." >&2;exit 1; }
printf "Done.\n\n"
# start install script
printf "Current working directory: "
pwd
./install