2015-06-01 11:24:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# A simple script to build packages into multiple repos
|
|
|
|
|
|
|
|
err() { echo "$1" >&2; }
|
|
|
|
|
|
|
|
build_pkg() {
|
2015-06-01 11:45:06 +00:00
|
|
|
declare package repo
|
2015-06-01 11:24:42 +00:00
|
|
|
|
|
|
|
package="$1"
|
|
|
|
repo="$2"
|
|
|
|
|
|
|
|
echo -n "Building ${repo}/${package}... "
|
|
|
|
|
|
|
|
cd "/tmp/build-${package}"
|
|
|
|
sudo /usr/local/bin/makepkg-chroot.sh "${cfg_build_dir}/${package}.chroot" "${cfg_repos_dir}/${repo}"
|
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
|
|
|
source 'builder-chroot.cfg'
|
|
|
|
|
|
|
|
package="$1"
|
2015-06-01 11:49:49 +00:00
|
|
|
repo_name="$2"
|
|
|
|
|
|
|
|
# if [[ -f "/tmp/build-${package}/.spark.repo" ]]; then
|
|
|
|
# repo_name=$( <"/tmp/build-${package}/.spark.repo" )
|
|
|
|
# else
|
|
|
|
# err "Repo not specified, not building package."
|
|
|
|
# return 1
|
|
|
|
# fi
|
2015-06-01 11:24:42 +00:00
|
|
|
|
2015-06-01 11:39:07 +00:00
|
|
|
if [[ ! -d "${cfg_repos_dir}/${repo_name}" ]]; then
|
2015-06-01 11:45:06 +00:00
|
|
|
echo "Creating ${cfg_repos_dir}/${repo_name}"
|
|
|
|
mkdir -p "${cfg_repos_dir}/${repo_name}" || {
|
2015-06-01 11:39:07 +00:00
|
|
|
return 1
|
|
|
|
}
|
|
|
|
fi
|
|
|
|
|
2015-06-01 11:43:35 +00:00
|
|
|
build_pkg "$package" "$repo_name"
|
|
|
|
|
2015-06-01 11:30:57 +00:00
|
|
|
cd "${cfg_repos_dir}/${repo_name}"
|
2015-08-11 15:33:17 +00:00
|
|
|
|
|
|
|
printf 'Cleaning the %s repo...\n' "%s"
|
2015-08-11 15:29:11 +00:00
|
|
|
"$HOME/scripts/repo-clean" > repo_clean.log
|
2015-08-11 15:33:17 +00:00
|
|
|
|
|
|
|
printf 'Signing packages...\n'
|
2015-08-11 15:29:11 +00:00
|
|
|
"$HOME/scripts/repo-sign" > repo_sign.log
|
2015-08-11 15:33:17 +00:00
|
|
|
|
|
|
|
printf 'Adding packages to the %s repo...\n' "%s"
|
2015-06-26 14:37:13 +00:00
|
|
|
repo-add -n "${repo_name}.db.tar.gz" *.pkg.tar.xz &> update.log
|
2015-08-11 15:33:17 +00:00
|
|
|
|
|
|
|
printf 'Done\n'
|
2015-06-01 11:24:42 +00:00
|
|
|
}
|
|
|
|
|
2015-06-01 11:27:29 +00:00
|
|
|
main "$@"
|