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
|
2014-11-13 13:33:38 +01:00
|
|
|
|
2015-11-28 17:37:13 +01:00
|
|
|
show_pkg(){
|
|
|
|
cd $1
|
|
|
|
source PKGBUILD
|
|
|
|
for n in ${pkgname[@]}; do
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "%s" "$n"
|
2015-02-14 11:06:20 +01:00
|
|
|
done
|
2015-11-28 17:37:13 +01:00
|
|
|
cd ..
|
2015-02-14 11:06:20 +01:00
|
|
|
}
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
display_settings(){
|
2015-05-22 16:52:25 +02:00
|
|
|
show_version
|
|
|
|
show_config
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "PROFILE:"
|
2016-02-15 16:30:59 +01:00
|
|
|
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}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "OPTIONS:"
|
2016-06-06 20:08:09 +02:00
|
|
|
msg2 "arch: %s" "${target_arch}"
|
|
|
|
msg2 "branch: %s" "${target_branch}"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "chroots_pkg: %s" "${chroots_pkg}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "ARGS:"
|
2016-02-15 16:30:59 +01:00
|
|
|
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}"
|
2016-02-16 00:19:19 +01:00
|
|
|
# msg2 "mkchroot_args: %s" "${mkchroot_args[*]}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "PATHS:"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "work_dir: %s" "${work_dir}"
|
|
|
|
msg2 "pkg_dir: %s" "${pkg_dir}"
|
2016-06-06 20:08:09 +02:00
|
|
|
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
|
2016-06-07 10:23:35 +02:00
|
|
|
msg2 "pacman_conf: %s" "${pacman_conf}"
|
|
|
|
msg2 "makepkg_conf: %s" "${makepkg_conf}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
if ${clean_first};then
|
|
|
|
msg "PKG:"
|
2016-02-15 16:30:59 +01:00
|
|
|
msg2 "base_packages: %s" "${base_packages[*]}"
|
2015-02-13 15:17:00 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
msg "BUILD QUEUE:"
|
2015-11-28 17:37:13 +01:00
|
|
|
run show_pkg "${buildset_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
|
|
|
|
2015-12-08 12:33:28 +01:00
|
|
|
load_config "${USERCONFDIR}/manjaro-tools.conf"
|
2014-12-14 03:48:46 +01:00
|
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2014-12-08 22:58:38 +01:00
|
|
|
load_vars "$USER_HOME/.makepkg.conf"
|
2014-11-14 23:33:53 +01:00
|
|
|
load_vars /etc/makepkg.conf
|
|
|
|
|
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
|
2015-01-14 22:29:46 +01:00
|
|
|
is_buildset=false
|
2014-10-06 23:35:01 +02:00
|
|
|
sign=false
|
2015-10-22 12:09:00 +02:00
|
|
|
udev_root=false
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
usage() {
|
2015-11-28 17:37:13 +01:00
|
|
|
echo "Usage: ${0##*/} [options]"
|
2015-02-13 15:17:00 +01:00
|
|
|
echo " -p <pkg> Buildset or pkg [default: ${buildset_pkg}]"
|
2016-06-06 20:08:09 +02:00
|
|
|
echo " -a <arch> Arch [default: ${target_arch}]"
|
|
|
|
echo " -b <branch> Branch [default: ${target_branch}]"
|
2015-02-13 15:17:00 +01:00
|
|
|
echo ' -r <dir> Chroots directory'
|
|
|
|
echo " [default: ${chroots_pkg}]"
|
2015-05-29 00:31:59 +02:00
|
|
|
echo ' -i <pkg> Install a package into the working copy of the chroot'
|
2015-02-13 15:17:00 +01:00
|
|
|
echo ' -c Recreate chroot'
|
|
|
|
echo ' -w Clean up cache and sources'
|
|
|
|
echo ' -n Install and run namcap check'
|
|
|
|
echo ' -s Sign packages'
|
2015-11-01 08:50:55 +01:00
|
|
|
echo ' -u Udev base-devel group (no systemd)'
|
2015-02-13 15:17:00 +01:00
|
|
|
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
|
2015-02-13 15:17:00 +01:00
|
|
|
case "${arg}" in
|
|
|
|
p) buildset_pkg="$OPTARG" ;;
|
2016-06-06 20:08:09 +02:00
|
|
|
a) target_arch="$OPTARG" ;;
|
|
|
|
b) target_branch="$OPTARG" ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
r) chroots_pkg="$OPTARG" ;;
|
2015-05-29 17:12:24 +02:00
|
|
|
i) install_pkgs+="$OPTARG"; mkchrootpkg_args+=(-I ${install_pkgs[*]}) ;;
|
2016-06-08 23:33:05 +02:00
|
|
|
c) clean_first=true ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
w) wipe_clean=true ;;
|
|
|
|
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
|
|
|
s) sign=true ;;
|
2015-10-22 12:09:00 +02:00
|
|
|
u) udev_root=true ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
q) pretend=true ;;
|
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
|
|
esac
|
2014-10-04 00:46:40 +02:00
|
|
|
done
|
|
|
|
|
2016-06-07 08:23:29 +02:00
|
|
|
configure_chroot_arch "${target_arch}"
|
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
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
2014-10-07 10:34:58 +02:00
|
|
|
|
2015-02-18 20:08:59 +01:00
|
|
|
timer_start=$(get_timer)
|
|
|
|
|
2015-12-01 12:24:23 +01:00
|
|
|
eval_buildset "${sets_dir_pkg}" "${buildset_pkg}"
|
2014-11-13 22:43:07 +01:00
|
|
|
|
2015-12-01 13:05:46 +01:00
|
|
|
prepare_dir "${pkg_dir}"
|
|
|
|
|
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
|
|
|
|
|
2015-11-28 17:37:13 +01:00
|
|
|
run make_pkg "${buildset_pkg}"
|