From b1adfe30da122d875ea1f22ca1fa0fdd0032ddf7 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Wed, 7 Oct 2015 20:17:03 -0300 Subject: [PATCH 1/9] Adding new script to upgrade the theme --- arc-theme-upgrade | 19 +++++++++++++++++++ common/Makefile.am | 5 +++++ 2 files changed, 24 insertions(+) create mode 100755 arc-theme-upgrade diff --git a/arc-theme-upgrade b/arc-theme-upgrade new file mode 100755 index 0000000..a394b5a --- /dev/null +++ b/arc-theme-upgrade @@ -0,0 +1,19 @@ +#/!bin/bash + +# Script to upgrade/install the arc-theme + +# Remove previows files +rm -rf /tmp/arc-theme + +git clone https://github.com/horst3180/arc-theme /tmp/arc-theme --depth 1 && cd /tmp/arc-theme + +# 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} + +./autogen.sh --prefix=/usr +sudo make install + +# Remove the sources +rm -rf /tmp/arc-theme \ No newline at end of file diff --git a/common/Makefile.am b/common/Makefile.am index 488c211..0a0e1c8 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -6,6 +6,11 @@ ithemedir = $(DESTDIR)$(themedir) ithemedarkerdir = $(DESTDIR)$(themedarkerdir) ithemedarkdir = $(DESTDIR)$(themedarkdir) +install-exec-hook: + @ echo "Coping/upgrading arc-theme-upgrade script to /usr/bin/" + @ pwd + @ cp -f ../arc-theme-upgrade /usr/bin/ + install-data-local: if ENABLE_LIGHT From d4bb7c4146ee592df1391b238abe0f76e4e786d8 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Wed, 7 Oct 2015 20:30:10 -0300 Subject: [PATCH 2/9] Revemoving unecessary commands --- common/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/common/Makefile.am b/common/Makefile.am index 0a0e1c8..144e43e 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -8,7 +8,6 @@ ithemedarkdir = $(DESTDIR)$(themedarkdir) install-exec-hook: @ echo "Coping/upgrading arc-theme-upgrade script to /usr/bin/" - @ pwd @ cp -f ../arc-theme-upgrade /usr/bin/ install-data-local: From 1e38d4a1ed043f4ba68e290f515d305079bc3d21 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Mon, 2 Nov 2015 21:15:08 -0200 Subject: [PATCH 3/9] Updating the upgrade script --- arc-theme-upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arc-theme-upgrade b/arc-theme-upgrade index a394b5a..c4c796a 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -12,7 +12,8 @@ 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} -./autogen.sh --prefix=/usr +#./autogen.sh --prefix=/usr +./autogen.sh --prefix=/usr --with-gnome=3.16 sudo make install # Remove the sources From 6734cc04390c971554fe93c5e0a2b952c2ca9a88 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Tue, 3 Nov 2015 20:18:05 -0200 Subject: [PATCH 4/9] Fixing some things --- arc-theme-upgrade | 6 +++--- common/Makefile.am | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arc-theme-upgrade b/arc-theme-upgrade index c4c796a..c4f895e 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -1,4 +1,4 @@ -#/!bin/bash +#!/bin/bash # Script to upgrade/install the arc-theme @@ -12,8 +12,8 @@ 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} -#./autogen.sh --prefix=/usr -./autogen.sh --prefix=/usr --with-gnome=3.16 +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 # Remove the sources diff --git a/common/Makefile.am b/common/Makefile.am index 144e43e..ae975c6 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -8,7 +8,7 @@ ithemedarkdir = $(DESTDIR)$(themedarkdir) install-exec-hook: @ echo "Coping/upgrading arc-theme-upgrade script to /usr/bin/" - @ cp -f ../arc-theme-upgrade /usr/bin/ + @ cp -f $(srcdir)/arc-theme-upgrade /usr/bin/ install-data-local: From 3d548a1fd423c40a1b21dd65ec53643129761552 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:22:59 -0200 Subject: [PATCH 5/9] Script changes by horst3180. --- arc-theme-upgrade | 131 +++++++++++++++++++++++++++++++++++++++++----- 1 file 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 From 83f98f4448b13da3bee228b7fcb8efae5f3a5c4e Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:46:03 -0200 Subject: [PATCH 6/9] Adding a question to install the script --- arc-theme-upgrade | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/arc-theme-upgrade b/arc-theme-upgrade index 9558f82..ed58430 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -91,6 +91,24 @@ install_theme() { ./autogen.sh --prefix=/usr make install + # Install this script + if [ ! -f /usr/bin/$(basename $0) ]; then + echo + read -r -p "Do you like to install the $(basename $0) for future upgrades? [y/N] " response + case $response in + [yY][eE][sS]|[yY]) + cp -r arc-theme-upgrade /usr/bin/ + ;; + *) + echo "Aborted by user" + exit 0; + ;; + esac + else + echo "Upgrading the $(basename $0)" + cp -f $(basename $0) /usr/bin/ + fi + # Remove the sources rm -rf $tempdir @@ -124,4 +142,4 @@ case $response in echo "Aborted by user" exit 0; ;; -esac \ No newline at end of file +esac From 05be1c125f4660fc5a1b3ee564895a593fbed28d Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:52:33 -0200 Subject: [PATCH 7/9] Minor improvments --- arc-theme-upgrade | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/arc-theme-upgrade b/arc-theme-upgrade index ed58430..1bf2d8c 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -92,25 +92,28 @@ install_theme() { make install # Install this script - if [ ! -f /usr/bin/$(basename $0) ]; then - echo - read -r -p "Do you like to install the $(basename $0) for future upgrades? [y/N] " response - case $response in - [yY][eE][sS]|[yY]) - cp -r arc-theme-upgrade /usr/bin/ + if [ -f $(basename $0) ]; then + if [ ! -f /usr/bin/$(basename $0) ]; then + echo + read -r -p "Do you like to install the $(basename $0) for future upgrades? [y/N] " response + case $response in + [yY][eE][sS]|[yY]) + echo "Installing $(basename $0) on /usr/bin/" + cp -r arc-theme-upgrade /usr/bin/ + ;; + *) + echo "Aborted by user" + exit 0; ;; - *) - echo "Aborted by user" - exit 0; - ;; - esac - else - echo "Upgrading the $(basename $0)" - cp -f $(basename $0) /usr/bin/ + esac + else + echo "Upgrading $(basename $0)" + cp -f $(basename $0) /usr/bin/ + fi fi # Remove the sources - rm -rf $tempdir + # rm -rf $tempdir echo echo "Installation complete." From ed48197c11ea1f5d759f39e70c313d9999726241 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:55:51 -0200 Subject: [PATCH 8/9] Increased vervosity --- arc-theme-upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arc-theme-upgrade b/arc-theme-upgrade index 1bf2d8c..3571bb5 100755 --- a/arc-theme-upgrade +++ b/arc-theme-upgrade @@ -8,6 +8,9 @@ theme_name=Arc-theme # Theme name download_url=https://github.com/horst3180/$theme_name/archive/master.tar.gz +# for test purporses only (the repo needs to have this script) +# download_url=https://github.com/leoheck/$theme_name/archive/master.tar.gz + # Tempdir tempdir=/tmp/$theme_name @@ -113,7 +116,7 @@ install_theme() { fi # Remove the sources - # rm -rf $tempdir + rm -rf $tempdir echo echo "Installation complete." From a2e5d106e7ab364626f970147e2815b14bb95440 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:59:04 -0200 Subject: [PATCH 9/9] Removed script install commands --- common/Makefile.am | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/Makefile.am b/common/Makefile.am index ae975c6..2ef559f 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -7,8 +7,6 @@ ithemedarkerdir = $(DESTDIR)$(themedarkerdir) ithemedarkdir = $(DESTDIR)$(themedarkdir) install-exec-hook: - @ echo "Coping/upgrading arc-theme-upgrade script to /usr/bin/" - @ cp -f $(srcdir)/arc-theme-upgrade /usr/bin/ install-data-local: