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
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2015-02-14 11:06:20 +01:00
|
|
|
show_profile(){
|
2016-02-25 06:40:39 +01:00
|
|
|
prepare_profile "$1"
|
2016-06-09 09:14:39 +02:00
|
|
|
msg2 "pacman_conf: %s" "${pacman_conf}"
|
2015-12-04 22:03:04 +01:00
|
|
|
if ${verbose};then
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "work_dir: %s" "${work_dir}"
|
|
|
|
msg2 "iso_dir: %s" "${iso_dir}"
|
|
|
|
msg2 "iso_file: %s" "${iso_file}"
|
|
|
|
msg2 "displaymanager: %s" "${displaymanager}"
|
|
|
|
msg2 "autologin: %s" "${autologin}"
|
|
|
|
msg2 "nonfree_xorg: %s" "${nonfree_xorg}"
|
|
|
|
msg2 "pxe_boot: %s" "${pxe_boot}"
|
|
|
|
msg2 "plymouth_boot: %s" "${plymouth_boot}"
|
|
|
|
${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}"
|
2015-12-21 11:00:08 +01:00
|
|
|
|
2016-06-06 20:08:09 +02:00
|
|
|
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
|
2015-12-21 11:00:08 +01:00
|
|
|
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "efi_boot_loader: %s" "${efi_boot_loader}"
|
|
|
|
msg2 "efi_part_size: %s" "${efi_part_size}"
|
2015-12-21 11:00:08 +01:00
|
|
|
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "hostname: %s" "${hostname}"
|
|
|
|
msg2 "username: %s" "${username}"
|
|
|
|
msg2 "password: %s" "${password}"
|
2016-05-21 10:17:44 +02:00
|
|
|
msg2 "login_shell: %s" "${login_shell}"
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "addgroups: %s" "${addgroups}"
|
2015-12-04 22:03:04 +01:00
|
|
|
|
|
|
|
if [[ ${initsys} == 'systemd' ]];then
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "start_systemd: %s" "${start_systemd[*]}"
|
|
|
|
msg2 "start_systemd_live: %s" "${start_systemd_live[*]}"
|
|
|
|
msg2 "disable_systemd: %s" "${disable_systemd[*]}"
|
2015-12-04 22:03:04 +01:00
|
|
|
else
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "start_openrc: %s" "${start_openrc[*]}"
|
|
|
|
msg2 "start_openrc_live: %s" "${start_openrc_live[*]}"
|
|
|
|
msg2 "disable_openrc: %s" "${disable_openrc[*]}"
|
2015-12-04 22:03:04 +01:00
|
|
|
fi
|
2016-07-12 22:27:23 +02:00
|
|
|
if ${is_torrent};then
|
|
|
|
msg2 "tracker_url: %s" "${tracker_url}"
|
|
|
|
msg2 "piece_size: %s" "${piece_size}"
|
|
|
|
msg2 "mktorrent_args: %s" "${mktorrent_args[*]}"
|
|
|
|
fi
|
2015-12-04 22:03:04 +01:00
|
|
|
fi
|
2016-02-26 17:56:17 +01:00
|
|
|
reset_profile
|
2015-02-14 11:06:20 +01:00
|
|
|
}
|
|
|
|
|
2014-12-04 20:05:33 +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-06-09 18:03:38 +02:00
|
|
|
msg2 "list_dir_iso: %s" "${list_dir_iso}"
|
|
|
|
msg2 "build_lists: %s" "$(show_build_lists ${list_dir_iso})"
|
|
|
|
msg2 "build_list_iso: %s" "${build_list_iso}"
|
|
|
|
msg2 "is_build_list: %s" "${is_build_list}"
|
2016-06-09 21:58:18 +02:00
|
|
|
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
|
2016-06-12 07:32:15 +02:00
|
|
|
${verbose} && msg2 "run_dir: %s" "${run_dir}"
|
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-14 23:13:39 +01:00
|
|
|
msg2 "chroots_iso: %s" "${chroots_iso}"
|
2016-02-17 19:21:20 +01:00
|
|
|
msg2 "initsys: %s" "${initsys}"
|
2016-02-17 20:00:54 +01:00
|
|
|
msg2 "kernel: %s" "${kernel}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "ARGS:"
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "clean_first: %s" "${clean_first}"
|
|
|
|
msg2 "images_only: %s" "${images_only}"
|
|
|
|
msg2 "iso_only: %s" "${iso_only}"
|
2016-02-22 19:33:50 +01:00
|
|
|
msg2 "sign: %s" "${sign}"
|
2016-07-12 22:27:23 +02:00
|
|
|
msg2 "is_torrent: %s" "${is_torrent}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
2015-03-05 10:52:37 +01:00
|
|
|
msg "DIST SETTINGS:"
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "dist_name: %s" "${dist_name}"
|
|
|
|
msg2 "dist_release: %s" "${dist_release}"
|
|
|
|
msg2 "dist_codename: %s" "${dist_codename}"
|
2015-03-05 10:52:37 +01:00
|
|
|
|
2015-05-22 12:40:11 +02:00
|
|
|
msg "ISO SETTINGS:"
|
2016-02-14 23:13:39 +01:00
|
|
|
msg2 "iso_label: %s" "${iso_label}"
|
|
|
|
msg2 "iso_publisher: %s" "${iso_publisher}"
|
|
|
|
msg2 "iso_app_id: %s" "${iso_app_id}"
|
|
|
|
msg2 "iso_compression: %s" "${iso_compression}"
|
|
|
|
msg2 "iso_checksum: %s" "${iso_checksum}"
|
|
|
|
msg2 "use_overlayfs: %s" "${use_overlayfs}"
|
2016-02-22 21:08:37 +01:00
|
|
|
${verbose} && msg2 "iso_fs: %s" "${iso_fs}"
|
2015-02-13 15:17:00 +01:00
|
|
|
|
|
|
|
msg "BUILD QUEUE:"
|
2016-06-09 18:03:38 +02:00
|
|
|
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
|
|
|
|
2016-06-14 17:54:44 +02:00
|
|
|
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2015-12-06 01:52:40 +01:00
|
|
|
# to force old way to have buildiso run in iso-profiles dir
|
|
|
|
# run_dir=$(pwd)
|
|
|
|
|
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-02-22 19:24:49 +01:00
|
|
|
sign=false
|
2016-07-12 22:27:23 +02:00
|
|
|
is_torrent=false
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
usage() {
|
2015-02-13 15:17:00 +01:00
|
|
|
echo "Usage: ${0##*/} [options]"
|
2016-06-09 18:03:38 +02:00
|
|
|
echo " -p <profile> Buildset or profile [default: ${build_list_iso}]"
|
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_iso}]"
|
2015-06-04 15:18:47 +02:00
|
|
|
echo ' -t <dir> Target directory'
|
|
|
|
echo " [default: ${cache_dir_iso}]"
|
2016-02-17 18:56:37 +01:00
|
|
|
echo ' -k <name> Kernel to use'
|
|
|
|
echo " [default: ${kernel}]"
|
2016-02-17 19:21:20 +01:00
|
|
|
echo ' -i <name> Init system to use'
|
2016-02-17 18:56:37 +01:00
|
|
|
echo " [default: ${initsys}]"
|
2016-02-22 19:24:49 +01:00
|
|
|
echo ' -s Sign the iso'
|
2015-02-13 15:17:00 +01:00
|
|
|
echo ' -c Disable clean work dir'
|
2016-02-17 19:21:20 +01:00
|
|
|
echo ' -x Build images only'
|
|
|
|
echo ' -z Generate iso only'
|
2016-02-20 17:28:36 +01:00
|
|
|
echo ' Requires pre built images (-x)'
|
2016-07-12 22:27:23 +02:00
|
|
|
echo ' -w Create iso torrent'
|
2016-05-22 20:02:28 +02:00
|
|
|
echo ' -v Verbose output to log file, show profile detail (-q)'
|
2015-02-13 15:17:00 +01:00
|
|
|
echo ' -q Query settings and pretend build'
|
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit $1
|
2014-12-07 06:36:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
orig_argv=("$@")
|
|
|
|
|
2016-07-12 22:27:23 +02:00
|
|
|
opts='p:a:b:r:t:k:i:czxswvqh'
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
2015-02-13 15:17:00 +01:00
|
|
|
case "${arg}" in
|
2016-06-09 18:03:38 +02:00
|
|
|
p) build_list_iso="$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_iso="$OPTARG" ;;
|
2015-06-04 15:18:47 +02:00
|
|
|
t) cache_dir_iso="$OPTARG" ;;
|
2016-02-17 18:56:37 +01:00
|
|
|
k) kernel="$OPTARG" ;;
|
2016-02-17 19:21:20 +01:00
|
|
|
i) initsys="$OPTARG" ;;
|
2016-02-22 19:24:49 +01:00
|
|
|
s) sign=true ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
c) clean_first=false ;;
|
2016-02-17 19:21:20 +01:00
|
|
|
x) images_only=true ;;
|
|
|
|
z) iso_only=true ;;
|
2016-07-12 22:27:23 +02:00
|
|
|
w) is_torrent=true ;;
|
2015-05-22 13:08:50 +02:00
|
|
|
v) verbose=true ;;
|
2015-02-13 15:17:00 +01:00
|
|
|
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))
|
|
|
|
|
2015-02-18 04:28:11 +01:00
|
|
|
timer_start=$(get_timer)
|
2015-02-17 19:45:35 +01:00
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
2014-12-05 02:22:14 +01:00
|
|
|
|
2016-06-19 22:39:46 +02:00
|
|
|
prepare_dir "${log_dir}"
|
|
|
|
|
2016-06-11 20:32:03 +02:00
|
|
|
prepare_dir "${tmp_dir}"
|
|
|
|
|
2016-06-09 18:03:38 +02:00
|
|
|
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
2014-12-18 06:03:21 +01:00
|
|
|
|
2015-06-28 12:58:55 +02:00
|
|
|
import ${LIBDIR}/util-iso.sh
|
|
|
|
|
2015-11-30 18:59:57 +01:00
|
|
|
check_requirements
|
2014-12-04 22:12:00 +01:00
|
|
|
|
2016-06-19 21:44:04 +02:00
|
|
|
for sig in TERM HUP QUIT; do
|
|
|
|
trap "trap_exit $sig \"$(gettext "%s signal caught. Exiting...")\" \"$sig\"" "$sig"
|
|
|
|
done
|
|
|
|
trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT
|
|
|
|
trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR
|
|
|
|
|
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}"
|