From f792671176115c9bf92f5c3fd312fe94458addb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?coadde=20=5BM=C3=A1rcio=20Alexandre=20Silva=20Delgado=5D?= Date: Wed, 26 Aug 2015 16:18:36 -0300 Subject: porting db-init from xbs --- src/bin/db-init | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 src/bin/db-init (limited to 'src/bin') diff --git a/src/bin/db-init b/src/bin/db-init new file mode 100755 index 0000000..181e5bf --- /dev/null +++ b/src/bin/db-init @@ -0,0 +1,33 @@ +#!/bin/bash +# Creates the repo structure defined in config + +CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc" + +source "${CONFIG_DIR}/dbscripts.cfg" +source "${CONFIG_DIR}/dbscripts.d/db-functions" + +db-init-usage() { + msg "Usage: %s [platform1 platform2 ... platformX]" "${0##*/}" + exit 1 +} + +for 'platform' in "${PLATFORMS[@]}"; do + if [ -n $1 ]; then + for '_platform' in "$@"; do + # Rename plataform name ($_platform) to easily script usage + _platform_name="${_platform/\//+}" _platform_name="${_platform_name,,}" + + if [ "${_platform_name}" == "${platform}" ]; then + source "${CONFIG_DIR}/dbscripts.d/${_platform_name}.cfg" + + mkdir -p -- "${REPO_DIR}"/{"${PKG_POOL}","${SRC_POOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" + else + db-init-usage + fi + done + else + source "${CONFIG_DIR}/dbscripts.d/${platform}.cfg" + + mkdir -p -- "${REPO_DIR}"/{"${PKG_POOL}","${SRC_POOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" + fi +done -- cgit v1.2.3-2-g168b