-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·71 lines (58 loc) · 1.67 KB
/
install.sh
File metadata and controls
executable file
·71 lines (58 loc) · 1.67 KB
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
#!/bin/sh
# submodules
git submodule init
git submodule update
# make symbolic links
link_file() {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
if [ -e $target ] ; then
if [ ! -d $target ] ; then
echo "Update\t$target"
mv $target $target.bak
ln -sf ${source} ${target}
fi
else
echo "Install\t$target"
ln -sf ${source} ${target}
fi
}
for i in _*
do
link_file $i
done
link_file bin
# package install
if [ ! -d $HOME/.vim/autoload/plug.vim ]
then
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
if [[ ! -d ~/.zplug ]];then
git clone https://github.com/b4b4r07/zplug ~/.zplug
fi
# Homebrew setup (macOS only)
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Setting up Homebrew for macOS..."
# Check and install Homebrew if not present
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for this session
if [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" # Apple Silicon
elif [[ -f /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)" # Intel Mac
fi
else
echo "Homebrew already installed"
fi
# Install from Brewfile if it exists
if [ -f "Brewfile" ]; then
echo "Installing packages from Brewfile..."
brew bundle install
else
echo "No Brewfile found, skipping package installation"
fi
else
echo "Not on macOS, skipping Homebrew setup"
fi