Updated install script
This commit is contained in:
parent
122ab7d6f3
commit
ccb4e7afbb
83
install.sh
83
install.sh
|
@ -26,9 +26,24 @@ echo '#-----------------------------------------#'
|
|||
echo '# Paper GTK Theme Install Script #'
|
||||
echo '#-----------------------------------------#'
|
||||
|
||||
|
||||
show_question() {
|
||||
echo -e "\033[1;34m$@\033[0m"
|
||||
}
|
||||
|
||||
show_dir() {
|
||||
echo -e "\033[1;32m$@\033[0m"
|
||||
}
|
||||
|
||||
show_error() {
|
||||
echo -e "\033[1;31m$@\033[0m"
|
||||
}
|
||||
|
||||
function continue {
|
||||
echo ""
|
||||
read -p "Do you want to continue? (Y)es, (N)o : " INPUT
|
||||
echo
|
||||
show_question '\tDo you want to continue? (Y)es, (N)o : '
|
||||
echo
|
||||
read INPUT
|
||||
case $INPUT in
|
||||
[Yy]* ) main;;
|
||||
[Nn]* ) exit 99;;
|
||||
|
@ -40,33 +55,32 @@ function main {
|
|||
if [ "$UID" -eq "$ROOT_UID" ]; then
|
||||
if [ -d /usr/share/themes/Paper ]; then
|
||||
echo
|
||||
read -p "Found an existing installation. Replace it? (Y)es, (N)o : " INPUT
|
||||
show_question '\tFound an existing installation. Replace it? (Y)es, (N)o : '
|
||||
echo
|
||||
read INPUT
|
||||
case $INPUT in
|
||||
[Yy]* ) rm -Rf /usr/share/themes/Paper 2>/dev/null;;
|
||||
[Nn]* );;
|
||||
* )
|
||||
clear && echo 'Sorry, try again.'
|
||||
main
|
||||
;;
|
||||
* ) clear; show_error '\tSorry, try again.'; main;;
|
||||
esac
|
||||
fi
|
||||
echo "Installing..."
|
||||
cp -R ./Paper/ /usr/share/themes/
|
||||
chmod -R 755 /usr/share/themes/Paper
|
||||
echo "Installation complete!"
|
||||
set
|
||||
elif [ "$UID" -ne "$ROOT_UID" ]; then
|
||||
if [ -d $HOME/.local/share/themes/Paper ]; then
|
||||
echo
|
||||
read -p "Found an existing installation. Replace it? (Y)es, (N)o : " INPUT
|
||||
show_question '\tFound an existing installation. Replace it? (Y)es, (N)o : '
|
||||
echo
|
||||
read INPUT
|
||||
case $INPUT in
|
||||
[Yy]* ) rm -Rf "$HOME/.local/share/themes/Paper" 2>/dev/null;;
|
||||
[Nn]* );;
|
||||
* )
|
||||
clear && echo 'Sorry, try again.'
|
||||
main
|
||||
;;
|
||||
* ) clear; show_error '\tSorry, try again.'; main;;
|
||||
esac
|
||||
fi
|
||||
echo "Installing..."
|
||||
# .local/share/themes
|
||||
if [ -d $HOME/.local/share/themes ]; then
|
||||
cp -R ./Paper/ $HOME/.local/share/themes/
|
||||
|
@ -82,25 +96,49 @@ elif [ "$UID" -ne "$ROOT_UID" ]; then
|
|||
cp -R ./Paper/ $HOME/.local/share/themes/
|
||||
fi
|
||||
echo "Installation complete!"
|
||||
set
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
function set {
|
||||
echo ""
|
||||
read -p "Do you want to set Paper as desktop theme? (Y)es, (N)o : " INPUT
|
||||
echo
|
||||
show_question '\tDo you want to set Paper as desktop theme? (Y)es, (N)o : '
|
||||
echo
|
||||
read INPUT
|
||||
case $INPUT in
|
||||
[Yy]* ) settheme;;
|
||||
[Nn]* ) end;;
|
||||
* ) echo; echo "Uh oh, invalid response. Please retry."; set;;
|
||||
* ) echo; show_error "\aUh oh, invalid response. Please retry."; set;;
|
||||
esac
|
||||
}
|
||||
|
||||
function settheme {
|
||||
echo "Setting Paper as desktop GTK theme..."
|
||||
gsettings reset org.gnome.desktop.interface gtk-theme
|
||||
gsettings reset org.gnome.desktop.wm.preferences theme
|
||||
gsettings set org.gnome.desktop.interface gtk-theme "Paper"
|
||||
gsettings set org.gnome.desktop.wm.preferences theme "Paper"
|
||||
echo "Done."
|
||||
end
|
||||
setthemegnome
|
||||
}
|
||||
|
||||
function setthemegnome {
|
||||
if [ -d /usr/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gcampax.github.com/ ]; then
|
||||
echo
|
||||
show_question '\tWould you like to use Paper as your GNOME Shell theme? (Y)es, (N)o : '
|
||||
echo
|
||||
read INPUT
|
||||
case $INPUT in
|
||||
[Yy]* ) gsettings set org.gnome.shell.extensions.user-theme name "Paper";;
|
||||
[Nn]* ) end;;
|
||||
* ) echo; show_error "\aUh oh, invalid response. Please retry."; set;;
|
||||
esac
|
||||
end
|
||||
else
|
||||
end
|
||||
fi
|
||||
}
|
||||
|
||||
function end {
|
||||
|
@ -108,15 +146,22 @@ function end {
|
|||
exit 0
|
||||
}
|
||||
|
||||
|
||||
ROOT_UID=0
|
||||
if [ "$UID" -ne "$ROOT_UID" ]; then
|
||||
echo
|
||||
echo "Paper GTK Theme will be installed in '$HOME/.local/share/themes/Paper'."
|
||||
echo "Paper GTK Theme will be installed in:"
|
||||
echo
|
||||
show_dir '\t$HOME/.local/share/themes'
|
||||
echo
|
||||
echo "To make them available to all users, run this script as root."
|
||||
continue
|
||||
else
|
||||
echo
|
||||
echo "Paper GTK Theme will be installed in '/usr/share/themes'"
|
||||
echo "Paper GTK Theme will be installed in:"
|
||||
echo
|
||||
show_dir '\t/usr/share/themes'
|
||||
echo
|
||||
echo "It will be available to all users."
|
||||
continue
|
||||
fi
|
Loading…
Reference in New Issue