summaryrefslogtreecommitdiff
path: root/extra/coadde/createrepos
blob: 4416196160ac4b53dfa252f82abb7e2dd77fb6ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# Creates the repo structure defined in config

source "$(dirname "$(readlink -e "$0")")/config_platforms"
source "$(dirname "$(readlink -e "$0")")/db-functions"

createrepos-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 "$(dirname "$(readlink -e "$0")")/config_${_platform}"

				mkdir -p -- "${REPO_DIR}"/{"${PKG_POOL}","${SRC_POOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"

				"$(dirname "$(readlink -e "$0")")/create-repo" -p "${_platform}" "${PKG_REPOS[@]}"
			else
				createrepos-usage
			fi
		done
	else
		source "$(dirname "$(readlink -e "$0")")/config_${platform}"

		mkdir -p -- "${REPO_DIR}"/{"${PKG_POOL}","${SRC_POOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR}" "${STAGING}"

		"$(dirname "$(readlink -e "$0")")/create-repo" "${PKG_REPOS[@]}"
		;;
	fi
done