#!/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(){ check_build "$1" cd $1 source PKGBUILD for n in ${pkgname[@]}; do msg2 "%s" "$n" done cd .. } display_settings(){ show_version show_config msg "PROFILE:" msg2 "list_dir_pkg: %s" "${list_dir_pkg}" msg2 "build_lists: %s" "$(show_build_lists ${list_dir_pkg})" msg2 "build_list_pkg: %s" "${build_list_pkg}" msg2 "is_build_list: %s" "${is_build_list}" msg2 "build_mirror: %s" "${build_mirror}/${target_branch}" # msg2 "make_conf_dir: %s" "${make_conf_dir}" # msg2 "build_profiles: %s" "$(show_build_profiles ${make_conf_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 "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 "${build_list_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_build_list=false sign=false udev_root=false is_multilib=false usage() { echo "Usage: ${0##*/} [options]" echo " -p Build list or pkg [default: ${build_list_pkg}]" echo " -a Arch [default: ${target_arch}]" echo " -b Branch [default: ${target_branch}]" echo ' -r Chroots directory' echo " [default: ${chroots_pkg}]" echo ' -i 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) build_list_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 check_root "$0" "${orig_argv[@]}" prepare_conf "${target_arch}" mirrors_conf=$(get_pac_mirrors_conf "${target_branch}") mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}") mkchrootpkg_args+=(-r ${work_dir}) timer_start=$(get_timer) eval_build_list "${list_dir_pkg}" "${build_list_pkg}" prepare_dir "${pkg_dir}" init_base_devel ${pretend} && display_settings && exit ${wipe_clean} && clean_up chroot_init run make_pkg "${build_list_pkg}"