From b1adfe30da122d875ea1f22ca1fa0fdd0032ddf7 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Wed, 7 Oct 2015 20:17:03 -0300 Subject: Adding new script to upgrade the theme --- arc-theme-upgrade | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 arc-theme-upgrade (limited to '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 -- cgit v1.2.3 From 1e38d4a1ed043f4ba68e290f515d305079bc3d21 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Mon, 2 Nov 2015 21:15:08 -0200 Subject: Updating the upgrade script --- arc-theme-upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arc-theme-upgrade') 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 -- cgit v1.2.3 From 6734cc04390c971554fe93c5e0a2b952c2ca9a88 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Tue, 3 Nov 2015 20:18:05 -0200 Subject: Fixing some things --- arc-theme-upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'arc-theme-upgrade') 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 -- cgit v1.2.3 From 3d548a1fd423c40a1b21dd65ec53643129761552 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:22:59 -0200 Subject: Script changes by horst3180. --- arc-theme-upgrade | 131 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 119 insertions(+), 12 deletions(-) (limited to 'arc-theme-upgrade') 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 -- cgit v1.2.3 From 83f98f4448b13da3bee228b7fcb8efae5f3a5c4e Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:46:03 -0200 Subject: Adding a question to install the script --- arc-theme-upgrade | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'arc-theme-upgrade') 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 -- cgit v1.2.3 From 05be1c125f4660fc5a1b3ee564895a593fbed28d Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:52:33 -0200 Subject: Minor improvments --- arc-theme-upgrade | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'arc-theme-upgrade') 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." -- cgit v1.2.3 From ed48197c11ea1f5d759f39e70c313d9999726241 Mon Sep 17 00:00:00 2001 From: Leandro Heck Date: Thu, 5 Nov 2015 22:55:51 -0200 Subject: Increased vervosity --- arc-theme-upgrade | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arc-theme-upgrade') 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." -- cgit v1.2.3