Add capacity for multiple supported Stow versions

This commit is contained in:
Danielle McLean 2023-11-01 11:41:53 +11:00
parent a685244436
commit c9a945559d
Signed by: 00dani
GPG key ID: 52C059C3B22A753E

View file

@ -11,17 +11,23 @@ global_ignore=(
'\..*\.swp' '\..*\.swp'
) )
supported_stow_versions=(
2.3.2-fixbug56727
)
bootstrap() { bootstrap() {
echo 'Bootstrapping your dotfiles...' >&2 echo 'Bootstrapping your dotfiles...' >&2
mkdir -p $DOTFILES mkdir -p $DOTFILES
touch $DOTFILES/.stow touch $DOTFILES/.stow
if (( $+commands[stow] )); then if (( $+commands[stow] )); then
local stow_version=${"$(stow -V)"#stow*version } local stow_version=${"$(stow -V)"#stow*version }
if [[ $stow_version != 2.3.2-fixbug56727 ]]; then if (( 0 == $supported_stow_versions[(Ie)$stow_version] )); then
echo "GNU Stow is installed, but version $stow_version is bugged." >&2 echo "GNU Stow is installed, but version $stow_version is bugged." >&2
echo 'See https://github.com/aspiers/stow/issues/33 for info.' >&2 echo 'See https://github.com/aspiers/stow/issues/33 for info.' >&2
echo 'Will fetch patched version of Stow...' >&2 echo 'Will fetch patched version of Stow...' >&2
install-custom-gnu-stow || return $? install-custom-gnu-stow || return $?
else
echo "GNU Stow version $stow_version is installed and is compatible with dots." >&2
fi fi
else else
echo 'GNU Stow is not installed, fetching it...' >&2 echo 'GNU Stow is not installed, fetching it...' >&2