-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·58 lines (49 loc) · 1.43 KB
/
setup.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
#!/usr/bin/env bash
# Change shell to bash if it's not already
if [[ "$SHELL" != *"/bin/bash" ]]; then
echo "Changing shell to bash"
chsh -s /bin/bash
fi
# Source the path.sh file to make sure the PATH is set correctly
source .path
# If it's a macOS
if [ "$(uname)" == "Darwin" ]; then
echo "macOS detected"
# If Homebrew is not installed
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "Installing Homebrew bundle"
./brew.sh
elif [ "$(uname)" == "Linux" ]; then
echo "Linux detected"
# If apt is available
if command -v apt &> /dev/null; then
echo "Installing apt packages"
./apt.sh
fi
else
echo "Unsupported OS"
exit 1
fi
# Initialize and update submodules
git submodule update --init --recursive
echo "Creating symlinks for the dotfiles"
./symlink.sh
# Synchronize the .config folder and .gitconfig
rsync -avh --progress --no-perms .config/ ~/.config/
rsync -avh --progress --no-perms .gitconfig ~/
# If it's a macOS
if [ "$(uname)" == "Darwin" ]; then
# Ask user if they want to install .macos
echo "Do you want to install macOS settings? (y/N)"
read -r response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo "Installing .macos"
./.macos
fi
fi
# Source the .bash_profile to apply the changes
source .bash_profile
echo "Please restart the shell to make sure all changes are applied"