Removed old brewfiles and installation scripts

This commit is contained in:
2023-03-06 17:48:16 -05:00
parent 550b67e68b
commit ab0a40c3c1
12 changed files with 0 additions and 878 deletions

View File

@@ -1,4 +1,3 @@
# TODO # TODO
- Remove brewfiles and use the `dots` app instead. - Remove brewfiles and use the `dots` app instead.
- Update `Makefile`

View File

@@ -1,176 +0,0 @@
#!/bin/bash
set -e
prefs="${HOME}/Library/Preferences"
espanso_tap="federico-terzi/espanso"
espanso_packages=(
"mac-symbols"
"all-emojis"
)
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls espanso & configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/Library/Preferences/espanso directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files and espanso.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "$prefs"; then
mkdir "$prefs"
fi
if ! test -d "$prefs/espanso"; then
mkdir "$prefs/espanso"
fi
}
_command_exists() {
command -v "$1" >/dev/null 2>&1
}
_install_packages() {
for arg in "${espanso_packages[@]}"; do
echo "Installing espanso package: $arg"
espanso install "$arg"
done
}
_uninstall_packages() {
for arg in "${espanso_packages[@]}"; do
echo "Uninstalling espanso package: $arg"
espanso uninstall "$arg"
done
}
_remove_espanso_config() {
echo "Removing espanso configuration..."
if test -e "$prefs/espanso"; then
rm -rf "$prefs/espanso"
fi
}
_copy_espanso() {
echo "Copying espanso configuration..."
cp -r "$PWD/espanso" "$prefs"
}
_link_espanso() {
echo "Linking espanso configuration..."
# linking the espanso directory is not permitted, so we can only
# link the configuration inside of the preferences directory.
ln -sfv "$PWD/espanso/default.yml" "$prefs/espanso"
ln -sfv "$PWD/espanso/user" "$prefs/espanso"
}
_install() {
# check if espanso is installed already.
if ! _command_exists espanso; then
if ! _command_exists brew; then
echo "Homebrew is not installed."
exit 1
fi
echo "Installing espanso with brew..."
brew tap "$espanso_tap"
brew install espanso
fi
# We have espanso, so install configuration files
_make_dirs
# must copy / link configuration before installing packages,
# else the default configuration get's installed and causes this
# script to fail
if test $copy -eq 0 ; then
_copy_espanso
elif test $link -eq 0; then
_link_espanso
else
# we don't know what to do.
echo "Neither link nor copy was passed in, use --help for usage."
exit 1
fi
_install_packages
}
_uninstall() {
# remove the configuration files
_remove_espanso_config
if _command_exists espanso; then
# uninstall packages
_uninstall_packages
if _command_exists brew; then
# uninstall espanso
brew uninstall espanso
fi
fi
echo "Uninstalled espanso..."
}
#-------------- main ---------------
main() {
_parse_options "$@"
# check if we are in uninstall or remove mode.
test "$remove" -eq 0 && _remove_espanso_config && exit "$?"
test "$uninstall" -eq 0 && _uninstall && exit "$?"
# else install espanso
_install
echo ""
echo "Espanso installed, you will need to enable accessibility options in your settings"
echo "Use 'espanso start' to start the espanso service."
echo ""
}
main "$@"

View File

@@ -1,95 +0,0 @@
#!/bin/sh
config="${HOME}/.config"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls git configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/.config/git directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "${config}"; then
mkdir "${config}"
fi
}
_remove_git() {
echo "Removing git directory..."
test -d "${config}/git" && rm -r "${config}/git"
}
_link_git() {
echo "Linking git configuration..."
ln -sfv "${PWD}/git" "${config}"
}
_copy_git() {
echo "Copying git configuration..."
cp -r "${PWD}/git" "${config}"
}
_install() {
_make_dirs
test "$copy" -eq 0 && _copy_git && return "$?"
test "$link" -eq 0 && _link_git && return "$?"
echo "Neither link or copy was passed, see --help for usage"
exit 1
}
#------------------------------- main -------------------------------
main() {
_parse_options "$@"
test "$remove" -eq 0 && _remove_git && exit "$?"
test "$uninstall" -eq 0 && _remove_git && exit "$?"
_install && exit "$?"
}
main "$@"

12
install
View File

@@ -1,12 +0,0 @@
#!/bin/sh
set -e
dir="${PWD}"
cd "${dir}/zsh" && ./setup
#cd "${dir}/scripts" && ./setup
ln -sfv "${dir}/scripts/scripts" ~/.local/scripts
cd "${dir}/vim" && ./setup
cd "${dir}/git" && ./setup
cd "${dir}/tmux" && ./setup

View File

@@ -1,2 +0,0 @@
mas "pwSafe", id: 520993579
mas "Home Assistant", id: 1099568401

View File

@@ -1,30 +0,0 @@
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "federico-terzi/espanso"
tap "m-housh/formula"
# TODO: Make the application directory a global variable ??
# set arguments for all 'brew install --cask' commands
#cask_args appdir: "~/Applications", require_sha: true
# formula
brew "espanso" # Espanso: Text expander
brew "fd" # required for some neovim plugins
brew "figlet" # for ascii art / text
brew "gh" # Github CLI
brew "git"
brew "httpie" # better curl / api's from command line.
brew "jq" # json utilities
brew "mas" # Mac AppStore apps from cli
#brew "neovim"
brew "pure" # for cli prompt
brew "ripgrep"
brew "swift-format" # for formatting swift files
brew "swift-zet" # for managing zettelkasten notes
brew "tmux" # terminal multi-plexer
brew "vim"
brew "zsh"
brew "zsh-completions"
# fonts
cask "font-inconsolata-nerd-font"

View File

@@ -1,13 +0,0 @@
tap "homebrew/cask"
# casks
cask "docker" # development containers
cask "google-chrome" # certain processes work better in chrome
cask "iterm2" # terminal application
#cask "microsoft-teams"
#cask "obs" # video / recording tools
cask "onyx" # macOS utilities
cask "rapidapi" # API utility
cask "rectangle" # Window management
#cask "sketchup-pro" # 3D modeling

View File

@@ -1,117 +0,0 @@
#!/bin/sh
set -e
config="${HOME}/.config"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls nvim configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/.config/nvim directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "${config}"; then
mkdir "${config}"
fi
if ! test -d "${config}/nvim"; then
mkdir "${config}/nvim"
fi
}
_remove_nvim() {
echo "Removing nvim configuration..." >&2
test -d "${config}/nvim" && rm -r "${config}/nvim"
}
_uninstall_nvim() {
echo "Uninstalling nvim configuration..." >&2
test -e "${config}/nvim/init.lua" && rm "${config}/nvim/init.lua"
test -d "${config}/nvim/lua" && rm "${config}/nvim/lua"
}
_link_nvim() {
echo "Linking nvim configuration..." >&2
ln -sfv "${PWD}/init.lua" "${config}/nvim"
ln -sfv "${PWD}/lua" "${config}/nvim"
}
_copy_nvim() {
echo "Linking nvim configuration..." >&2
cp "${PWD}/init.lua" "${config}/nvim"
cp -r "${PWD}/lua" "${config}/nvim"
}
_install_nvim() {
_make_dirs
# copy if in copy mode
test "$copy" -eq 0 && _copy_nvim && exit "$?"
# link if in link mode
test "$link" -eq 0 && _link_nvim && exit "$?"
# else we don't know what to do
echo "Neither link or copy options were set. Use the --help option for usage." >&2
exit 1
}
#------------------------------- main ------------------------------
main() {
_parse_options "$@"
# check if remove is called first
test "$remove" -eq 0 && _remove_nvim && exit "$?"
# then check if uninstall was called
test "$uninstall" -eq 0 && _uninstall_nvim && exit "$?"
# else install the configuration files
_install_nvim
echo "Nvim will need to be started and call :PackerSync for plugins to be downloaded." >&2
}
main "$@"

