archx/macx.sh

86 lines
2.7 KiB
Bash
Raw Normal View History

2023-02-16 19:04:43 +01:00
#!/bin/bash
2023-02-16 22:30:53 +01:00
2023-02-17 00:20:57 +01:00
clear
echo "macx.sh by ~zotan, bootstrapping system..."
echo
2023-06-05 03:26:27 +02:00
echo "--- Opening sudo session ---"
# From https://gist.github.com/cowboy/3118588
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
2023-06-05 04:24:45 +02:00
caffeinate -disu -w $$ &
2023-06-05 03:26:27 +02:00
echo
2023-02-17 00:20:57 +01:00
echo "--- Installing Rosetta 2 ---"
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
echo
2023-02-16 19:04:43 +01:00
echo "--- Installing homebrew ---"
2023-02-16 22:30:53 +01:00
set -e
2023-06-05 04:19:18 +02:00
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2023-02-17 22:21:18 +01:00
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
2023-02-16 19:04:43 +01:00
eval "$(/opt/homebrew/bin/brew shellenv)"
2023-02-18 00:41:00 +01:00
export HOMEBREW_CASK_OPTS="--no-quarantine"
2023-02-16 22:30:53 +01:00
set +e
2023-02-16 19:04:43 +01:00
2023-02-17 00:20:57 +01:00
echo
2023-06-03 19:02:59 +02:00
echo "--- Cloning os-bootstrap-core ---"
mkdir ~/.os-bootstrap
git clone https://git.ztn.sh/zotan/os-bootstrap-core ~/.os-bootstrap/core
2023-02-16 22:15:43 +01:00
2023-02-17 00:20:57 +01:00
echo
2023-02-16 22:15:43 +01:00
echo "--- Linking to system Brewfile ---"
2023-06-03 19:02:59 +02:00
ln -s ~/.os-bootstrap/core/macx-resources/Brewfile ~/.Brewfile
2023-02-16 19:04:43 +01:00
2023-02-17 00:20:57 +01:00
echo
2023-02-16 19:04:43 +01:00
echo "--- Running brew bundle ---"
2023-02-16 22:15:43 +01:00
brew bundle --global
2023-02-16 19:04:43 +01:00
2023-02-17 00:20:57 +01:00
echo
2023-02-16 19:04:43 +01:00
echo "--- Running postinstall steps ---"
echo "Configuring pinentry-mac"
mkdir -p ~/.gnupg
echo "pinentry-program /opt/homebrew/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
echo "Configuring dock autohide"
defaults write com.apple.dock autohide -int 1
defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 0.4
killall Dock
echo "Disabling font smoothing"
defaults -currentHost write -g AppleFontSmoothing -int 0
2023-02-16 19:57:57 +01:00
echo "Fixing dotnet symlink"
sudo ln -s /opt/homebrew/opt/dotnet/libexec /usr/local/share/dotnet
2023-02-16 19:04:43 +01:00
2023-02-17 00:20:57 +01:00
echo "Installing DNSSEC root anchor for ldns and drill"
mkdir -p /opt/homebrew/opt/ldns/etc/unbound
cp ~/Projects/macx-resources/dnssec-root.key /opt/homebrew/opt/ldns/etc/unbound/root.key
2023-02-16 22:15:43 +01:00
2023-02-18 00:59:06 +01:00
echo "Configuring global gitignore"
echo ".DS_Store" > ~/.gitignore_global
echo "._.DS_Store" >> ~/.gitignore_global
echo "**/.DS_Store" >> ~/.gitignore_global
echo "**/._.DS_Store" >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
2023-02-18 02:09:36 +01:00
echo "Configuring zshrc"
curl -L ztn.sh/macx-resources/zshrc >> ~/.zshrc
2023-02-17 22:24:54 +01:00
echo "Installing prezto"
rm ~/.zprofile
2023-03-17 02:52:54 +01:00
curl -L ztn.sh/prezto.sh | zsh
2023-02-17 22:24:54 +01:00
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
2023-02-16 19:04:43 +01:00
####
echo
2023-02-17 15:12:56 +01:00
echo "--- macx.sh bootstrap complete ---"
2023-02-16 22:15:43 +01:00
echo
2023-02-17 00:20:57 +01:00
echo "iOS applications not installed automatically: bunq"
echo "Other applications not installed automatically: Amphetamine Enhancer, Capture One, u-he hive, Arturia Software Center"
2023-02-18 13:04:01 +01:00
echo "Setapp applications not installed automatically: TablePlus, Screens, RapidAPI, WiFi Explorer, Archiver, Proxyman"
2023-02-16 22:15:43 +01:00
echo
2023-02-17 00:20:57 +01:00
echo "Please download and install them manually."
2023-02-17 15:12:56 +01:00
echo
echo "After that, please reboot to make sure everything is applied."
2023-03-17 02:52:54 +01:00
echo