2014-11-10 02:25:22 +00:00
|
|
|
#!/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
|
|
|
|
|
2015-02-02 00:12:58 +00:00
|
|
|
repo="$1"
|
|
|
|
package="$2"
|
|
|
|
|
|
|
|
[[ -d "${cfg_build_dir}/repos/${repo}/${package}" ]] || {
|
2015-02-02 00:15:08 +00:00
|
|
|
err "Package ${package} doesn't exist in ${cfg_build_dir}/repos/${repo}"
|
2014-11-10 02:25:22 +00:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ -d "${cfg_repos_dir}/${repo}" ]] || {
|
|
|
|
echo "Creating ${cfg_repos_dir}/${repo}"
|
|
|
|
mkdir -p "${cfg_repos_dir}/${repo}" || {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-02 00:50:51 +00:00
|
|
|
echo -n "Building ${repo}/${package}... "
|
2014-11-10 02:25:22 +00:00
|
|
|
|
2015-02-02 00:12:58 +00:00
|
|
|
cd "${cfg_build_dir}/repos/${repo}/${package}"
|
2014-11-10 02:25:22 +00:00
|
|
|
sudo /usr/local/bin/makepkg-chroot.sh "${cfg_build_dir}/${package}.chroot" "${cfg_repos_dir}/${repo}"
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
source 'builder-chroot.cfg.sh'
|
|
|
|
|
2015-02-02 00:12:58 +00:00
|
|
|
for i in "${cfg_build_dir}/repos"/*; do
|
|
|
|
repo_name="${i##*/}"
|
2015-02-02 00:50:10 +00:00
|
|
|
repos+=( "$repo_name" )
|
2015-02-02 00:12:58 +00:00
|
|
|
|
|
|
|
for r in "$i"/*; do
|
2015-02-02 00:16:42 +00:00
|
|
|
build_pkg "$repo_name" "${r##*/}"
|
2015-02-02 00:12:58 +00:00
|
|
|
done
|
2015-02-02 00:50:10 +00:00
|
|
|
done
|
2014-11-10 02:25:22 +00:00
|
|
|
|
2015-02-02 00:50:10 +00:00
|
|
|
for i in "${repos[@]}"; do
|
2015-02-02 01:00:02 +00:00
|
|
|
cd "${cfg_repos_dir}/${i}"
|
2015-02-02 01:02:49 +00:00
|
|
|
repo-add -n "${i}.db.tar.gz" *.pkg.tar.xz
|
2014-11-10 02:25:22 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|