diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-08-26 16:18:36 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2015-08-26 16:18:36 -0300 |
commit | f792671176115c9bf92f5c3fd312fe94458addb9 (patch) | |
tree | b7104bd0d274324791539c2a42ba1e0cc404e519 | |
parent | 8190d621ec1349b35e7359699ba7d281e98ceae0 (diff) |
porting db-init from xbs
-rw-r--r-- | .gitignore | 4 | ||||
-rwxr-xr-x | extra/legacy/createrepos | 8 | ||||
-rwxr-xr-x | extra/xbs-lukeshu/db-init | 6 | ||||
-rwxr-xr-x | src/bin/db-init | 33 |
4 files changed, 35 insertions, 16 deletions
@@ -5,5 +5,5 @@ test/packages/*/*.pkg.tar.?z \#*# .#* yftime -src* -pkg* +build/src* +build/pkg* diff --git a/extra/legacy/createrepos b/extra/legacy/createrepos deleted file mode 100755 index 8da2455..0000000 --- a/extra/legacy/createrepos +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Creates the repo structure defined in config - -source "$(dirname "$(readlink -e "$0")")/config" - -mkdir -p -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" - -"$(dirname "$(readlink -e "$0")")/create-repo" "${PKGREPOS[@]}" diff --git a/extra/xbs-lukeshu/db-init b/extra/xbs-lukeshu/db-init deleted file mode 100755 index e25dbff..0000000 --- a/extra/xbs-lukeshu/db-init +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -# Creates the repo structure defined in config - -source "$(dirname "$(readlink -e "$0")")/config" - -mkdir -p -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}" 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 |