Jelajahi Sumber

Add source_conf to the installer we don't load main.sh in the installer (#3939)

Jaap Marcus 2 tahun lalu
induk
melakukan
7f18bb4652
2 mengubah file dengan 26 tambahan dan 0 penghapusan
  1. 13 0
      install/hst-install-debian.sh
  2. 13 0
      install/hst-install-ubuntu.sh

+ 13 - 0
install/hst-install-debian.sh

@@ -113,6 +113,19 @@ check_result() {
 	fi
 }
 
+# Source conf in installer
+source_conf() {
+	while IFS='= ' read -r lhs rhs; do
+		if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then
+			rhs="${rhs%%^\#*}" # Del in line right comments
+			rhs="${rhs%%*( )}" # Del trailing spaces
+			rhs="${rhs%\'*}"   # Del opening string quotes
+			rhs="${rhs#\'*}"   # Del closing string quotes
+			declare -g $lhs="$rhs"
+		fi
+	done < $1
+}
+
 # Defining function to set default value
 set_default_value() {
 	eval variable=\$$1

+ 13 - 0
install/hst-install-ubuntu.sh

@@ -113,6 +113,19 @@ check_result() {
 	fi
 }
 
+# Source conf in installer
+source_conf() {
+	while IFS='= ' read -r lhs rhs; do
+		if [[ ! $lhs =~ ^\ *# && -n $lhs ]]; then
+			rhs="${rhs%%^\#*}" # Del in line right comments
+			rhs="${rhs%%*( )}" # Del trailing spaces
+			rhs="${rhs%\'*}"   # Del opening string quotes
+			rhs="${rhs#\'*}"   # Del closing string quotes
+			declare -g $lhs="$rhs"
+		fi
+	done < $1
+}
+
 # Defining function to set default value
 set_default_value() {
 	eval variable=\$$1