forked from mirrored-repos/manjaro-tools
161 lines
4 KiB
Bash
161 lines
4 KiB
Bash
#!/bin/bash
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
|
|
version=@version@
|
|
|
|
shopt -s nullglob
|
|
|
|
LIBDIR='@libdir@'
|
|
DATADIR='@datadir@'
|
|
SYSCONFDIR='@sysconfdir@'
|
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
|
|
|
import ${LIBDIR}/util.sh
|
|
import ${LIBDIR}/util-pkg.sh
|
|
|
|
show_pkg(){
|
|
cd $1
|
|
source PKGBUILD
|
|
for n in ${pkgname[@]}; do
|
|
msg2 "%s" "$n"
|
|
done
|
|
cd ..
|
|
}
|
|
|
|
display_settings(){
|
|
show_version
|
|
show_config
|
|
|
|
msg "PROFILE:"
|
|
msg2 "sets_dir_pkg: %s" "${sets_dir_pkg}"
|
|
msg2 "buildsets: %s" "$(list_sets ${sets_dir_pkg})"
|
|
msg2 "buildset_pkg: %s" "${buildset_pkg}"
|
|
msg2 "is_buildset: %s" "${is_buildset}"
|
|
msg2 "pkgarch_dir: %s" "${pkgarch_dir}"
|
|
|
|
msg "OPTIONS:"
|
|
msg2 "arch: %s" "${target_arch}"
|
|
msg2 "branch: %s" "${target_branch}"
|
|
msg2 "chroots_pkg: %s" "${chroots_pkg}"
|
|
|
|
msg "ARGS:"
|
|
msg2 "clean_first: %s" "${clean_first}"
|
|
msg2 "wipe_clean: %s" "${wipe_clean}"
|
|
msg2 "namcap: %s" "${namcap}"
|
|
msg2 "sign: %s" "${sign}"
|
|
msg2 "udev_root: %s" "${udev_root}"
|
|
# msg2 "mkchroot_args: %s" "${mkchroot_args[*]}"
|
|
|
|
msg "PATHS:"
|
|
msg2 "work_dir: %s" "${work_dir}"
|
|
msg2 "pkg_dir: %s" "${pkg_dir}"
|
|
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
|
|
msg2 "mirrors_conf: %s" "${mirrors_conf}"
|
|
msg2 "pacman_conf: %s" "${pacman_conf}"
|
|
msg2 "makepkg_conf: %s" "${makepkg_conf}"
|
|
|
|
if ${clean_first};then
|
|
msg "PKG:"
|
|
msg2 "base_packages: %s" "${base_packages[*]}"
|
|
fi
|
|
|
|
msg "BUILD QUEUE:"
|
|
run show_pkg "${buildset_pkg}"
|
|
}
|
|
|
|
load_user_info
|
|
|
|
load_config "${USERCONFDIR}/manjaro-tools.conf"
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
|
|
|
load_vars "$USER_HOME/.makepkg.conf"
|
|
load_vars /etc/makepkg.conf
|
|
|
|
install_pkgs=()
|
|
|
|
clean_first=false
|
|
wipe_clean=false
|
|
namcap=false
|
|
pretend=false
|
|
is_buildset=false
|
|
sign=false
|
|
udev_root=false
|
|
is_multilib=false
|
|
|
|
usage() {
|
|
echo "Usage: ${0##*/} [options]"
|
|
echo " -p <pkg> Buildset or pkg [default: ${buildset_pkg}]"
|
|
echo " -a <arch> Arch [default: ${target_arch}]"
|
|
echo " -b <branch> Branch [default: ${target_branch}]"
|
|
echo ' -r <dir> Chroots directory'
|
|
echo " [default: ${chroots_pkg}]"
|
|
echo ' -i <pkg> Install a package into the working copy of the chroot'
|
|
echo ' -c Recreate chroot'
|
|
echo ' -w Clean up cache and sources'
|
|
echo ' -n Install and run namcap check'
|
|
echo ' -s Sign packages'
|
|
echo ' -u Udev base-devel group (no systemd)'
|
|
echo ' -q Query settings and pretend build'
|
|
echo ' -h This help'
|
|
echo ''
|
|
echo ''
|
|
exit $1
|
|
}
|
|
|
|
orig_argv=("$@")
|
|
|
|
opts='p:a:b:r:i:cwnsuqh'
|
|
|
|
while getopts "${opts}" arg; do
|
|
case "${arg}" in
|
|
p) buildset_pkg="$OPTARG" ;;
|
|
a) target_arch="$OPTARG" ;;
|
|
b) target_branch="$OPTARG" ;;
|
|
r) chroots_pkg="$OPTARG" ;;
|
|
i) install_pkgs+="$OPTARG"; mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;;
|
|
c) clean_first=true ;;
|
|
w) wipe_clean=true ;;
|
|
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
|
s) sign=true ;;
|
|
u) udev_root=true ;;
|
|
q) pretend=true ;;
|
|
h|?) usage 0 ;;
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
esac
|
|
done
|
|
|
|
prepare_conf "${target_arch}"
|
|
|
|
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
|
makepkg_conf=$(get_makepkg_conf "${target_arch}")
|
|
|
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}")
|
|
|
|
mkchrootpkg_args+=(-r ${work_dir})
|
|
|
|
check_root "$0" "${orig_argv[@]}"
|
|
|
|
timer_start=$(get_timer)
|
|
|
|
eval_buildset "${sets_dir_pkg}" "${buildset_pkg}"
|
|
|
|
prepare_dir "${pkg_dir}"
|
|
|
|
init_base_devel
|
|
|
|
${pretend} && display_settings && exit
|
|
|
|
${wipe_clean} && clean_up
|
|
|
|
chroot_init
|
|
|
|
run make_pkg "${buildset_pkg}"
|