View File

@@ -1,102 +0,0 @@
#!/bin/sh
set -e
scripts="${HOME}/.local/scripts"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls zsh configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/.config/scripts directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "${HOME}/.local"; then
mkdir "${HOME}/.local"
fi
if ! test -d "${HOME}/.local/bin"; then
mkdir "${HOME}/.local/bin"
fi
}
_remove_scripts() {
echo "Removing scripts..."
test -e "${scripts}" && rm "${scripts}"
}
_link_scripts() {
echo "Linking scripts..."
ln -sfv "${PWD}/scripts" "${scripts}"
}
_copy_scripts() {
echo "Copying scripts..."
cp -r "${PWD}/scripts" "${scripts}"
}
_install() {
_make_dirs
test "$copy" -eq 0 && _copy_scripts && return "$?"
test "$link" -eq 0 && _link_scripts && return "$?"
echo "Neither link nor copy was passed, see --help for usage"
exit 1
}
#--------------- main ---------------
main() {
_parse_options "$@"
test "$remove" -eq 0 && _remove_scripts && exit "$?"
test "$uninstall" -eq 0 && _remove_scripts && exit "$?"
_install
}
main "$@"

View File

@@ -1,99 +0,0 @@
#!/bin/sh
set -e
tmux_conf="${HOME}/.tmux.conf"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls tmux configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the configuration files.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_uninstall_tmux() {
echo "Uninstalling tmux..." >&2
test -e "${tmux_conf}" && rm "${tmux_conf}"
}
_link_tmux() {
echo "Symlinking tmux configuration files..." >&2
ln -sfv "${PWD}/.tmux.conf" "${HOME}"
}
_copy_tmux() {
echo "Copying tmux configuration files..." >&2
cp "${PWD}/.tmux.conf" "${HOME}"
}
_install_tmux() {
# check if in copy mode & copy configuration
test "$copy" -eq 0 && _copy_tmux && return 0
# else check if in link mode & link configuration
test "$link" -eq 0 && _link_tmux && return 0
# we don't know what to do w/o link or copy so error
echo "Must supply the link or copy option, use --help for usage" >&2
exit 1
}
#------------------------------- main -------------------------------
main() {
_parse_options "$@"
# check if remove is called first
test $remove -eq 0 && _uninstall_tmux && exit "$?"
# then check if uninstall was called
test $uninstall -eq 0 && _uninstall_tmux && exit "$?"
# else install the configuration files
_install_tmux
}
main "$@"

111
vim/setup
View File

@@ -1,111 +0,0 @@
#!/bin/sh
set -e
vim_dir="${HOME}/.vim"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls vim configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/.vim directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "${vim_dir}"; then
mkdir "${vim_dir}"
fi
}
_uninstall_vim() {
echo "Uninstalling vim..." >&2
test -e "${vim_dir}/vimrc" && rm "${vim_dir}/vimrc"
}
_remove_vim() {
echo "Removing ~/.vim..." >&2
test -d "${vim_dir}" && rm -r -i "${vim_dir}"
}
_link_vim() {
echo "Symlinking vim configuration files..." >&2
ln -sfv "${PWD}/vimrc" "${vim_dir}"
}
_copy_vim() {
echo "Copying vim configuration files..." >&2
cp "${PWD}/vimrc" "${vim_dir}"
}
_install_vim() {
_make_dirs
# check if in copy mode & copy configuration
test "$copy" -eq 0 && _copy_vim && return 0
# else check if in link mode & link configuration
test "$link" -eq 0 && _link_vim && return 0
# we don't know what to do w/o link or copy so error
echo "Must supply the link or copy option, use --help for usage" >&2
exit 1
}
#------------------------------- main -------------------------------
main() {
_parse_options "$@"
# check if remove is called first
test $remove -eq 0 && _remove_vim && exit
# then check if uninstall was called
test $uninstall -eq 0 && _uninstall_vim && exit
# else install the configuration files
_install_vim
echo "Vim will need to be started for vim plugins to download."
}
main "$@"

