-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-new-computer
executable file
·67 lines (51 loc) · 2.07 KB
/
setup-new-computer
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
#!/bin/bash
# Get the default downloads folder from the XDG_DOWNLOAD_DIR environment variable
download_folder=$(defaults read com.apple.userdomain User\ TemplatePath 2>/dev/null || echo "$HOME/Downloads")
#Go to home directory
cd
#Make a temporary folder
temp_folder_name="temp_dotfiles_dir"
if [ -d "$temp_folder_name" ]; then
echo "$(tput setaf 1)$temp_folder_name already exists type in another name for the temporay directory:$(tput sgr0) "
read temp_folder_name
fi
mkdir "$temp_folder_name"
#Moving into the temporary folder
cd $temp_folder_name
#Downloading the files
git clone https://github.com/PremPoddar/dotfiles.git
#Copying the dotfiles data to the user's dotfiles
cd
cp $temp_folder_name/dotfiles/.zshrc .zshrc
cp $temp_folder_name/dotfiles/.bashrc .bashrc
echo "$(tput setaf 2)The .zshrc and .bashrc files have been updated.$(tput sgr0)"
#Copying ublock-origin-backup to Downloads
cp $temp_folder_name/dotfiles/my-ublock-backup.txt $download_folder/my-ublock-backup.txt
echo "$(tput setaf 2)The my-ublock-backup.txt file has been moved to the Downloads folder.$(tput sgr0)"
#Moving the user-override.js to the user.js folder for arkenfox
cd $download_folder
git clone https://github.com/arkenfox/user.js.git
cp $HOME/$temp_folder_name/dotfiles/user-overrides.js user.js/user-overrides.js
#Checking if brew is installed
if ! which brew > /dev/null; then
echo "$(tput setaf 4)Homebrew is not installed. Installing...$(tput sgr0)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
#Installing Hombrew packages
cd
brew update
brew upgrade
brew cleanup
cd $temp_folder_name/dotfiles/
while read -r package; do
brew install "$package"
done < brew_installed.txt
echo "$(tput setaf 2)All the packages are installed.$(tput sgr0)"
brew cleanup
echo "$(tput setaf 2)Done with brew.$(tput sgr0)"
#Diming the app icon in dock when hidden
defaults write com.apple.Dock showhidden -boolean yes; killall Dock
#Deleting the temporary directory
cd
echo "$(tput setaf 4)Deleting the temporary directory.$(tput sgr0)"
sudo rm -r $temp_folder_name