-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup
executable file
·113 lines (84 loc) · 4.64 KB
/
setup
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/zsh
# MIT license
#
# Copyright (c) 2020 Manish Sahani
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
: "
Author: Manish Sahani <[email protected]>
URL: https://development.kalkayan.io (original project)
Description: This script is a part of kalkayan's development distribution. The
purpose of this script is to automate the setup related tasks. To
get started with this distribution, Please use the the following
resources:
[1] Original project - https://zsh.kalkayan.io
[2] kalkayan's dotfiles - https://github.com/kalkayan/dotfiles
[3] ...
For extensive availability of documentation and tricks, Please,
append your url to the list.
"
[ -f $HOME/.config/sh/core ] && source $HOME/.config/sh/core \
|| source /dev/stdin <<< "$(curl https://raw.githubusercontent.com/kalkayan/dotfiles/main/.config/sh/core)"
# Load the variables in the current from the local vars.sh file if present under
# config otherwise read from the fallback file at github.
import https://sh.kalkayan.io/config/zsh/vars.sh
# Load utility functions from the utils.sh file (where all the heavy lifting
# installation code is written) otherwise read them from the fallback file.
import https://sh.kalkayan.io/config/zsh/utils.sh
# Print the script banner
print $PRIMARY '
_
| |
_ __ ___ __ _ ___ ___ ___ ___ ___| |_ _ _ _ __
| |_ ` _ \ / _` |/ __/ _ \/ __| / __|/ _ \ __| | | | |_ \
| | | | | | (_| | (_| (_) \__ \ \__ \ __/ |_| |_| | |_) |
|_| |_| |_|\__,_|\___\___/|___/ |___/\___|\__|\__,_| .__/
| |
|_|
'
# Check if help option is present in the provided arguments, if so print the
# usage and available option and exit otherwise proceed with the script
[[ "$@" =~ "$OPT_HELP" ]] && print_help || print_banner && ask_password
# Install Xcode command line tool using xcode-select if already not installed.
# Xcode cli tool brings all the necessary language packs and other build tool.
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_INSTALL_BUILDTOOLS" ]] && \
install_xcode
# Install brew.sh (system package manager for your machine) if already not
# installed. This will be used to install other binaries and applications.
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_INSTALL_BREW" ]] && \
install_brew
# MacOS does not come with the latest version of zsh, update the zsh to its
# latest version and set the current shell to zsh
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_UPDATE_SHELL" ]] && \
update_shell
# Bring in the dotfiles if not present or sync them with the remote repository.
# This repository is the collection of configurations for better productivity.
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_WITH_DOTFILES" ]] && \
setup_dotfiles
# Install binaries using brew from the bins.txt
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_INSTALL_BINS" ]] && \
install_bins $VAR_BREW_BINS
# Install applications/casks using brew from the casks.txt
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_INSTALL_CASKS" ]] && \
install_casks $VAR_BREW_CASKS
# Post-Installation deals with the setup of specific binaries after
# installation.
[[ "$@" =~ "$OPT_SETUP_NEW" ]] || [[ "$@" =~ "$OPT_INSTALL_BINS" ]] && \
. $HOME/.config/zsh/post_installation.sh
print $PRIMARY 'Run the following command to get the changes: [ -f $HOME/.zshrc ] && source $HOME/.zshrc'