120
zsh/setup
View File

@@ -1,120 +0,0 @@
#!/bin/sh
set -e
config="${HOME}/.config"
local_rc="${PWD}/config/.zshrc"
local_env="${PWD}/config/.zshenv"
local_funcs="${PWD}/config/zsh-functions"
uninstall=1
remove=1
copy=1
link=0
_usage() {
printf "\n" >&2
printf "Usage: setup [OPTIONS]\n" >&2
printf "\n" >&2
printf "Installs or Uninstalls zsh configuration files.\n" >&2
printf "\n" >&2
printf "Options:\n" >&2
printf "\t-c | --copy : Copy the configuration files, instead of creating symlinks.\n" >&2
printf "\t-h | --help : Print usage information.\n" >&2
printf "\t-l | --link : Create symlinks to the configuration files (Default).\n" >&2
printf "\t-r | --remove : Removes the entire ~/.config/zsh directory.\n" >&2
printf "\t-u | --uninstall : Uninstalls configuration files.\n" >&2
printf "\n" >&2
printf "If called without the uninstall option then it will install the configuration files.\n" >&2
printf "The copy and link options are ignored if called with the uninstall or remove option.\n" >&2
printf "\n" >&2
}
_parse_options() {
arg=
while ! test -z "$1"; do
arg="$1"
case $arg in
-c | --copy)
copy=0
link=1
shift;;
-h | --help)
_usage
exit;;
-l | --link)
copy=1
link=0
shift;;
-r | --remove)
remove=0
shift;;
-u | --uninstall)
uninstall=0
shift;;
*)
echo "Unknown option $arg" >&2
shift;;
esac
done
}
_make_dirs() {
if ! test -d "${config}"; then
mkdir "${config}"
fi
if ! test -d "${config}/zsh"; then
mkdir "${config}/zsh"
fi
}
_remove_zsh() {
echo "Removing ~/.config/zsh directory..." >&2
test -e "${HOME}/.zshenv" && rm "${HOME}/.zshenv"
test -d "${config}/zsh" && rm -r "${config}/zsh"
}
_uninstall_zsh() {
echo "Uninstalling zsh configuration..." >&2
test -e "${HOME}/.zshenv" && rm "${HOME}/.zshenv"
test -e "${config}/zsh/.zshrc" && rm "${config}/zsh/.zshrc"
test -e "${config}/zsh/zsh-functions" && rm "${config}/zsh/zsh-functions"
}
_link_zsh() {
echo "Linking zsh configuration..." >&2
ln -sfv "${local_env}" "${HOME}"
ln -sfv "${local_rc}" "${config}/zsh"
ln -sfv "${local_funcs}" "${config}/zsh"
}
_copy_zsh() {
echo "Copying zsh configuration..." >&2
cp "${local_env}" "${HOME}"
cp "${local_rc}" "${config}/zsh"
cp "${local_funcs}" "${config}/zsh"
}
_install_zsh() {
_make_dirs
# copy if in copy mode.
test "$copy" -eq 0 && _copy_zsh && return 0
# link if in link mode.
test "$link" -eq 0 && _link_zsh && return 0
# we don't know what to do error.
echo "Neither link or copy option was set, see --help for usage." >&2
exit 1
}
# -------------- main -------------------
main() {
_parse_options "$@"
# check if in remove mode.
test "$remove" -eq 0 && _remove_zsh && exit "$?"
# check if in uninstall mode.
test "$uninstall" -eq 0 && _uninstall_zsh && exit "$?"
# install
_install_zsh
}
main "$@"