2019-12-30 09:20:17 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# install.sh
|
|
|
|
#
|
|
|
|
# Installs dotfiles and packages for my setup
|
|
|
|
#
|
|
|
|
# Will first install yay, then all my used packages (read from bootstrap/packages.csv)
|
|
|
|
#
|
2020-02-06 11:08:33 +00:00
|
|
|
# Finally, symlinks all dotfiles into their correct locations using stow
|
2019-12-30 09:20:17 +00:00
|
|
|
|
2020-01-30 12:29:03 +00:00
|
|
|
bootstrap_dir="${BOOTSTRAP_DIRECTORY:-./_bootstrap}"
|
2020-01-30 12:09:10 +00:00
|
|
|
|
2019-12-30 09:20:17 +00:00
|
|
|
main() {
|
|
|
|
local cmd=""
|
|
|
|
local ret=0
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
-v | --version)
|
2020-01-30 12:09:10 +00:00
|
|
|
printf "Personal system bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.1.1\n"
|
2019-12-30 09:20:17 +00:00
|
|
|
;;
|
|
|
|
-h | --help)
|
|
|
|
printf "Usage: install [-f|--force][-v|--version][-h|--help]\n\n-f Do not ask for any confirmations but force update and installation.\n"
|
|
|
|
;;
|
|
|
|
-f | --force)
|
|
|
|
install true
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
install false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
|
|
|
|
$cmd "$@"
|
|
|
|
ret=$((ret + $?))
|
|
|
|
exit $ret
|
|
|
|
}
|
|
|
|
|
|
|
|
check_consent() {
|
|
|
|
echo "This will take a while, install many packages and link dotfiles all over the place. Proceed [y/N]?"
|
|
|
|
read -r yes
|
|
|
|
if [[ "$yes" != y* ]]; then
|
|
|
|
echo "Exiting."
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install() {
|
|
|
|
unattended=$1
|
|
|
|
if ! "$unattended"; then
|
|
|
|
check_consent
|
|
|
|
fi
|
|
|
|
echo "====================== BEGINNING INSTALLATION ============================="
|
|
|
|
if ! "$unattended"; then
|
2019-12-30 10:04:54 +00:00
|
|
|
export BOOTSTRAP_PACKAGES="bootstrap/packages.csv"
|
2020-01-30 12:09:10 +00:00
|
|
|
"$bootstrap_dir"/install_packages.sh
|
2019-12-30 09:20:17 +00:00
|
|
|
else
|
2019-12-30 10:04:54 +00:00
|
|
|
export BOOTSTRAP_PACKAGES="bootstrap/packages.csv"
|
2020-01-30 12:09:10 +00:00
|
|
|
"$bootstrap_dir"/install_packages.sh -f
|
2019-12-30 09:20:17 +00:00
|
|
|
fi
|
2019-12-30 10:04:54 +00:00
|
|
|
unset BOOTSTRAP_PACKAGES
|
2019-12-30 09:20:17 +00:00
|
|
|
|
|
|
|
echo "=================== BEGINNING DOTFILE MANAGEMENT =========================="
|
2020-02-06 11:08:33 +00:00
|
|
|
stow -R ./*/
|
2019-12-30 09:20:17 +00:00
|
|
|
|
|
|
|
echo "====================== INSTALLATION FINISHED =============================="
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|