repo: Update linting for 4-spaced shell scripts
This commit is contained in:
parent
864ec3d03b
commit
f4400da743
13 changed files with 417 additions and 417 deletions
118
install.sh
118
install.sh
|
|
@ -12,81 +12,81 @@
|
|||
bootstrap_dir="${BOOTSTRAP_DIRECTORY:-./bootstrap}"
|
||||
|
||||
main() {
|
||||
local cmd=""
|
||||
local ret=0
|
||||
local cmd=""
|
||||
local ret=0
|
||||
|
||||
case "$1" in
|
||||
-v | --version)
|
||||
printf "Personal system bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.1.1\n"
|
||||
;;
|
||||
-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
|
||||
case "$1" in
|
||||
-v | --version)
|
||||
printf "Personal system bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.1.1\n"
|
||||
;;
|
||||
-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
|
||||
$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
|
||||
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
|
||||
}
|
||||
|
||||
enable_git_hooks() {
|
||||
if [ "$1" == "false" ]; then
|
||||
echo "Should we enable git hooks for this repository, so that installed packages are automatically compared when committing? [Y/n]"
|
||||
read -r no
|
||||
if [[ "$no" == n* ]]; then
|
||||
echo "Not changing repository settings."
|
||||
return
|
||||
if [ "$1" == "false" ]; then
|
||||
echo "Should we enable git hooks for this repository, so that installed packages are automatically compared when committing? [Y/n]"
|
||||
read -r no
|
||||
if [[ "$no" == n* ]]; then
|
||||
echo "Not changing repository settings."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
git config --local core.hooksPath .githooks/
|
||||
echo "Changed repository settings."
|
||||
git config --local core.hooksPath .githooks/
|
||||
echo "Changed repository settings."
|
||||
}
|
||||
|
||||
install() {
|
||||
unattended=$1
|
||||
if ! "$unattended"; then
|
||||
check_consent
|
||||
fi
|
||||
echo "====================== BEGINNING INSTALLATION ============================="
|
||||
if ! "$unattended"; then
|
||||
export BOOTSTRAP_PACKAGES="bootstrap/packages.txt"
|
||||
"$bootstrap_dir"/install_packages.sh
|
||||
else
|
||||
export BOOTSTRAP_PACKAGES="bootstrap/packages.txt"
|
||||
"$bootstrap_dir"/install_packages.sh -f
|
||||
fi
|
||||
unset BOOTSTRAP_PACKAGES
|
||||
unattended=$1
|
||||
if ! "$unattended"; then
|
||||
check_consent
|
||||
fi
|
||||
echo "====================== BEGINNING INSTALLATION ============================="
|
||||
if ! "$unattended"; then
|
||||
export BOOTSTRAP_PACKAGES="bootstrap/packages.txt"
|
||||
"$bootstrap_dir"/install_packages.sh
|
||||
else
|
||||
export BOOTSTRAP_PACKAGES="bootstrap/packages.txt"
|
||||
"$bootstrap_dir"/install_packages.sh -f
|
||||
fi
|
||||
unset BOOTSTRAP_PACKAGES
|
||||
|
||||
echo "=================== BEGINNING DOTFILE MANAGEMENT =========================="
|
||||
# get all top level directories, remove their slashes and dots
|
||||
# finally get rid of .dot-directories, since they are for the repo not for my homedir
|
||||
targets="$(find . -maxdepth 1 -type d | sed -e 's/^\.\/\(.*\)$/\1/' | sed -e '/^\./d')"
|
||||
echo "=================== BEGINNING DOTFILE MANAGEMENT =========================="
|
||||
# get all top level directories, remove their slashes and dots
|
||||
# finally get rid of .dot-directories, since they are for the repo not for my homedir
|
||||
targets="$(find . -maxdepth 1 -type d | sed -e 's/^\.\/\(.*\)$/\1/' | sed -e '/^\./d')"
|
||||
|
||||
# shellcheck disable=2086
|
||||
# -- for some reason stow only works with unqoted var expansion
|
||||
stow -R ${targets} 2> >(grep -v 'Absolute/relative mismatch between Stow dir' 1>&2)
|
||||
# shellcheck disable=2086
|
||||
# -- for some reason stow only works with unqoted var expansion
|
||||
stow -R ${targets} 2> >(grep -v 'Absolute/relative mismatch between Stow dir' 1>&2)
|
||||
|
||||
echo "================== ENABLING GIT REPOSITORY HOOKS =========================="
|
||||
enable_git_hooks "$unattended"
|
||||
echo "================== ENABLING GIT REPOSITORY HOOKS =========================="
|
||||
enable_git_hooks "$unattended"
|
||||
|
||||
echo "====================== INSTALLATION FINISHED =============================="
|
||||
exit 0
|
||||
echo "====================== INSTALLATION FINISHED =============================="
|
||||
exit 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue