55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# A simple script to build packages into multiple repos
|
|
|
|
err() { echo "$1" >&2; }
|
|
|
|
build_pkg() {
|
|
declare package repo
|
|
|
|
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"
|
|
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
|
|
|
|
if [[ ! -d "${cfg_repos_dir}/${repo_name}" ]]; then
|
|
echo "Creating ${cfg_repos_dir}/${repo_name}"
|
|
mkdir -p "${cfg_repos_dir}/${repo_name}" || {
|
|
return 1
|
|
}
|
|
fi
|
|
|
|
build_pkg "$package" "$repo_name"
|
|
|
|
cd "${cfg_repos_dir}/${repo_name}"
|
|
|
|
printf 'Cleaning the %s repo...\n' "$repo_name"
|
|
"$HOME/scripts/repo-clean" > repo_clean.log
|
|
|
|
printf 'Signing packages...\n'
|
|
"$HOME/scripts/repo-sign" > repo_sign.log
|
|
|
|
printf 'Adding packages to the %s repo...\n' "$repo_name"
|
|
repo-add -n "${repo_name}.db.tar.gz" *.pkg.tar.xz &> update.log
|
|
|
|
printf 'Done\n'
|
|
}
|
|
|
|
main "$@"
|