Skip to content

Commit

Permalink
macos-arm version
Browse files Browse the repository at this point in the history
  • Loading branch information
fakeyanss committed Sep 6, 2022
1 parent 2d831b6 commit 7977ea9
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 33 deletions.
2 changes: 1 addition & 1 deletion bin/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function install_brew() {
log_running "go..."
export HOMEBREW_BREW_GIT_REMOTE="https://ghproxy.com/https://github.com/Homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://ghproxy.com/https://github.com/Homebrew/homebrew-core.git"
/bin/bash -c "$(curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
/bin/bash -c "$(curl -fsSL https://ghproxy.com/https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
log_running "brew existed, skip"
fi
Expand Down
26 changes: 14 additions & 12 deletions bin/extra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,47 @@ function setup_extra() {
# nerd fonts
# install_nerd_font
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-fonts/Casks/font-fira-code-nerd-font.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask-fonts/Casks/font-fira-code-nerd-font.rb
brew_no_update_install_cask font-fira-code-nerd-font
# gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
# /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-fonts/Casks/font-hack-nerd-font.rb
# /opt/Homebrew/Library/Taps/homebrew/homebrew-cask-fonts/Casks/font-hack-nerd-font.rb
# brew_no_update_install_cask font-hack-nerd-font
# quick look plugin
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlcolorcode.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlcolorcode.rb
brew_no_update_install_cask qlcolorcode
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlimagesize.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlimagesize.rb
brew_no_update_install_cask qlimagesize
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlmarkdown.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlmarkdown.rb
brew_no_update_install_cask qlmarkdown
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlstephen.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlstephen.rb
brew_no_update_install_cask qlstephen
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlvideo.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlvideo.rb
brew_no_update_install_cask qlvideo
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/quicklook-json.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/quicklook-json.rb
brew_no_update_install_cask quicklook-json
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/quicklookase.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/quicklookase.rb
brew_no_update_install_cask quicklookase
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlmobi.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/qlmobi.rb
brew_no_update_install_cask qlmobi

# menubar items hider
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/dozer.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/dozer.rb
brew_no_update_install_cask dozer
open -a dozer
# outliner notebook
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/logseq.rb
/opt/Homebrew/Library/Taps/homebrew/homebrew-cask/Casks/logseq.rb
brew_no_update_install_cask logseq
brew_no_update_install_cask obsidian

# karabiner, 比 hammerspoon 的 keystroke 更好用
brew_no_update_install_cask karabiner-elements
Expand All @@ -58,6 +59,7 @@ function setup_extra() {
open -a karabiner

brew_no_update_install_cask docker
brew_no_update_install_cask raycast
brew_no_update_install_cask logitech-options
brew_no_update_install_cask wechat
brew_no_update_install_cask wireshark
Expand Down
6 changes: 3 additions & 3 deletions bin/java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ function tap_jdk() {

function install_jdk() {
log_action "install jdk ${JAVA_VERSIONS[*]}"
mkdir -p /usr/local/lib/java
sudo mkdir -p /usr/local/lib/java
for v in ${JAVA_VERSIONS[@]}; do
log_running "install $v"
gsed -i "s/url \"https:\/\/github.com/url \"https:\/\/ghproxy.com\/https:\/\/github.com/g" \
/usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk/Casks/adoptopenjdk${v}.rb
/opt/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk/Casks/adoptopenjdk${v}.rb
brew_no_update_install_cask adoptopenjdk/openjdk/adoptopenjdk${v}
mkdir -p /usr/local/lib/java
ln -s /Library/Java/JavaVirtualMachines/adoptopenjdk-${v}.jdk/Contents/Home /usr/local/lib/java/java-${v}-openjdk
sudo ln -s /Library/Java/JavaVirtualMachines/adoptopenjdk-${v}.jdk/Contents/Home /usr/local/lib/java/java-${v}-openjdk
done
log_ok
}
Expand Down
10 changes: 5 additions & 5 deletions bin/mac_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ function setup_mac() {
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
# defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true

# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
Expand Down Expand Up @@ -344,7 +344,7 @@ function setup_mac() {
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

# Show the ~/Library folder
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
# chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library

# Show the /Volumes folder
sudo chflags nohidden /Volumes
Expand Down Expand Up @@ -587,7 +587,7 @@ function setup_mac() {
# Disable Spotlight indexing for any volume that gets mounted and has not yet
# been indexed before.
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# Change indexing order and disable some search results
# Yosemite-specific search results (remove them if you are using macOS 10.9 or older):
# MENU_DEFINITION
Expand Down
5 changes: 3 additions & 2 deletions bin/node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function setup_node() {
install_nvm
symbol_link_npm
set_nvm
install_node
log_finish "$task"
}

Expand Down Expand Up @@ -33,8 +34,8 @@ function set_nvm() {
# node, npm
export NODE_MIRROR=https://npm.taobao.org/dist/
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
EOF
fi
Expand Down
3 changes: 2 additions & 1 deletion bin/nvim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function install_nvim() {
# log_action "install nvim using brew"
# brew_no_update_install nvim
log_action "install neovim nightly"
tar -xzvf $DOTFILES/software/nvim/extra/nvim-macos.tar.gz -C $DOTFILES/software/nvim/bin
mkdir -p $DOTFILES/software/nvim/bin
tar -xzvf $DOTFILES/software/nvim/extra/nvim-macos-0.7.0.tar.gz -C $DOTFILES/software/nvim/bin
log_ok
}

Expand Down
1 change: 1 addition & 0 deletions bin/picgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function setup_picgo() {
# gsed -e "s/\$PICGO_GITHUB_REPO/${PICGO_GITHUB_REPO}/g" $HOME/.picgo/config.json
# gsed -e "s/\$PICGO_GITHUB_PATH/${PICGO_GITHUB_PATH}/g" $HOME/.picgo/config.json
# fuck sed on mac
mkdir -p $HOME/.picgo
config=$(cat $DOTFILES/software/picgo/config.json)
config=${config//\$PICGO_GITHUB_TOKEN/${PICGO_GITHUB_TOKEN}}
config=${config//\$PICGO_GITHUB_REPO/${PICGO_GITHUB_REPO}}
Expand Down
2 changes: 1 addition & 1 deletion bin/rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
function setup_rust() {
task="setup rust"
log_task "$task"
install_rust
install_cargo
log_finish "$task"
}

Expand Down
2 changes: 1 addition & 1 deletion bin/ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function setup_ssh() {
task="setup ssh"
log_task "$task"
mkdir -p $HOME/.ssh
install_autossh
# install_autossh
log_finish "$task"
}

Expand Down
2 changes: 0 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ function main() {

setup_sudo

# git pull origin master

# base, keep order
if [[ $1 == '-no-brew' ]]; then
log "skip homebrew"
Expand Down
2 changes: 1 addition & 1 deletion conf/env.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ [email protected]
GIT_USING_PROXY=true
GIT_PROXY=http://ghproxy.com

JAVA_VERSIONS=(8 11)
JAVA_VERSIONS=(8 11 17)
JAVA_DEFAULT_VERSION=8
PYTHON_VERSIONS=(3.10.1 2.7.18)
PYTHON_DEFAULT_VERSION=3.10.1
Expand Down
39 changes: 39 additions & 0 deletions os.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

Green="\033[32m"
Font="\033[0m"

function checkout_branch() {
branch=$1
git branch|grep $branch >/dev/null 2>&1
if [[ $? == 0 ]]; then
git checkout $branch
git pull origin $branch
else
git checkout -b $branch origin/$branch
fi
}

function menu() {
echo -e "${Green}0.${Font} master, \t回到 master"
echo -e "${Green}1.${Font} macos-arm, \tmac m1 芯片"
echo -e "${Green}2.${Font} macos-x86, \tmac intel 芯片"
read -rp "请输入数字执行:" menu_num
case $menu_num in
0)
cd $DOTFILES && checkout_branch master
;;
1)
cd $DOTFILES && checkout_branch macos-arm
;;
2)
cd $DOTFILES && checkout_branch macos-x86
;;
*)
ret=1
;;
esac
exit ${ret}
}

menu
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ Before you actually execute the script, please make sure what is dotfiles and wh
```bash
git clone https://ghproxy.com/https://github.com/fakeYanss/dotfiles.git --depth=1 ~/.dotfiles
cd ~/.dotfiles;
# run this using terminal (not iTerm, lest iTerm settings get discarded on exit)
bash os.sh # and choose you system os

# and then, run this using terminal (not iTerm, let iTerm settings get discarded on exit)
bash bootstrap.sh
```

Expand Down
2 changes: 1 addition & 1 deletion software/picgo/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"current": "githubPlus",
"githubPlus": {
"branch": "master",
"customUrl": "https://cdn.jsdelivr.net/gh/$PICGO_GITHUB_REPO@master",
"customUrl": "https://ghproxy.com/https://raw.githubusercontent.com/fakeYanss/imgplace/master/",
"origin": "github",
"repo": "$PICGO_GITHUB_REPO",
"path": "$PICGO_GITHUB_PATH",
Expand Down
4 changes: 2 additions & 2 deletions software/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ eval "$(pyenv init --path)"
# node, npm
export NODE_MIRROR=https://npm.taobao.org/dist/
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

# go
# eval "$(goenv init -)"
Expand Down

0 comments on commit 7977ea9

Please sign in to comment.