Browse Source

some reordering of initialization

Karsten Böddeker 6 years ago
parent
commit
0f78f4ff42
1 changed files with 15 additions and 10 deletions
  1. 15 10
      build.sh

+ 15 - 10
build.sh

@@ -70,19 +70,17 @@ else
 	KEY_DIR="${DEFAULT_KEY_DIR}"
 fi
 
-if [ -n "${VERSIONS_DIR}" ]; then
-	VERSIONS_DIR=$(readlink -f "${VERSIONS_DIR}")
-else
-	VERSIONS_DIR="${DEFAULT_VERSIONS_DIR}"
-fi
-[ -e "${VERSIONS_DIR}" ] || mkdir -p ${VERSIONS_DIR}
-[ "$?" -eq "0" ] || abort "Unable to create versions directory: ${VERSIONS_DIR}"
-
 [ -n "${MAKEJOBS}" ] || MAKEJOBS=$(grep -c "^processor" /proc/cpuinfo)
 [ -n "${PRIORITY}" ] || PRIORITY=0
 [ -n "${PUBLISH}" ] || PUBLISH=0
 [ -n "${VERBOSE}" ] || VERBOSE=0
 
+if [ -n "${VERSIONS_DIR}" ]; then
+        VERSIONS_DIR=$(readlink -f "${VERSIONS_DIR}")
+else
+        VERSIONS_DIR="${DEFAULT_VERSIONS_DIR}"
+fi
+
 MAKE_PARAM=""
 [ "${VERBOSE}" -eq "1" ] && MAKE_PARAM="${MAKE_PARAM} V=s"
 
@@ -93,14 +91,21 @@ MAKE_PARAM=""
 [ -n "${VERSION}" -o "${BRANCH}" == "experimental" ] || abort "Please specify VERSION environment variable (not necessary for experimental branch)."
 [ "${BRANCH}" == "experimental" -o ! -r "${VERSIONS_DIR}/${VERSION}" ] || abort "There exists a version file for '${VERSION}' ... you are trying to do something really stupid, aren't you?"
 
-### INIT /src IF NECESSARY
+### init VERSIONS_DIR if necessary
+if [ ! -d "${VERSIONS_DIR}" ]; then
+	info "Versions directory does not exist yet - creating it ..."
+	mkdir -p ${VERSIONS_DIR}
+	[ "$?" -eq "0" ] || abort "Unable to create versions directory: ${VERSIONS_DIR}"
+fi
+
+### init CODE_DIR if necessary
 if [ ! -d "${CODE_DIR}" ]; then
 	info "Code directory does not exist yet - fetching Gluon ..."
 	git clone https://github.com/freifunk-gluon/gluon.git "${CODE_DIR}"
 	[ "$?" -eq "0" ] || abort "Failed to fetch Gluon repository."
 fi
 
-### INIT /src/site IF NECESSARY
+### init SITE_DIR if necessary
 if [ ! -d "${SITE_DIR}" ]; then
 	info "Site repository does not exist, fetching it ..."
 	git clone "${SITE_REPO_URL}" "${SITE_DIR}"