#!/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|platform|-p) source "$(dirname "$(readlink -e "$0")")/config_${2}" _repos=($@) && unset _repos[0] _repos[1] 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