From a8205bada6ea32e2d2224c896979927c66eaf899 Mon Sep 17 00:00:00 2001
From: Dustin Falgout <dustin@falgout.us>
Date: Sun, 18 Sep 2016 05:50:46 -0500
Subject: [PATCH] update Makefile (moved install commands to utils script)

---
 Makefile         | 24 +++---------------------
 scripts/utils.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 858eb8c..a2395bd 100755
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
 SASS=scss
 SASSFLAGS=--sourcemap=none
 GLIB_COMPILE_RESOURCES=glib-compile-resources
-RES_DIR=gtk-3.0
+RES_DIR=src/gtk-3.0
 SCSS_DIR=$(RES_DIR)/scss
 DIST_DIR=$(RES_DIR)/dist
-RES_DIR320=gtk-3.20
+RES_DIR320=src/gtk-3.20
 SCSS_DIR320=$(RES_DIR320)/scss
 DIST_DIR320=$(RES_DIR320)/dist
 INSTALL_DIR=$(DESTDIR)/usr/share/themes/Numix
@@ -33,25 +33,7 @@ clean:
 	rm -f $(RES_DIR320)/gtk.gresource
 
 install: all
-	install -d -m755 $(INSTALL_DIR)
-
-	mkdir -p			$(INSTALL_DIR)/gtk-3.0
-	mkdir -p			$(INSTALL_DIR)/gtk-3.20
-	cp -pr gtk-2.0			$(INSTALL_DIR)
-	cp -p  gtk-3.0/gtk.css		$(INSTALL_DIR)/gtk-3.0
-	cp -p  gtk-3.0/gtk-dark.css	$(INSTALL_DIR)/gtk-3.0
-	cp -p  gtk-3.0/gtk.gresource	$(INSTALL_DIR)/gtk-3.0
-	cp -p  gtk-3.0/thumbnail.png	$(INSTALL_DIR)/gtk-3.0
-	cp -p  gtk-3.20/gtk.css		$(INSTALL_DIR)/gtk-3.20
-	cp -p  gtk-3.20/gtk-dark.css	$(INSTALL_DIR)/gtk-3.20
-	cp -p  gtk-3.20/gtk.gresource	$(INSTALL_DIR)/gtk-3.20
-	cp -p  gtk-3.20/thumbnail.png	$(INSTALL_DIR)/gtk-3.20
-	cp -pr metacity-1		$(INSTALL_DIR)
-	cp -pr openbox-3		$(INSTALL_DIR)
-	cp -pr xfce-notify-4.0		$(INSTALL_DIR)
-	cp -pr xfwm4			$(INSTALL_DIR)
-	cp -pr unity			$(INSTALL_DIR)
-	cp -p  index.theme		$(INSTALL_DIR)
+	$(UTILS) install $(INSTALL_DIR)
 
 uninstall:
 	rm -rf $(INSTALL_DIR)
diff --git a/scripts/utils.sh b/scripts/utils.sh
index aa28265..11f4306 100755
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -1,5 +1,32 @@
 #!/bin/bash
 
+do_install() {
+	local GTKDIR GTK320DIR GTKVER INSTALL_DIR
+	INSTALL_DIR="$1"
+	GTKDIR="${INSTALL_DIR}/gtk-3.0"
+	GTK320DIR="${INSTALL_DIR}/gtk-3.20"
+
+	install -dm755 "${INSTALL_DIR}"
+
+	for _DIR in "${GTKDIR}" "${GTK320DIR}"
+	do
+		GTKVER="${_DIR##*/}"
+
+		mkdir -p "${_DIR}"
+
+		cp -rT "${INSTALL_DIR}" \
+			gtk-2.0 metacity-1 openbox-3 xfce-notify-4.0 xfwm4 unity
+
+		cp -T "${_DIR}" \
+			"${GTKVER}/gtk.css" \
+			"${GTKVER}/gtk-dark.css" \
+			"${GTKVER}/gtk.gresource" \
+			"${GTKVER}/thumbnail.png" \
+			"${GTKVER}/index.theme"
+	done
+}
+
+
 update_changes_file() {
 	local LATEST_STABLE_RELEASE
 	LATEST_STABLE_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
@@ -18,12 +45,17 @@ update_changes_file() {
 }
 
 
+
 case $1 in
 	changes)
 		update_changes_file
 		exit $?
 	;;
 
+	install)
+		do_install "$2"
+	;;
+
 	*)
 		exit 0
 	;;