-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·123 lines (96 loc) · 2.67 KB
/
init.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
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
114
115
116
117
118
119
120
121
122
123
#! /bin/bash
# get current username of the mac
username=$(id -un)
echo -n 'Please provide a name [GitHub name prefered]: 👽'
read name
echo -n 'Do you want to generate key for GitHub [y/n]: '
read gflag
if [ "y" == "$gflag" ] || [ "Y" = "$gflag" ]; then
echo -n 'Please provide your mail ID [GitHub mail prefered]: 📩'
read mail
echo "
[user]
name = "$name"
email = "$mail"
" >> ~/dotfiles/.gitconfig
# github ssh setup
ssh-keygen -t ed25519 -C "$mail"
# accept default location
# provide a passphrase
if test ! -f "~/.ssh/config"; then
touch ~/.ssh/config
fi
cat << EOF > ~/.ssh/config
Host *.github.com
AddKeysToAgent yes
IgnoreUnknown UseKeychain
IdentityFile ~/.ssh/id_ed25519
EOF
# adding SSH private key to the ssh-agent
ssh-add ~/.ssh/id_ed25519
# Add the SSH key to your account on GitHub. For more information, see "Adding a new SSH key to your GitHub account."
# adding your SSH key to the ssh-agent
eval "$(ssh-agent -s)"
fi
# system linking dotfiles in the base directory
ln -s ~/dotfiles/.gitconfig ~/.gitconfig
ln -s ~/dotfiles/.hushlogin ~/.hushlogin
ln -s ~/dotfiles/.aliases ~/.aliases
ln -s ~/dotfiles/.zshrc ~/.zshrc
ln -s ~/dotfiles/.zprofile ~/.zprofile
# check for Homebrew to be present, install if it's missing
if test ! $(which brew); then
echo "installing homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# added below cmd to the dotfiles .zprofile
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/"$username"/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo "🚫 disabling homebrew analytics..."
brew analytics off
# update homebrew recipes
echo "updating brew..."
brew update
# packages to be installed
PACKAGES=(
git
node
# python@3.12
openjdk
rust
gradle
maven
deno
sqlite
redis
)
for package in "${PACKAGES[@]}"
do
echo "🔸 installing ${package}..."
brew install ${package}
done
# casks to be installed
CASKS=(
# intellij-idea-ce
visual-studio-code
# steam
firefox
github
)
for cask in "${CASKS[@]}"
do
echo "🔹 installing ${cask}..."
brew install --cask ${cask}
done
# Add Visual Studio Code (code)
echo '\nexport PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"' >> ~/.zshrc
# for openjdk
echo '\nexport PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"
echo "cleaning up homebrew..."
brew cleanup
# Show filename extensions by default
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo "🕘 installing xcode, might take some time..."
xcode-select --install
echo "✅ "$name"'s mac setup completed!"