[Replicant] [vendor_replicant-release-scripts] [PATCH 3/6] Move set_color in common.sh

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Oct 8 13:48:59 UTC 2021


The set_color function seem to be in releasevars.sh only
because releasevars.sh is sourced from other scripts.

However the file name of releasevars.sh implies that only
release variables related code or variables would be found
in it.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 common.sh      | 27 +++++++++++++++++++++++++++
 releasevars.sh | 13 +------------
 2 files changed, 28 insertions(+), 12 deletions(-)
 create mode 100755 common.sh

diff --git a/common.sh b/common.sh
new file mode 100755
index 0000000..fce719b
--- /dev/null
+++ b/common.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+#
+# Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set_color()
+{
+	if [ "$COLOR" = "1" ] ; then
+		color_start="\033[36m"
+		color_end="\033[0m"
+	else
+		color_start=""
+		color_end=""
+	fi
+}
diff --git a/releasevars.sh b/releasevars.sh
index 8548b96..f2ba2ee 100755
--- a/releasevars.sh
+++ b/releasevars.sh
@@ -14,7 +14,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
+. common.sh
 
 RELEASE=""
 
@@ -90,14 +90,3 @@ SECURITY="$RELEASE_DIR/security"
 SCRIPTS="$RELEASE_DIR/scripts"
 TOOLS="$RELEASE_DIR/tools"
 IMAGES="$RELEASE_DIR/images"
-
-set_color () {
-	if [ "$COLOR" = "1" ]
-	then
-		color_start="\033[36m"
-		color_end="\033[0m"
-	else
-		color_start=""
-		color_end=""
-	fi
-}
-- 
2.33.0



More information about the Replicant mailing list