summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-26 21:59:31 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-26 21:59:31 -0300
commit1f1896e93d407d269422a4f18e30d1ba29d29595 (patch)
tree8015f47402a5cde575e99ab5e71f8461d9331fca
parent525b9c7f950c305851ec64a920769e5f4b35f995 (diff)
rebuild db-init
-rwxr-xr-xsrc/bin/db-init39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/bin/db-init b/src/bin/db-init
index 1038167..fa989fc 100755
--- a/src/bin/db-init
+++ b/src/bin/db-init
@@ -6,34 +6,23 @@ CONFIG_DIR="$(dirname "$(readlink -e "$0")")/etc"
source "${CONFIG_DIR}/xbs.cfg"
source "${SHARE_DIR}/db-functions"
-db-init_usage() {
- msg "usage: %s [platform1 platform2 ... platformX]" "${0##*/}"
- exit 1
-}
+platforms=("${@:1}")
-db-init_run() {
- mkdir -p -- "${PKG_MAIN_POOLS}" "${SRC_MAIN_POOLS}" "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"
-}
-
-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}/xbs.d/${_platform_name}.cfg"
-
- db-init_run
- else
- db-init-usage
- fi
- done
- else
+for '_platform' in "${PLATFORMS[@]}"; do
+ if [ "${#}" -eq '0' ]; then
source "${CONFIG_DIR}/xbs.d/${platform}.cfg"
-
- db-init_run
+ else
+ # Rename ("${plataform}") to easily script usage
+ _platform_name="${platform/\//+}" _platform_name="${_platforms_name,,}"
+
+ if [ "${_platform_name}" == "${_platform}" ]; then
+ source "${CONFIG_DIR}/xbs.d/${_platform_name}.cfg"
+ else
+ die "This ${plataform} doesn't exist"
+ fi
fi
+
+ mkdir -p -- "${PKG_MAIN_POOLS}" "${SRC_MAIN_POOLS}" "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"
done
# "${BIN_DIR}/db-repo-add" -p "${_platform}" "${PKG_REPOS[@]}"