#!/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 [] repos _repos=($@) && unset _repos[0] _repos[1] # Rename plataform name ($2) to easily script usage _platform="${2/\//+}" _platform="${_platform,,}" if [ "${_platform}" == "${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