49 lines
1023 B
Bash
Executable File
49 lines
1023 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# A simple script to build packages into multiple repos
|
|
|
|
err() { echo "$1" >&2; }
|
|
|
|
build_pkg() {
|
|
local makepkg_output makepkg_exit_code makepkg_status
|
|
|
|
repo="$1"
|
|
package="$2"
|
|
|
|
[[ -d "${cfg_build_dir}/repos/${repo}/${package}" ]] || {
|
|
err "Package ${package} doesn't exist in ${cfg_build_dir}/repos/${repo}"
|
|
return 1
|
|
}
|
|
|
|
[[ -d "${cfg_repos_dir}/${repo}" ]] || {
|
|
echo "Creating ${cfg_repos_dir}/${repo}"
|
|
mkdir -p "${cfg_repos_dir}/${repo}" || {
|
|
return 1
|
|
}
|
|
}
|
|
|
|
echo -n "Building ${repo}/${package}... "
|
|
|
|
cd "${cfg_build_dir}/repos/${repo}/${package}"
|
|
sudo /usr/local/bin/makepkg-chroot.sh "${cfg_build_dir}/${package}.chroot" "${cfg_repos_dir}/${repo}"
|
|
}
|
|
|
|
main() {
|
|
source 'builder-chroot.cfg.sh'
|
|
|
|
for i in "${cfg_build_dir}/repos"/*; do
|
|
repo_name="${i##*/}"
|
|
repos+=( "$repo_name" )
|
|
|
|
for r in "$i"/*; do
|
|
build_pkg "$repo_name" "${r##*/}"
|
|
done
|
|
done
|
|
|
|
for i in "${repos[@]}"; do
|
|
cd "${cfg_repos_dir}/${i}"
|
|
repo-add -n "${repo_name}.db.tar.gz" *.pkg.tar.xz
|
|
done
|
|
}
|
|
|
|
main
|