From 3dc64233d569ef2a19611052695b8dc9a5e00033 Mon Sep 17 00:00:00 2001 From: spekulaas Date: Thu, 29 Sep 2022 10:45:48 +0200 Subject: [PATCH] i shouldve created a branch --- install.sh | 22 ++++++++++++++++++---- src/Oh-My-ZSH.sh | 14 -------------- src/applications/postman.sh | 15 ++++++++------- src/importantinstalls/node.sh | 16 +++++++++------- src/services/zsh/Oh-My-ZSH.sh | 2 ++ src/services/zsh/zsh.sh | 8 ++++++++ 6 files changed, 45 insertions(+), 32 deletions(-) delete mode 100644 src/Oh-My-ZSH.sh create mode 100644 src/services/zsh/Oh-My-ZSH.sh create mode 100644 src/services/zsh/zsh.sh diff --git a/install.sh b/install.sh index b43b6a4..ef53e94 100755 --- a/install.sh +++ b/install.sh @@ -40,10 +40,12 @@ zsh_prompt() { fi # run option - if [[ ${zshOption,,} = "n" ]]; then - return - elif [[ ${zshOption,,} = "y" ]]; then - sh src/Oh-My-ZSH.sh + if [[ ${zshOption,,} = "y" ]]; then + # Create temporary zsh file + touch $homedir/.tempzshrc + + # set up the basics of zsh + sh src/services/zsh/zsh.sh fi } @@ -288,6 +290,14 @@ check_sudo_arguments() { main } +install_oh_my_zsh() { + # run option + if [[ ${zshOption,,} = "y" ]]; then + # Run Ohmyzsh (ends script) + sh services/zsh/Oh-My-ZSH.sh + fi +} + main() { # check if the computer has a stable connections source ./src/services/connection.sh @@ -321,6 +331,8 @@ main() { cd $dir cd src rm temp/* + + install_oh_my_zsh } # PROGRAM BODY @@ -349,6 +361,8 @@ homedir="$(getent passwd $SUDO_USER | cut -d: -f6)" debug=false downloadall=false usezsh="" +echo $homedir +sleep 10 # run the program if [ $# -eq 0 ]; then diff --git a/src/Oh-My-ZSH.sh b/src/Oh-My-ZSH.sh deleted file mode 100644 index 0ef9681..0000000 --- a/src/Oh-My-ZSH.sh +++ /dev/null @@ -1,14 +0,0 @@ -# install ZSH -sudo apt-get update -sudo apt-get install zsh -y - -# Set ZSH as standard interface -chsh -s $(which zsh) - - -bash -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended -# Get oh my zsh -# sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -y - -# recompile zsh -source ~/.zshrc \ No newline at end of file diff --git a/src/applications/postman.sh b/src/applications/postman.sh index ecbb269..8d44c0d 100644 --- a/src/applications/postman.sh +++ b/src/applications/postman.sh @@ -6,15 +6,16 @@ sudo tar -xvf linux64 -C /usr/bin # export postman to env table if [[ $(which zsh) == "/usr/bin/zsh" ]]; then - echo '# Postman path' >> ~/.zshrc - echo 'export PATH="$PATH:/usr/bin/Postman"' >> ~/.zshrc - source ~/.zshrc -else - echo '# Postman path' >> ~/.bashrc - echo 'export PATH="$PATH:/usr/bin/Postman"' >> ~/.bashrc - source ~/.bashrc + echo '# Postman path' >> ~/.tempzshrc + echo 'export PATH="$PATH:/usr/bin/Postman"' >> ~/.tempzshrc + source ~/.tempzshrc fi +# always put in bashrc aswell, so that the user can always rely on the standard shell +echo '# Postman path' >> ~/.bashrc +echo 'export PATH="$PATH:/usr/bin/Postman"' >> ~/.bashrc +source ~/.bashrc + # Create file and set info touch Postman.desktop { diff --git a/src/importantinstalls/node.sh b/src/importantinstalls/node.sh index 631ffdf..52ef6f4 100644 --- a/src/importantinstalls/node.sh +++ b/src/importantinstalls/node.sh @@ -3,14 +3,16 @@ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash # export nvm to env table if [[ $(which zsh) == "/usr/bin/zsh" ]]; then - echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.zshrc - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.zshrc - source ~/.zshrc -else - echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc - source ~/.bashrc + echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.tempzshrc + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.tempzshrc + source ~/.tempzshrc fi +# always put in bashrc aswell, so that the user can always rely on the standard shell +echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc +echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc +source ~/.bashrc + + # install latest version of node nvm install node \ No newline at end of file diff --git a/src/services/zsh/Oh-My-ZSH.sh b/src/services/zsh/Oh-My-ZSH.sh new file mode 100644 index 0000000..07e2f60 --- /dev/null +++ b/src/services/zsh/Oh-My-ZSH.sh @@ -0,0 +1,2 @@ +# Get oh my zsh, after this command the install stios, since we switched shells +sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" -y \ No newline at end of file diff --git a/src/services/zsh/zsh.sh b/src/services/zsh/zsh.sh new file mode 100644 index 0000000..757fb7c --- /dev/null +++ b/src/services/zsh/zsh.sh @@ -0,0 +1,8 @@ +# install ZSH +sudo apt-get update +sudo apt-get install zsh -y + +# Set ZSH as standard interface +chsh -s $(which zsh) + +source ~/.zshrc \ No newline at end of file