2014-10-04 00:46:40 +02:00
|
|
|
#!/bin/bash
|
2014-10-08 11:11:19 +02:00
|
|
|
#
|
2014-10-04 15:41:22 +02:00
|
|
|
# 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.
|
|
|
|
|
2014-10-08 13:14:28 +02:00
|
|
|
version=@version@
|
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
shopt -s nullglob
|
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
LIBDIR='@libdir@'
|
2015-12-08 12:33:28 +01:00
|
|
|
DATADIR='@datadir@'
|
2014-12-14 03:48:46 +01:00
|
|
|
SYSCONFDIR='@sysconfdir@'
|
|
|
|
|
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
2015-06-09 00:01:31 +02:00
|
|
|
|
|
|
|
import ${LIBDIR}/util.sh
|
2015-06-12 03:25:28 +02:00
|
|
|
import ${LIBDIR}/util-pkg.sh
|
2017-03-27 18:07:26 +02:00
|
|
|
import ${LIBDIR}/util-pkg-chroot.sh
|
2014-11-13 13:33:38 +01:00
|
|
|
|
2015-11-28 17:37:13 +01:00
|
|
|
show_pkg(){
|
2016-09-15 23:58:18 +02:00
|
|
|
check_build "$1"
|
|
|
|
cd $1
|
|
|
|
source PKGBUILD
|
|
|
|
for n in ${pkgname[@]}; do
|
|
|
|
msg2 "%s" "$n"
|
|
|
|
done
|
|
|
|
cd ..
|
2015-02-14 11:06:20 +01:00
|
|
|
}
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
display_settings(){
|
2016-09-15 23:58:18 +02:00
|
|
|
show_version
|
|
|
|
show_config
|
|
|
|
|
|
|
|
msg "PROFILE:"
|
|
|
|
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}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: %s" "${target_arch}"
|
|
|
|
msg2 "branch: %s" "${target_branch}"
|
|
|
|
msg2 "chroots_pkg: %s" "${chroots_pkg}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2016-06-09 21:58:18 +02:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
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}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
msg "PATHS:"
|
|
|
|
msg2 "pkg_dir: %s" "${pkg_dir}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
if ${clean_first};then
|
|
|
|
msg "PKG:"
|
|
|
|
msg2 "base_packages: %s" "${base_packages[*]}"
|
|
|
|
fi
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
msg "BUILD QUEUE:"
|
|
|
|
run show_pkg "${build_list_pkg}"
|
2014-11-16 23:18:01 +01:00
|
|
|
}
|
|
|
|
|
2015-01-13 13:41:28 +01:00
|
|
|
load_user_info
|
2014-12-14 03:48:46 +01:00
|
|
|
|
2016-06-14 17:54:44 +02:00
|
|
|
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
|
|
|
load_vars "$USER_HOME/.makepkg.conf" || load_vars /etc/makepkg.conf
|
2014-11-14 23:33:53 +01:00
|
|
|
|
2015-05-29 00:31:59 +02:00
|
|
|
install_pkgs=()
|
2014-10-08 11:11:19 +02:00
|
|
|
|
2014-11-13 00:19:49 +01:00
|
|
|
clean_first=false
|
2014-11-13 01:53:11 +01:00
|
|
|
wipe_clean=false
|
2014-10-04 00:46:40 +02:00
|
|
|
namcap=false
|
|
|
|
pretend=false
|
2016-06-09 18:03:38 +02:00
|
|
|
is_build_list=false
|
2014-10-06 23:35:01 +02:00
|
|
|
sign=false
|
2015-10-22 12:09:00 +02:00
|
|
|
udev_root=false
|
2016-06-09 08:12:24 +02:00
|
|
|
is_multilib=false
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
usage() {
|
2016-09-15 23:58:18 +02:00
|
|
|
echo "Usage: ${0##*/} [options]"
|
|
|
|
echo " -p <pkg> Build list or pkg [default: ${build_list_pkg}]"
|
|
|
|
echo " -a <arch> Arch [default: ${target_arch}]"
|
|
|
|
echo " -b <branch> Branch [default: ${target_branch}]"
|
|
|
|
echo ' -r <dir> Chroots directory'
|
|
|
|
echo " [default: ${chroots_pkg}]"
|
2017-02-21 18:34:07 +01:00
|
|
|
echo ' -i <pkgs> Install packages into the working copy of the chroot'
|
2016-09-15 23:58:18 +02:00
|
|
|
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
|
2014-10-04 00:46:40 +02:00
|
|
|
}
|
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
orig_argv=("$@")
|
|
|
|
|
2015-10-22 12:09:00 +02:00
|
|
|
opts='p:a:b:r:i:cwnsuqh'
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
2016-09-15 23:58:18 +02:00
|
|
|
case "${arg}" in
|
|
|
|
p) build_list_pkg="$OPTARG" ;;
|
|
|
|
a) target_arch="$OPTARG" ;;
|
|
|
|
b) target_branch="$OPTARG" ;;
|
|
|
|
r) chroots_pkg="$OPTARG" ;;
|
2017-02-21 18:34:07 +01:00
|
|
|
i) install_pkgs+=("$OPTARG"); mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;;
|
2016-09-15 23:58:18 +02:00
|
|
|
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
|
2014-10-04 00:46:40 +02:00
|
|
|
done
|
|
|
|
|
2016-06-11 20:32:03 +02:00
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2016-06-09 10:54:09 +02:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
|
|
|
|
2016-06-19 22:39:46 +02:00
|
|
|
prepare_dir "${log_dir}"
|
|
|
|
|
2017-10-23 23:31:50 +02:00
|
|
|
user_own "${log_dir}"
|
|
|
|
|
2016-06-11 20:38:44 +02:00
|
|
|
prepare_dir "${tmp_dir}"
|
|
|
|
|
2016-06-09 08:12:24 +02:00
|
|
|
prepare_conf "${target_arch}"
|
|
|
|
|
|
|
|
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2016-06-08 23:33:05 +02:00
|
|
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${target_branch}")
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2015-01-13 01:32:31 +01:00
|
|
|
mkchrootpkg_args+=(-r ${work_dir})
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2015-02-18 20:08:59 +01:00
|
|
|
timer_start=$(get_timer)
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
eval_build_list "${list_dir_pkg}" "${build_list_pkg}"
|
2014-11-13 22:43:07 +01:00
|
|
|
|
2015-12-01 13:05:46 +01:00
|
|
|
prepare_dir "${pkg_dir}"
|
|
|
|
|
2016-09-15 00:33:42 +02:00
|
|
|
user_own "${pkg_dir}"
|
2016-07-24 20:15:48 +02:00
|
|
|
|
2015-10-22 12:09:00 +02:00
|
|
|
init_base_devel
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
${pretend} && display_settings && exit
|
|
|
|
|
|
|
|
${wipe_clean} && clean_up
|
|
|
|
|
2015-12-01 12:35:41 +01:00
|
|
|
chroot_init
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
run make_pkg "${build_list_pkg}"
|