2014-12-04 19:19:54 +01:00
|
|
|
#!/bin/bash
|
2014-12-04 19:20:28 +01: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-12-04 19:19:54 +01:00
|
|
|
|
2014-12-04 19:20:28 +01:00
|
|
|
version=@version@
|
2014-12-04 19:19:54 +01:00
|
|
|
|
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
|
2017-04-28 10:30:34 +02:00
|
|
|
import ${LIBDIR}/util-iso.sh
|
|
|
|
import ${LIBDIR}/util-iso-mount.sh
|
|
|
|
|
|
|
|
prepare_build(){
|
|
|
|
timer_start=$(get_timer)
|
|
|
|
profile=$1
|
|
|
|
edition=$(get_edition "${profile}")
|
2017-05-21 22:44:08 +02:00
|
|
|
local profile_dir=${run_dir}/${edition}/${profile}
|
2017-04-28 10:30:34 +02:00
|
|
|
|
2017-05-10 23:11:42 +02:00
|
|
|
load_profile "${profile_dir}"
|
2017-04-28 10:30:34 +02:00
|
|
|
|
2017-05-21 22:44:08 +02:00
|
|
|
local user_conf=${profile_dir}/user-repos.conf pac_arch='default' pacman_conf
|
|
|
|
[[ "${target_arch}" == 'x86_64' ]] && pac_arch='multilib'
|
|
|
|
if [[ -f ${user_conf} ]];then
|
|
|
|
info "detected: %s" "user-repos.conf"
|
|
|
|
check_user_repos_conf "${user_conf}"
|
|
|
|
pacman_conf=${tmp_dir}/custom-pacman.conf
|
|
|
|
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$pacman_conf"
|
|
|
|
else
|
|
|
|
pacman_conf="${DATADIR}/pacman-$pac_arch.conf"
|
|
|
|
fi
|
2017-04-28 10:30:34 +02:00
|
|
|
|
|
|
|
local mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
|
|
|
|
|
|
|
iso_file=$(gen_iso_fn).iso
|
|
|
|
|
|
|
|
local mirror="${build_mirror}/${target_branch}"
|
|
|
|
|
|
|
|
mkchroot_args+=(-C ${pacman_conf} -S ${mirrors_conf} -B "${mirror}" -K)
|
|
|
|
work_dir=${chroots_iso}/${profile}/${target_arch}
|
|
|
|
|
|
|
|
iso_dir="${cache_dir_iso}/${edition}/${profile}/${dist_release}"
|
|
|
|
|
|
|
|
iso_root=${chroots_iso}/${profile}/iso
|
|
|
|
mnt_dir=${chroots_iso}/${profile}/mnt
|
|
|
|
prepare_dir "${mnt_dir}"
|
|
|
|
|
|
|
|
prepare_dir "${iso_dir}"
|
|
|
|
user_own "${iso_dir}"
|
|
|
|
}
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2015-02-14 11:06:20 +01:00
|
|
|
show_profile(){
|
2017-04-30 09:13:19 +02:00
|
|
|
local prof="$1"
|
|
|
|
prepare_build "$prof"
|
2017-02-16 10:24:38 +01:00
|
|
|
msg2 "iso_file: %s" "${iso_file}"
|
2016-09-15 23:58:18 +02:00
|
|
|
if ${verbose};then
|
|
|
|
msg2 "autologin: %s" "${autologin}"
|
|
|
|
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
|
|
|
|
|
|
|
|
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
|
|
|
|
|
2017-02-04 10:51:00 +01:00
|
|
|
msg2 "extra: %s" "${extra}"
|
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
msg2 "netinstall: %s" "${netinstall}"
|
2016-09-28 14:24:06 +02:00
|
|
|
msg2 "chrootcfg: %s" "${chrootcfg}"
|
2016-09-15 23:58:18 +02:00
|
|
|
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
|
|
|
|
msg2 "geoip: %s" "${geoip}"
|
|
|
|
|
|
|
|
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
|
|
|
|
|
|
|
|
msg2 "hostname: %s" "${hostname}"
|
|
|
|
msg2 "username: %s" "${username}"
|
|
|
|
msg2 "password: %s" "${password}"
|
|
|
|
msg2 "login_shell: %s" "${login_shell}"
|
|
|
|
msg2 "addgroups: %s" "${addgroups}"
|
|
|
|
[[ -n ${smb_workgroup} ]] && msg2 "smb_workgroup: %s" "${smb_workgroup}"
|
|
|
|
|
|
|
|
if [[ ${initsys} == 'systemd' ]];then
|
|
|
|
msg2 "enable_systemd: %s" "${enable_systemd[*]}"
|
|
|
|
msg2 "enable_systemd_live: %s" "${enable_systemd_live[*]}"
|
|
|
|
[[ -n ${disable_systemd[*]} ]] && msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
|
|
|
else
|
|
|
|
msg2 "enable_openrc: %s" "${enable_openrc[*]}"
|
|
|
|
msg2 "enable_openrc_live: %s" "${enable_openrc_live[*]}"
|
|
|
|
[[ -n ${disable_openrc[*]} ]] && msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
reset_profile
|
2015-02-14 11:06:20 +01:00
|
|
|
}
|
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
display_settings(){
|
2016-09-15 23:58:18 +02:00
|
|
|
show_version
|
|
|
|
show_config
|
|
|
|
|
2017-05-08 00:47:29 +02:00
|
|
|
# msg "PROFILE:"
|
|
|
|
# msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
|
|
|
# msg2 "build_list_iso: %s" "${build_list_iso}"
|
2016-09-15 23:58:18 +02:00
|
|
|
msg2 "is_build_list: %s" "${is_build_list}"
|
|
|
|
|
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: %s" "${target_arch}"
|
|
|
|
msg2 "branch: %s" "${target_branch}"
|
|
|
|
msg2 "initsys: %s" "${initsys}"
|
|
|
|
msg2 "kernel: %s" "${kernel}"
|
2017-02-15 01:18:20 +01:00
|
|
|
[[ -n ${gpgkey} ]] && msg2 "gpgkey: %s" "${gpgkey}"
|
2016-09-15 23:58:18 +02:00
|
|
|
|
|
|
|
msg "ARGS:"
|
|
|
|
msg2 "clean_first: %s" "${clean_first}"
|
|
|
|
msg2 "images_only: %s" "${images_only}"
|
|
|
|
msg2 "iso_only: %s" "${iso_only}"
|
2016-10-13 15:24:31 +02:00
|
|
|
msg2 "persist: %s" "${persist}"
|
2016-09-15 23:58:18 +02:00
|
|
|
|
|
|
|
msg "DIST SETTINGS:"
|
|
|
|
msg2 "dist_name: %s" "${dist_name}"
|
|
|
|
msg2 "dist_release: %s" "${dist_release}"
|
|
|
|
msg2 "dist_codename: %s" "${dist_codename}"
|
|
|
|
|
2017-02-16 10:24:38 +01:00
|
|
|
msg "ISO INFO:"
|
2016-09-15 23:58:18 +02:00
|
|
|
msg2 "iso_label: %s" "${iso_label}"
|
|
|
|
|
|
|
|
msg "BUILD QUEUE:"
|
|
|
|
run show_profile "${build_list_iso}"
|
2015-01-15 02:49:21 +01:00
|
|
|
}
|
|
|
|
|
2015-01-13 13:41:28 +01:00
|
|
|
load_user_info
|
2014-12-14 03:48:46 +01:00
|
|
|
|
2017-04-19 20:37:01 +02:00
|
|
|
load_config "${MT_USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2015-12-21 11:00:08 +01:00
|
|
|
load_run_dir "${profile_repo}"
|
2014-12-18 06:03:21 +01:00
|
|
|
|
2015-12-01 12:24:23 +01:00
|
|
|
clean_first=true
|
2014-12-18 02:03:40 +01:00
|
|
|
pretend=false
|
2014-12-14 21:15:59 +01:00
|
|
|
images_only=false
|
2014-12-14 17:22:47 +01:00
|
|
|
iso_only=false
|
2015-05-22 13:08:50 +02:00
|
|
|
verbose=false
|
2016-10-13 15:24:31 +02:00
|
|
|
persist=false
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2017-05-07 13:46:13 +02:00
|
|
|
mkchroot_args=(-L)
|
|
|
|
|
2014-12-07 06:36:46 +01:00
|
|
|
usage() {
|
2016-09-15 23:58:18 +02:00
|
|
|
echo "Usage: ${0##*/} [options]"
|
|
|
|
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
|
|
|
echo " -a <arch> Arch [default: ${target_arch}]"
|
|
|
|
echo " -b <branch> Branch [default: ${target_branch}]"
|
|
|
|
echo ' -r <dir> Chroots directory'
|
|
|
|
echo " [default: ${chroots_iso}]"
|
|
|
|
echo ' -t <dir> Target directory'
|
|
|
|
echo " [default: ${cache_dir_iso}]"
|
|
|
|
echo ' -k <name> Kernel to use'
|
|
|
|
echo " [default: ${kernel}]"
|
|
|
|
echo ' -i <name> Init system to use'
|
|
|
|
echo " [default: ${initsys}]"
|
2017-02-15 01:18:20 +01:00
|
|
|
echo ' -g <key> The gpg key for sfs signing'
|
|
|
|
echo " [default: ${gpgkey}]"
|
2016-10-13 15:24:31 +02:00
|
|
|
echo ' -m Set SquashFS image mode to persistence'
|
2016-09-15 23:58:18 +02:00
|
|
|
echo ' -c Disable clean work dir'
|
|
|
|
echo ' -x Build images only'
|
|
|
|
echo ' -z Generate iso only'
|
|
|
|
echo ' Requires pre built images (-x)'
|
|
|
|
echo ' -v Verbose output to log file, show profile detail (-q)'
|
|
|
|
echo ' -q Query settings and pretend build'
|
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit $1
|
2014-12-07 06:36:46 +01:00
|
|
|
}
|
|
|
|
|
2017-04-19 08:58:04 +02:00
|
|
|
orig_argv=("$0" "$@")
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2017-02-15 01:18:20 +01:00
|
|
|
opts='p:a:b:r:t:k:i:g:czxmvqh'
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
2016-09-15 23:58:18 +02:00
|
|
|
case "${arg}" in
|
|
|
|
p) build_list_iso="$OPTARG" ;;
|
|
|
|
a) target_arch="$OPTARG" ;;
|
|
|
|
b) target_branch="$OPTARG" ;;
|
|
|
|
r) chroots_iso="$OPTARG" ;;
|
|
|
|
t) cache_dir_iso="$OPTARG" ;;
|
|
|
|
k) kernel="$OPTARG" ;;
|
|
|
|
i) initsys="$OPTARG" ;;
|
2017-02-15 01:18:20 +01:00
|
|
|
g) gpgkey="$OPTARG" ;;
|
2016-09-15 23:58:18 +02:00
|
|
|
c) clean_first=false ;;
|
|
|
|
x) images_only=true ;;
|
|
|
|
z) iso_only=true ;;
|
2016-10-13 15:24:31 +02:00
|
|
|
m) persist=true ;;
|
2016-09-15 23:58:18 +02:00
|
|
|
v) verbose=true ;;
|
|
|
|
q) pretend=true ;;
|
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
|
|
|
esac
|
2014-12-07 06:36:46 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2017-04-19 08:58:04 +02:00
|
|
|
check_root
|
2014-12-05 02:22:14 +01:00
|
|
|
|
2015-11-30 18:59:57 +01:00
|
|
|
check_requirements
|
2014-12-04 22:12:00 +01:00
|
|
|
|
2015-01-15 04:38:47 +01:00
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
run build "${build_list_iso}"
|