From ba069e7731b3afe90a393fb6a36f8f9bda795f8b Mon Sep 17 00:00:00 2001
From: Marc Cornellà <hello@mcornella.com>
Date: Sun, 26 Dec 2021 22:40:38 +0100
Subject: fix(installer): don't hard-code user `$HOME` directory on install

---
 tools/install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'tools/install.sh')

diff --git a/tools/install.sh b/tools/install.sh
index 47166059d..d210d8cc9 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -251,7 +251,7 @@ setup_zshrc() {
   echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
 
   sed "/^export ZSH=/ c\\
-export ZSH=\"$ZSH\"
+export ZSH=\"${ZSH/$HOME\//\$HOME\/}\"
 " "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp
   mv -f ~/.zshrc-omztemp ~/.zshrc
 
-- 
cgit v1.2.3-70-g09d2


From f85087005a966445e167bf7962f35032597663c3 Mon Sep 17 00:00:00 2001
From: Marc Cornellà <hello@mcornella.com>
Date: Sun, 26 Dec 2021 23:27:49 +0100
Subject: fix(installer): fix POSIX shell syntax of previous commit

---
 tools/install.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'tools/install.sh')

diff --git a/tools/install.sh b/tools/install.sh
index d210d8cc9..731d89a29 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -250,9 +250,9 @@ setup_zshrc() {
 
   echo "${GREEN}Using the Oh My Zsh template file and adding it to ~/.zshrc.${RESET}"
 
-  sed "/^export ZSH=/ c\\
-export ZSH=\"${ZSH/$HOME\//\$HOME\/}\"
-" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp
+  # Replace $HOME path with '$HOME' in $ZSH variable in .zshrc file
+  omz=$(echo "$ZSH" | sed "s|^$HOME/|\$HOME/|")
+  sed "s|^export ZSH=.*$|export ZSH=\"${omz}\"|" "$ZSH/templates/zshrc.zsh-template" > ~/.zshrc-omztemp
   mv -f ~/.zshrc-omztemp ~/.zshrc
 
   echo
-- 
cgit v1.2.3-70-g09d2