summaryrefslogtreecommitdiff
path: root/extra/coadde/create-repo
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-26 03:33:26 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-26 03:33:26 -0300
commit8eafe04ec5eaf917d9e2d58993604c454f1a26d1 (patch)
treec0e9bb91659c3a1f5814ba94ee251639b52c5873 /extra/coadde/create-repo
parentf17c9169de91036cd4b9bb725d2cc6713ad06ce5 (diff)
re-estructure dbscrips
Diffstat (limited to 'extra/coadde/create-repo')
-rwxr-xr-xextra/coadde/create-repo61
1 files changed, 61 insertions, 0 deletions
diff --git a/extra/coadde/create-repo b/extra/coadde/create-repo
new file mode 100755
index 0000000..c977442
--- /dev/null
+++ b/extra/coadde/create-repo
@@ -0,0 +1,61 @@
+#!/bin/bash
+# Creates repository structure
+
+source "$(dirname "$(readlink -e "$0")")/config_platforms"
+source "$(dirname "$(readlink -e "$0")")/db-functions"
+
+create-repo-usage() {
+ msg "Usage: %s [platform] repo1 [repo2 ... repoX]" "${0##*/}"
+ exit 1
+}
+
+if [ "$#" -eq '0' ]; then
+ create-repo-usage
+fi
+
+for 'platform' in "${PLATFORMS[@]}"; do
+ case "$1" in
+ --platform|-platform|-p)
+
+ # Don't create [--platform], [-platform] or [-p] and [<platforms>] repos
+ _repos=($@) && unset _repos[0] _repos[1]
+
+ # Rename plataform name ($2) to easily script usage
+ _platform_name="${2/\//+}" _platform_name="${_platform_name,,}"
+
+ if [ "${_platform_name}" == "${platform}" ]; then
+ source "$(dirname "$(readlink -e "$0")")/config_${2}"
+
+ msg "Creating repos... from ${PLATFORM_NAME} platform"
+ for '_repo' in "${_repos[@]}"; do
+ msg2 "Creating [%s]" "${_repo_all}"
+ for '_arch' in "${ARCHES[@]}"; do
+ mkdir -p "${REPO_DIR}/${_repo}/os/${_arch}" || \
+ error "Failed creating %s dir" "${_arch}" "from ${PLATFORM_NAME} platform"
+ done
+ done
+
+ msg "Don't forget to add them to the PKG_REPOS array on %s" "$(dirname "$(readlink -e "$0")")/config_${2}"
+ else
+ create-repo-usage
+ fi
+ ;;
+ *)
+ source "$(dirname "$(readlink -e "$0")")/config_${platform}"
+
+ msg "Creating repos... from all platforms"
+ for '_repo_all' in "${@}"; do
+ msg2 "Creating [%s]" "${_repo_all}"
+ for '_arch' in "${ARCHES[@]}"; do
+ mkdir -p "${REPO_DIR}/${_repo_all}/os/${_arch}" || \
+ error "Failed creating %s dir" "${_arch}" "in all platforms"
+ done
+ done
+
+ msg "Don't forget to add them to the PKG_REPOS array on %s" "$(dirname "$(readlink -e "$0")")/config_${platform}"
+ ;;
+ esac
+done
+
+# if [ -n "${MULTILIB_ARCHES}" ]; then
+# fi