settler.sh, fixes, updates

This commit is contained in:
2022-12-10 22:23:57 +02:00
parent 0db64845bc
commit 6190be3bdd
5 changed files with 83 additions and 19 deletions

View File

@@ -229,6 +229,7 @@ cask "vlc"
# Rust-based terminal
cask "warp"
mas "1Password for Safari", id: 1569813296
mas "Flow", id: 1423210932
mas "GarageBand", id: 682658836
mas "iMovie", id: 408981434
mas "Keynote", id: 409183694

View File

@@ -66,21 +66,23 @@ handle_file_ln()
$MKDIR -p "$($DIRNAME "$2")"
$LN -sf "$1" "$2"
}
handle_file_ln "/Users/ivuorinen/.dotfiles/bash_profile" "/Users/ivuorinen/.bash_profile"
handle_file_ln "/Users/ivuorinen/.dotfiles/bashrc" "/Users/ivuorinen/.bashrc"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/alias" "/Users/ivuorinen/.config/alias"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/antigen.zsh" "/Users/ivuorinen/.config/antigen.zsh"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/gh/config.yml" "/Users/ivuorinen/.config/gh/config.yml"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/git/config" "/Users/ivuorinen/.config/git/config"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/git/gitignore" "/Users/ivuorinen/.config/git/gitignore"
handle_file_ln "/Users/ivuorinen/.dotfiles/config/wtf/config.yml" "/Users/ivuorinen/.config/wtf/config.yml"
handle_file_ln "/Users/ivuorinen/.dotfiles/git_profiles" "/Users/ivuorinen/.git_profiles"
handle_file_ln "/Users/ivuorinen/.dotfiles/huskyrc" "/Users/ivuorinen/.huskyrc"
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/dotfiles" "/Users/ivuorinen/.local/bin/dotfiles"
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/x-check-git-attributes" "/Users/ivuorinen/.local/bin/x-check-git-attributes"
handle_file_ln "/Users/ivuorinen/.dotfiles/local/bin/x-open-ports" "/Users/ivuorinen/.local/bin/x-open-ports"
handle_file_ln "/Users/ivuorinen/.dotfiles/rcrc" "/Users/ivuorinen/.rcrc"
handle_file_ln "/Users/ivuorinen/.dotfiles/ssh/allowed_signers" "/Users/ivuorinen/.ssh/allowed_signers"
handle_file_ln "/Users/ivuorinen/.dotfiles/ssh/config" "/Users/ivuorinen/.ssh/config"
handle_file_ln "/Users/ivuorinen/.dotfiles/vuerc" "/Users/ivuorinen/.vuerc"
handle_file_ln "/Users/ivuorinen/.dotfiles/zshrc" "/Users/ivuorinen/.zshrc"
handle_file_ln "~/.dotfiles/bash_profile" "~/.bash_profile"
handle_file_ln "~/.dotfiles/bashrc" "~/.bashrc"
handle_file_ln "~/.dotfiles/config/alias" "~/.config/alias"
handle_file_ln "~/.dotfiles/config/antigen.zsh" "~/.config/antigen.zsh"
handle_file_ln "~/.dotfiles/config/exports" "~/.config/exports"
handle_file_ln "~/.dotfiles/config/functions" "~/.config/functions"
handle_file_ln "~/.dotfiles/config/gh/config.yml" "~/.config/gh/config.yml"
handle_file_ln "~/.dotfiles/config/git/config" "~/.config/git/config"
handle_file_ln "~/.dotfiles/config/git/gitignore" "~/.config/git/gitignore"
handle_file_ln "~/.dotfiles/config/wtf/config.yml" "~/.config/wtf/config.yml"
handle_file_ln "~/.dotfiles/git_profiles" "~/.git_profiles"
handle_file_ln "~/.dotfiles/huskyrc" "~/.huskyrc"
handle_file_ln "~/.dotfiles/local/bin/dotfiles" "~/.local/bin/dotfiles"
handle_file_ln "~/.dotfiles/local/bin/x-check-git-attributes" "~/.local/bin/x-check-git-attributes"
handle_file_ln "~/.dotfiles/local/bin/x-open-ports" "~/.local/bin/x-open-ports"
handle_file_ln "~/.dotfiles/rcrc" "~/.rcrc"
handle_file_ln "~/.dotfiles/ssh/allowed_signers" "~/.ssh/allowed_signers"
handle_file_ln "~/.dotfiles/ssh/config" "~/.ssh/config"
handle_file_ln "~/.dotfiles/vuerc" "~/.vuerc"
handle_file_ln "~/.dotfiles/zshrc" "~/.zshrc"

View File

@@ -90,6 +90,7 @@ function section_dotfiles
rcup -B 0 -g \
| tee "$INSTALL_SCRIPT" 1> /dev/null \
&& shfmt -w -l "$INSTALL_SCRIPT" \
&& sed -i '' "s|$HOME|\~|g" "$INSTALL_SCRIPT" \
&& echo "🎉 Done!"
;;
shfmt)

View File

@@ -4,7 +4,8 @@ echo 'start osx/set-defaults.sh'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
# Keep-alive: update existing `sudo` time stamp
# until this script has finished
while true; do
sudo -n true
sleep 60

59
scripts/settler.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env bash
#
# Settler - my macOS setup automator
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `settler` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2> /dev/null &
# https://unix.stackexchange.com/a/408305
# check if user has git installed and propose to install if not installed
if [ "$(which git)" ]; then
echo "You already have git. Continuing..."
else
XCODE_MESSAGE="$(
osascript -e \
'tell app "System Events" to display dialog "Please click install when Command Line Developer Tools appears"'
)"
if [ "$XCODE_MESSAGE" = "button returned:OK" ]; then
xcode-select --install
else
echo "You have cancelled the installation, please rerun the installer."
exit
fi
fi
until [ "$(which git)" ]; do
echo -n "."
sleep 1
done
# Install brew
if [ "$(which brew)" ]; then
echo 'Brew already installed'
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
bash ../local/bin/dotfiles brew install && "Installed Brewfile contents"
bash ../local/bin/dotfiles dotfiles link && "Linked all dotfiles"
read -r -p "Do you want to set macOS defaults? (y/N) " yn
case $yn in
[yY])
bash "set-defaults.sh"
;;
*)
echo "Skipping..."
;;
esac
echo "Done. Note that some of these changes require a logout/restart to take effect."