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@'
|
|
|
|
PKGDATADIR='@pkgdatadir@'
|
|
|
|
SYSCONFDIR='@sysconfdir@'
|
|
|
|
|
|
|
|
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
|
|
|
|
[[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh
|
|
|
|
[[ -r ${LIBDIR}/util-pkg.sh ]] && source ${LIBDIR}/util-pkg.sh
|
2014-11-13 13:33:38 +01:00
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
display_settings(){
|
2014-11-26 15:53:19 +01:00
|
|
|
msg "manjaro-tools"
|
|
|
|
msg2 "version: ${version}"
|
2014-12-17 19:40:28 +01:00
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then
|
|
|
|
msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf"
|
2014-12-17 19:40:28 +01:00
|
|
|
else
|
|
|
|
msg2 "manjaro_tools_conf: ${manjaro_tools_conf}"
|
2014-12-14 03:48:46 +01:00
|
|
|
fi
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: ${arch}"
|
|
|
|
msg2 "branch: ${branch}"
|
|
|
|
msg2 "chroots: ${chroots}"
|
|
|
|
|
|
|
|
msg "ARGS:"
|
|
|
|
msg2 "mkchrootpkg_args: ${mkchrootpkg_args[*]}"
|
|
|
|
msg2 "makepkg_args: ${makepkg_args[*]}"
|
2014-12-16 01:57:59 +01:00
|
|
|
msg2 "clean_first: ${clean_first}"
|
|
|
|
msg2 "wipe_clean: ${wipe_clean}"
|
|
|
|
msg2 "namcap: ${namcap}"
|
|
|
|
msg2 "sign: ${sign}"
|
2014-11-16 23:18:01 +01:00
|
|
|
|
|
|
|
msg "PATHS:"
|
|
|
|
msg2 "chrootdir: ${chrootdir}"
|
|
|
|
msg2 "profiledir: ${profiledir}"
|
2014-12-06 22:50:47 +01:00
|
|
|
msg2 "pkg_dir: ${pkg_dir}"
|
2014-11-16 23:18:01 +01:00
|
|
|
msg2 "pacman_conf: ${pacman_conf}"
|
|
|
|
msg2 "makepkg_conf: ${makepkg_conf}"
|
2014-12-11 03:54:02 +01:00
|
|
|
msg2 "mirrors_conf: ${mirrors_conf}"
|
2014-12-07 02:33:21 +01:00
|
|
|
|
|
|
|
msg "BLACKLIST:"
|
|
|
|
msg2 "blacklist_trigger: ${blacklist_trigger[*]}"
|
|
|
|
msg2 "blacklist: ${blacklist[*]}"
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
if ${clean_first};then
|
|
|
|
msg "PKG:"
|
|
|
|
msg2 "base_packages: ${base_packages[*]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
msg "SETS:"
|
2014-11-16 23:22:21 +01:00
|
|
|
msg2 "profiles: $(load_sets)"
|
2014-11-16 23:18:01 +01:00
|
|
|
msg2 "profile: ${profile}"
|
|
|
|
msg2 "is_profile: ${is_profile}"
|
|
|
|
|
|
|
|
if ${is_profile};then
|
|
|
|
msg "Build queue:"
|
|
|
|
local list=$(cat ${profiledir}/${profile}.set)
|
|
|
|
for item in ${list[@]}; do
|
|
|
|
msg2 "$item"
|
|
|
|
done
|
|
|
|
else
|
|
|
|
msg "Build queue:"
|
|
|
|
for arg in "${makepkg_args[@]}"; do
|
|
|
|
case ${arg} in
|
|
|
|
--pkg) continue ;;
|
|
|
|
-*) continue ;;
|
|
|
|
*) local split_arg=${arg} ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
if [[ -n ${split_arg} ]]; then
|
|
|
|
local IFS=','
|
|
|
|
for item in ${split_arg}; do
|
|
|
|
msg2 "$item"
|
|
|
|
done
|
|
|
|
unset IFS
|
|
|
|
else
|
|
|
|
msg2 "${profile}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-10-04 00:46:40 +02:00
|
|
|
export LC_MESSAGES=C
|
|
|
|
|
2014-11-14 23:33:53 +01:00
|
|
|
pkg_owner=${SUDO_USER:-$USER}
|
|
|
|
|
|
|
|
if [[ -n $SUDO_USER ]]; then
|
|
|
|
eval "USER_HOME=~$SUDO_USER"
|
|
|
|
else
|
|
|
|
USER_HOME=$HOME
|
|
|
|
fi
|
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
USER_CONFIG="$USER_HOME/.config"
|
|
|
|
|
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
|
|
|
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
|
|
|
|
|
2014-10-08 11:11:19 +02:00
|
|
|
pacman_conf_arch='default'
|
2014-11-16 23:18:01 +01:00
|
|
|
base_packages=('base-devel')
|
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
|
|
|
|
is_profile=false
|
2014-10-06 23:35:01 +02:00
|
|
|
sign=false
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
usage() {
|
2014-11-14 13:11:54 +01:00
|
|
|
echo "Usage: ${0##*/} [options] [--] [makepkg args]"
|
2014-10-06 01:22:45 +02:00
|
|
|
echo " -p <profile> Set profile or pkg [default: ${profile}]"
|
|
|
|
echo " -a <arch> Set arch [default: ${arch}]"
|
|
|
|
echo " -b <branch> Set branch [default: ${branch}]"
|
|
|
|
echo " -r <dir> Chroots directory [default: ${chroots}]"
|
2014-11-13 21:13:45 +01:00
|
|
|
echo ' -c Recreate chroot'
|
|
|
|
echo ' -w Clean up'
|
2014-11-14 13:11:54 +01:00
|
|
|
echo ' -n Install and run namcap check'
|
2014-10-06 23:35:01 +02:00
|
|
|
echo ' -s Sign packages'
|
2014-10-06 02:44:40 +02:00
|
|
|
echo ' -q Query settings and pretend build'
|
2014-10-04 00:46:40 +02:00
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
orig_argv=("$@")
|
|
|
|
|
2014-11-14 23:33:53 +01:00
|
|
|
opts='p:a:b:r:cwnsqh'
|
2014-10-04 00:46:40 +02:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
|
|
|
case "${arg}" in
|
2014-11-18 18:02:11 +01:00
|
|
|
p) profile="$OPTARG" ;;
|
2014-10-04 00:46:40 +02:00
|
|
|
a) arch="$OPTARG" ;;
|
|
|
|
b) branch="$OPTARG" ;;
|
|
|
|
r) chroots="$OPTARG" ;;
|
2014-11-12 04:15:40 +01:00
|
|
|
c) clean_first=true ;;
|
2014-11-13 01:53:11 +01:00
|
|
|
w) wipe_clean=true ;;
|
2014-10-13 13:38:22 +02:00
|
|
|
n) namcap=true; mkchrootpkg_args+=(-n) ;;
|
2014-10-06 23:35:01 +02:00
|
|
|
s) sign=true ;;
|
2014-10-14 21:57:44 +02:00
|
|
|
q) pretend=true ;;
|
2014-10-04 00:46:40 +02:00
|
|
|
h) usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ "$arch" == 'multilib' ]]; then
|
|
|
|
pacman_conf_arch='multilib'
|
|
|
|
base_packages+=('multilib-devel')
|
2014-11-14 23:33:53 +01:00
|
|
|
arch='x86_64'
|
2014-10-04 00:46:40 +02:00
|
|
|
fi
|
|
|
|
|
2014-11-14 22:12:29 +01:00
|
|
|
chrootdir=${chroots}/${branch}/${arch}
|
2014-11-18 17:52:23 +01:00
|
|
|
pkg_dir_loaded=${pkg_dir}
|
|
|
|
pkg_dir="${pkg_dir}/${branch}/${arch}"
|
2014-11-14 23:33:53 +01:00
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
load_pacman_conf "${PKGDATADIR}/pacman-${pacman_conf_arch}.conf"
|
|
|
|
makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf"
|
|
|
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-12-11 03:54:02 +01:00
|
|
|
mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf})
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
mkchrootpkg_args+=(-r ${chrootdir})
|
2014-10-04 00:46:40 +02:00
|
|
|
|
2014-11-12 04:15:40 +01:00
|
|
|
makepkg_args+=("${@:$OPTIND}")
|
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
|
|
|
|
2014-11-18 17:52:23 +01:00
|
|
|
[[ -d "${pkg_dir}" ]] || prepare_cachedir
|
2014-11-13 22:43:07 +01:00
|
|
|
|
|
|
|
eval_profile "${profile}"
|
|
|
|
|
2014-11-16 23:18:01 +01:00
|
|
|
${pretend} && display_settings && exit
|
|
|
|
|
|
|
|
${wipe_clean} && clean_up
|
|
|
|
|
|
|
|
chroot_init
|
|
|
|
|
|
|
|
chroot_build
|
|
|
|
|
2014-11-17 00:36:14 +01:00
|
|
|
${sign} && sign_pkgs
|