aboutsummaryrefslogtreecommitdiffstats
path: root/install.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'install.zsh')
-rwxr-xr-xinstall.zsh12
1 files changed, 11 insertions, 1 deletions
diff --git a/install.zsh b/install.zsh
index 933150c..223089b 100755
--- a/install.zsh
+++ b/install.zsh
@@ -1,5 +1,11 @@
#!/usr/bin/env zsh
set -e
+
+if [[ "$ZSH_NAME" == "" ]]; then
+ echo -e "\x1b[0;31mThe installer expects ZSH to be the executing shell, lmao.\x1b[0m"
+ exit 1
+fi
+
__filename="$(realpath "$0")"
__dirname="$(dirname "$__filename")"
@@ -39,6 +45,10 @@ fi
for d in /usr/share/zsh/plugins/zuwu /usr/local/share/zsh/plugins/zuwu "\\\$HOME/.local/share/zsh/plugins/zuwu"; do
if [[ -d "\\\$d" ]]; then
source "\\\$d/zuwu.zsh"
+ # For debugging, calling _ZUWU_DETECTED_INSTALL_PATH=/dev/null zsh -c 'source ~/.zshrc && echo "\\\$_ZUWU_DETECTED_INSTALL_PATH"' may be useful
+ if [[ "\\\$_ZUWU_DETECTED_INSTALL_PATH" != "" ]]; then
+ _ZUWU_DETECTED_INSTALL_PATH="\\\$d"
+ fi
break
fi
done
@@ -46,7 +56,7 @@ EOF_ZSHRC
echo -e "\x1b[0;32mPlease run \x1b[0;34msource \$HOME/.zshrc\x1b[0;32m to load zuwu into the current shell.\x1b[0m"
EOF_SETUPSCRIPT
chmod +x "$TARGET/setup.zsh"
-if [[ "$_ZUWU_INSTALLED" != "1" ]]; then
+if [[ "$_ZUWU_INSTALLED" != "1" ]] || ! [[ -f "$HOME/.zshrc" ]]; then
echo -e "\x1b[0;32mPlease run \x1b[0;34m$TARGET/setup.zsh\x1b[0;32m to install zuwu for the current user.\x1b[0m"
else
echo -e "\x1b[0;32mPlease run \x1b[0;34msource $HOME/.zshrc\x1b[0;32m to finish updating zuwu.\x1b[0m"