summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcreate-repo56
1 files changed, 43 insertions, 13 deletions
diff --git a/create-repo b/create-repo
index dc86722..e390974 100755
--- a/create-repo
+++ b/create-repo
@@ -1,21 +1,51 @@
#!/bin/bash
# Creates repository structure
-. "$(dirname "$(readlink -e "$0")")/config"
-. "$(dirname "$(readlink -e "$0")")/db-functions"
+source "$(dirname "$(readlink -e "$0")")/config_platforms"
+source "$(dirname "$(readlink -e "$0")")/db-functions"
-if [ $# -eq 0 ]; then
- msg "Usage: %s repo1 [repo2 ... repoX]" "${0##*/}"
+create-repo-usage() {
+ msg "Usage: %s [platform] repo1 [repo2 ... repoX]" "${0##*/}"
exit 1
+}
+
+if [ "$#" -eq '0' ]; then
+ create-repo-usage
fi
-msg "Creating repos..."
-for _repo in "$@"; do
- msg2 "Creating [%s]" "${_repo}"
- for _arch in "${ARCHES[@]}"; do
- mkdir -p "${REPO_DIR}/${_repo}/os/${_arch}" || \
- error "Failed creating %s dir" "${_arch}"
- done
-done
+for 'platform' in "${PLATFORMS[@]}"; do
+ case $1 in
+ --platform|-platform|platform|-p)
+ source "$(dirname "$(readlink -e "$0")")/config_${2}"
+
+ _repos=($@) && unset _repos[0] _repos[1]
-msg "Don't forget to add them to the PKGREPOS array on %s" "$(dirname "$(readlink -e "$0")")/config"
+ if [ "$2" == "${platform}" ]; then
+ msg "Creating repos... from $2 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 $2 platform"
+ done
+ done
+ else
+ create-repo-usage
+ fi
+ msg "Don't forget to add them to the PKG_REPOS array on %s" "$(dirname "$(readlink -e "$0")")/config_${2}"
+ ;;
+ *)
+ 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