mirror of
https://github.com/G2-Games/welcome.sh.git
synced 2025-04-19 05:22:53 -05:00
Installer niceities update
This commit is contained in:
parent
081e621b7c
commit
9575f5e9e1
1 changed files with 11 additions and 8 deletions
19
install.sh
19
install.sh
|
@ -2,13 +2,13 @@ version=0.2.4
|
||||||
bashrc="/home/$USER/.bashrc"
|
bashrc="/home/$USER/.bashrc"
|
||||||
zshrc="/home/$USER/.zshrc"
|
zshrc="/home/$USER/.zshrc"
|
||||||
originaldir=$PWD
|
originaldir=$PWD
|
||||||
environment=$(readlink /proc/$$/exe)
|
environment=$(readlink /proc/$$/exe | grep -o 'bash\|zsh')
|
||||||
if [[ "$environment" = "/usr/bin/bash" ]] || [[ "$environment" = "/usr/bin/zsh" ]];
|
if [[ "$environment" = "bash" ]] || [[ "$environment" = "zsh" ]];
|
||||||
then
|
then
|
||||||
if ! grep -q 'bash /home/$USER/.welcome/welcome.sh' $bashrc && ! grep -q 'zsh /home/$USER/.welcome/welcome.sh' $zshrc;
|
if ! grep -q 'bash /home/$USER/.welcome/welcome.sh' $bashrc && ! grep -q 'zsh /home/$USER/.welcome/welcome.sh' $zshrc;
|
||||||
then
|
then
|
||||||
tput sc
|
|
||||||
echo "Welcome! Installing..."
|
echo "Welcome! Installing..."
|
||||||
|
tput sc
|
||||||
cd /home/$USER
|
cd /home/$USER
|
||||||
mkdir -p /home/$USER/.welcome
|
mkdir -p /home/$USER/.welcome
|
||||||
if which curl >/dev/null ;
|
if which curl >/dev/null ;
|
||||||
|
@ -22,11 +22,11 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
chmod +x /home/$USER/.welcome/welcome.sh
|
chmod +x /home/$USER/.welcome/welcome.sh
|
||||||
if [[ "$environment" = "/usr/bin/bash" ]];
|
if [[ "$environment" = "bash" ]];
|
||||||
then
|
then
|
||||||
echo 'bash /home/$USER/.welcome/welcome.sh' >> $bashrc
|
echo 'bash /home/$USER/.welcome/welcome.sh' >> $bashrc
|
||||||
echo "Installing to bashrc"
|
echo "Installing to bashrc"
|
||||||
elif [[ "$environment" = "/usr/bin/zsh" ]];
|
elif [[ "$environment" = "zsh" ]];
|
||||||
then
|
then
|
||||||
echo 'zsh /home/$USER/.welcome/welcome.sh' >> $zshrc
|
echo 'zsh /home/$USER/.welcome/welcome.sh' >> $zshrc
|
||||||
echo "Installing to zshrc"
|
echo "Installing to zshrc"
|
||||||
|
@ -38,16 +38,19 @@ then
|
||||||
tput sc
|
tput sc
|
||||||
echo -e "\e[35mwelcome.sh\e[0m already installed!"
|
echo -e "\e[35mwelcome.sh\e[0m already installed!"
|
||||||
echo -en "Do you want to \e[31muninstall \e[35mwelcome.sh\e[0m?\n\e[36mY/n\e[0m"
|
echo -en "Do you want to \e[31muninstall \e[35mwelcome.sh\e[0m?\n\e[36mY/n\e[0m"
|
||||||
if [[ "$environment" = "/usr/bin/bash" ]]
|
if [[ "$environment" = "bash" ]]
|
||||||
then
|
then
|
||||||
read -p " " -n 1 -r
|
read -p " " -n 1 -r
|
||||||
elif [[ "$environment" = "/usr/bin/zsh" ]]
|
elif [[ "$environment" = "zsh" ]]
|
||||||
then
|
then
|
||||||
read -q "REPLY? " -n 1 -r
|
read -q "REPLY? " -n 1 -r
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
then
|
then
|
||||||
|
tput rc el ed
|
||||||
|
echo "Goodbye. Uninstalling..."
|
||||||
|
tput sc
|
||||||
rm /home/$USER/.welcome/welcome.sh
|
rm /home/$USER/.welcome/welcome.sh
|
||||||
rmdir /home/$USER/.welcome
|
rmdir /home/$USER/.welcome
|
||||||
if grep -n 'bash /home/$USER/.welcome/welcome.sh' $bashrc ;
|
if grep -n 'bash /home/$USER/.welcome/welcome.sh' $bashrc ;
|
||||||
|
@ -70,5 +73,5 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf "\e[31;5mERROR:\e[0m \e[31;3mThis script can only be installed in bash or zsh.\e[0m\n"
|
printf "\e[31;5mERROR:\e[0m \e[31;3mThis script can only be installed in Bash or Zsh.\e[0m\n"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue