Working on non root usage
This commit is contained in:
parent
7e8b2f3483
commit
22e1eccdd2
32
tforgione.sh
32
tforgione.sh
|
@ -90,15 +90,25 @@ configure_zsh() {
|
||||||
|
|
||||||
test_command git
|
test_command git
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
if [ $sudo_available -ne 0 ]; then
|
||||||
|
error "git is needed, but you don't have git neither sudo"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
yes_no_ask_required "you'll need git for this, do you wish to install git ?"
|
yes_no_ask_required "you'll need git for this, do you wish to install git ?"
|
||||||
install git
|
install git
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
test_command zsh
|
test_command zsh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
if [ $sudo_available -ne 0 ]; then
|
||||||
|
error "zsh is needed, but you don't have zsh neither sudo"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
yes_no_ask_required "this magnificent prompt is based on zsh, do you wish to install zsh ?"
|
yes_no_ask_required "this magnificent prompt is based on zsh, do you wish to install zsh ?"
|
||||||
install zsh
|
install zsh
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p $HOME/.config
|
mkdir -p $HOME/.config
|
||||||
if [ ! -d $HOME/.config/oh-my-zsh ]; then
|
if [ ! -d $HOME/.config/oh-my-zsh ]; then
|
||||||
|
@ -131,6 +141,9 @@ configure_zsh() {
|
||||||
info "it seems that you already use zsh."
|
info "it seems that you already use zsh."
|
||||||
else
|
else
|
||||||
info "it seems your shell is not zsh..."
|
info "it seems your shell is not zsh..."
|
||||||
|
|
||||||
|
if [ $sudo_available -eq 0 ]; then
|
||||||
|
# Sudo is available, run chsh
|
||||||
yes_no_ask "do you want to change your shell ? (you'll need root) ?"
|
yes_no_ask "do you want to change your shell ? (you'll need root) ?"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
info "changing your shell"
|
info "changing your shell"
|
||||||
|
@ -138,6 +151,15 @@ configure_zsh() {
|
||||||
else
|
else
|
||||||
info "not doing anything"
|
info "not doing anything"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
info "you don't have root, but you can run 'exec zsh' at the end of your bashrc"
|
||||||
|
yes_no_ask "do you wish to do that ?"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "\nexec zsh\n" >> $HOME/.bashrc
|
||||||
|
else
|
||||||
|
info "not doing anything"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,5 +168,15 @@ main() {
|
||||||
configure_zsh
|
configure_zsh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sudoresult=$(sudo -nv 2>&1)
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
sudo_available=0
|
||||||
|
elif echo $sudoresult | grep -q '^sudo:'; then
|
||||||
|
sudo_available=0
|
||||||
|
else
|
||||||
|
sudo_available=1
|
||||||
|
fi
|
||||||
|
|
||||||
main < /dev/tty
|
main < /dev/tty
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue