diff options
Diffstat (limited to 'arc-theme-upgrade')
-rwxr-xr-x | arc-theme-upgrade | 131 |
1 files changed, 119 insertions, 12 deletions
diff --git a/arc-theme-upgrade b/arc-theme-upgrade index c4f895e..9558f82 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -2,19 +2,126 @@ # Script to upgrade/install the arc-theme -# Remove previows files -rm -rf /tmp/arc-theme +#URL +theme_name=Arc-theme -git clone https://github.com/horst3180/arc-theme /tmp/arc-theme --depth 1 && cd /tmp/arc-theme +# Theme name +download_url=https://github.com/horst3180/$theme_name/archive/master.tar.gz -# Remove old versions -sudo rm -rf /usr/share/themes/{Arc,Arc-Darker,Arc-Dark} -rm -rf ~/.local/share/themes/{Arc,Arc-Darker,Arc-Dark} -rm -rf ~/.themes/{Arc,Arc-Darker,Arc-Dark} +# Tempdir +tempdir=/tmp/$theme_name -GNOME_VERSION=$(apt-cache show gnome-shell | grep Version | cut -d ' ' -f2 | cut -c1-4) -./autogen.sh --prefix=/usr --with-gnome=${GNOME_VERSION} -sudo make install +# Directories +lightdir=/usr/share/themes/Arc +darkerdir=/usr/share/themes/Arc-Darker +darkdir=/usr/share/themes/Arc-Dark -# Remove the sources -rm -rf /tmp/arc-theme
\ No newline at end of file +userlightdir=$HOME/.themes/Arc +userdarkerdir=$HOME/.themes/Arc-Darker +userdarkdir=$HOME/.themes/Arc-Dark + +userlightdir2=$HOME/local/share/themes/Arc +userdarkerdir2=$HOME/local/share/themes/Arc-Darker +userdarkdir2=$HOME/local/share/themes/Arc-Dark + +#Functions +show_error() { +echo -e "\033[1;31m$@\033[0m" +} + +check_root() { + if [[ "${EUID}" -ne 0 ]]; then + show_error "This script has to be run as root" + exit 1; + fi +} + +check_command() { + fail=false + + for i in "$@" + do + command -v $i >/dev/null 2>&1 || { show_error >&2 "This script requires "$i" but it's not installed."; fail=true; } + done + + if [ "$fail" = true ]; then + echo + echo "Aborting." + echo + exit 1; + fi +} + +check_directories() { + dirfound=false + + echo "Checking if theme is installed..." + echo + + for i in "$@" + do + if [ -d "$i" ]; then + echo "Found $i" + dirfound=true + fi + done + + if [ "$dirfound" = true ]; then + echo + echo "The above directories will be overwritten." + fi + + if [ "$dirfound" = false ]; then + echo "Theme is not installed." + fi +} + +install_theme() { + # Remove current installation + rm -rf $lightdir $darkerdir $darkdir + + # Clean tempdir + rm -rf $tempdir && mkdir $tempdir && cd $tempdir + + # Get the sources + wget $download_url + tar xf master.tar.gz && cd "$theme_name"-master + + # Build and install + ./autogen.sh --prefix=/usr + make install + + # Remove the sources + rm -rf $tempdir + + echo + echo "Installation complete." +} + +# Main part +clear +echo '####################################' +echo '# Arc Theme Install Script #' +echo '####################################' +echo + +#Check available commands +check_command automake wget pkg-config autoconf make tar + +#Check if we are root +check_root + +#Check if theme is installed +check_directories $lightdir $darkerdir $darkdir + +echo +read -r -p "Do you want to continue installation? [y/N] " response +case $response in + [yY][eE][sS]|[yY]) + install_theme + ;; + *) + echo "Aborted by user" + exit 0; + ;; +esac
\ No newline at end of file |