Browse Source

build.sh: rework build info file creation

Karsten Böddeker 6 years ago
parent
commit
f1b76a1c96
1 changed files with 13 additions and 14 deletions
  1. 13 14
      build.sh

+ 13 - 14
build.sh

@@ -170,19 +170,18 @@ fi
 popd > /dev/null #${CODE_DIR}
 
 # we are now ready to produce the firmware images, so let's "save" our state
-build_info_path="${VERSIONS_DIR}/${VERSION}"
-progress "Saving build information to: ${build_info_path}"
-[ -n "${build_info_path}" -a -f "${build_info_path}" ] && rm -f ${build_info_path}
-mkdir -p $(dirname ${build_info_path})
-[ "$?" -eq "0" ] || abort "Unable to create output directory: $(dirname ${build_info_path})"
-touch $(dirname ${build_info_path})
-[ "$?" -eq "0" ] || abort "Cannot create build information file: ${build_info_path}"
-echo "VERSION=${VERSION}" >> ${build_info_path}
-echo "GLUON=${GLUON_COMMIT} # ${BASE}" >> ${build_info_path}
-echo "BRANCH=${BRANCH}" >> ${build_info_path}
-echo "SITE=${SITE_COMMIT} # ${SITE}" >> ${build_info_path}
-echo "TARGETS='${TARGETS}'" >> ${build_info_path}
-echo "TS=${BUILD_TS}" >> ${build_info_path}
+BUILD_INFO="${VERSIONS_DIR}/${VERSION}"
+progress "Saving build information to: ${BUILD_INFO}"
+mkdir -p ${VERSIONS_DIR}
+[ "$?" -eq "0" ] || abort "Unable to create output directory: ${VERSIONS_DIR}"
+touch ${BUILD_INFO}
+[ "$?" -eq "0" ] || abort "Cannot create build information file: ${BUILD_INFO}"
+echo "VERSION='${VERSION}'"              >  ${BUILD_INFO}
+echo "GLUON='${GLUON_COMMIT}' # ${BASE}" >> ${BUILD_INFO}
+echo "BRANCH='${BRANCH}'"                >> ${BUILD_INFO}
+echo "SITE='${SITE_COMMIT}'  # ${SITE}"  >> ${BUILD_INFO}
+echo "TARGETS='${TARGETS}'"              >> ${BUILD_INFO}
+echo "TS='${BUILD_TS}'"                  >> ${BUILD_INFO}
 
 ### restore opkg-keys
 if [ -e "${KEY_DIR}" ]; then
@@ -254,7 +253,7 @@ if [ "${PUBLISH}" -eq "1" ]; then
 	git merge --ff-only origin/master
 	mkdir -p "${OUTPUT_DIR}/${VERSION}/sysupgrade"
 	cp -f "${MANIFEST_DIR}/${BRANCH}.manifest" "${OUTPUT_DIR}/${VERSION}/sysupgrade/"
-	cp -f "${build_info_path}" "${OUTPUT_DIR}/${VERSION}/${BUILD_INFO_FILENAME}"
+	cp -f "${BUILD_INFO}" "${OUTPUT_DIR}/${VERSION}/${BUILD_INFO_FILENAME}"
 	popd > /dev/null #${OUTPUT_DIR}
 
 	# Update symlinks