aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Koglin-Fischer2023-12-21 13:45:40 +0100
committerStephan Koglin-Fischer2023-12-21 13:45:40 +0100
commit8ad2d063c1f6b81a261b265e41ee64cbb67adede (patch)
treee061711d7e8361bf0ac63e5abdd02dab1fac456b
parentb5b2f46a9cd463dd2d389f5c0ab240a9a2dccbb8 (diff)
downloadaur-8ad2d063c1f6b81a261b265e41ee64cbb67adede.tar.gz
fix: zsh fails on prepare if the .zshrc contains setopt
feat: .zshrc compatibility by injecting a proepr shebang
-rw-r--r--PKGBUILD12
1 files changed, 12 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
index e591fc21dcd8..001a854d89bd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -36,10 +36,22 @@ check-for-asdf() {
echo -e "\nsource /opt/asdf-vm/asdf.fish" >> ~/.config/fish/config.fish
source ~/.config/fish/config.fish
elif [[ $SHELL == *"zsh"* ]]; then
+ # Just to make sure that an existing zsh config is not intervening,
+ # we need to check that the .zshrc file contains the proper shebang #!/usr/bin/env zsh
+ if ! grep -q "#!/usr/bin/env zsh" ~/.zshrc; then
+ echo "The .zshrc file does not contain the proper shebang #!/usr/bin/env zsh"
+ echo "This script is likely to fail."
+ echo "For convenience, we will add it for you."
+ echo "If you do not want this, please remove it manually after the installation has finished."
+ echo -e "# Shebang added by the dashlane-cli-git package\n#!/usr/bin/env zsh\n$(cat ~/.zshrc)" > ~/.zshrc
+ fi
+ # Adding the asdf path to .zshrc - if it would already be there, we would not be here
echo -e "\n. /opt/asdf-vm/asdf.sh" >> ~/.zshrc
source ~/.zshrc
else
echo "Unsupported shell. Please add asdf to your shell's initialization file manually."
+ echo "Consider opening an issue or contribute a pull request to add support for your shell."
+ echo "https://github.com/skf-funzt/dashlane-cli-git"
exit 1
fi
fi