blob: 710f24b96b3954165f34e25d1e16f515bddbcdc4 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/bin/bash
CONFIG_DIR="$(dirname "$(readlink -e "${0}")")/etc"
source "${CONFIG_DIR}/xbs.cfg"
source "${SHARE_DIR}/db-functions"
if [ "${#}" -lt '4' ]; then
msg "usage: %s <platform> <repo> <arch> <pkg_file> ..." "${0##*/}"
exit 1
fi
plataform="${1}"
repo="${2}"
arch="${3}"
pkg_files=("${@:4}")
for '_platform' in "${PLATFORMS[@]}"; do
# Rename ("${plataform}") to easily script usage
_platform_name="${plataform/\//+}" _platform_name="${_platform_name,,}"
if [ "${_platform_name}" == "${_platform}" ]; then
source "${CONFIG_DIR}/xbs.d/${_platform}.cfg"
repo_path="${REPO_DIR}/${repo}/os"
if ! check_repo_permission "${repo}"; then
die "You don't have permission to add packages to %s" "${repo}"
fi
if [ "${arch}" == "{any}" ]; then
tarches=("${ARCHES[@]}")
else
tarches=("${arch}")
fi
for 'tarch' in "${tarches[@]}"; do
if [[ ! -d "${repo_path} ]]; then
die "This [%s] doesn't exist" "${repo}"
elif [[ ! -d "${repo_path}/${tarch}" ]]; then
die "This [%s] doesn't support %s archictecture" "${repo}" "${arch}"
else
repo_lock "${repo}" "${tarch}" || exit 1
fi
done
for 'tarch' in "${tarches[@]}"; do
for 'pkg_file' in "${pkg_files[@]}"; do
if [[ ! -f "${repo_path}/${arch}/${pkg_file##*/}" ]]; then
die "Package file %s not found in %s" "${pkg_file##*/}" "${repo_path}/${arch}/"
else
msg "Adding %s to [%s]..." "${pkg_file}" "${repo}"
fi
done
pkg_repo_add "${repo}" "${tarch}" "${pkg_files[@]}"
repo_unlock "${repo}" "${tarch}"
done
else
die "This %s plataform doesn't exist" "${plataform}"
fi
done
|