manjaro-tools/bin/buildiso.in

183 lines
4.8 KiB
Text
Raw Normal View History

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
show_profile(){
eval_edition "$1"
2015-12-06 05:58:56 +01:00
load_profile "${run_dir}/${edition}/$1"
msg2 "edition: ${edition}"
if ${verbose};then
msg2 "work_dir: ${work_dir}"
msg2 "iso_dir: ${iso_dir}"
msg2 "iso_file: ${iso_file}"
msg2 "is_custom_pac_conf: ${is_custom_pac_conf}"
msg2 "initsys: ${initsys}"
if ${use_overlayfs};then
msg2 "mount system: overlayfs"
else
msg2 "mount system: aufs"
fi
[[ ${arch} == 'x86_64' ]] && msg2 "multilib: ${multilib}"
msg2 "displaymanager: ${displaymanager}"
msg2 "autologin: ${autologin}"
msg2 "nonfree_xorg: ${nonfree_xorg}"
msg2 "kernel: ${kernel}"
msg2 "efi_boot_loader: ${efi_boot_loader}"
msg2 "efi_part_size: ${efi_part_size}"
msg2 "pxe_boot: ${pxe_boot}"
msg2 "plymouth_boot: ${plymouth_boot}"
${plymouth_boot} && msg2 "plymouth_theme: ${plymouth_theme}"
msg2 "hostname: ${hostname}"
msg2 "username: ${username}"
msg2 "password: ${password}"
msg2 "addgroups: ${addgroups}"
if [[ ${initsys} == 'systemd' ]];then
msg2 "start_systemd: ${start_systemd[*]}"
msg2 "start_systemd_live: ${start_systemd_live[*]}"
msg2 "disable_systemd: ${disable_systemd[*]}"
else
msg2 "start_openrc: ${start_openrc[*]}"
msg2 "start_openrc_live: ${start_openrc_live[*]}"
msg2 "disable_openrc: ${disable_openrc[*]}"
fi
fi
}
2014-12-04 20:05:33 +01:00
display_settings(){
show_version
show_config
2015-02-13 15:17:00 +01:00
msg "PROFILE:"
2015-11-14 21:07:53 +01:00
msg2 "sets_dir_iso: ${sets_dir_iso}"
2015-12-08 12:33:28 +01:00
msg2 "buildsets: $(list_sets ${sets_dir_iso})"
2015-02-13 15:17:00 +01:00
msg2 "buildset_iso: ${buildset_iso}"
msg2 "is_buildset: ${is_buildset}"
msg2 "profile_repo: ${profile_repo}"
2015-02-13 15:17:00 +01:00
msg "OPTIONS:"
msg2 "arch: ${arch}"
msg2 "branch: ${branch}"
msg2 "chroots_iso: ${chroots_iso}"
msg "ARGS:"
msg2 "clean_first: ${clean_first}"
msg2 "images_only: ${images_only}"
msg2 "iso_only: ${iso_only}"
2015-03-05 10:52:37 +01:00
msg "DIST SETTINGS:"
msg2 "dist_name: ${dist_name}"
msg2 "dist_release: ${dist_release}"
msg2 "dist_codename: ${dist_codename}"
2015-05-22 12:40:11 +02:00
msg "ISO SETTINGS:"
msg2 "iso_label: ${iso_label}"
msg2 "iso_name: ${iso_name}"
msg2 "iso_publisher: ${iso_publisher}"
msg2 "iso_app_id: ${iso_app_id}"
msg2 "iso_compression: ${iso_compression}"
msg2 "iso_checksum: ${iso_checksum}"
2015-06-25 16:57:04 +02:00
msg2 "use_overlayfs: ${use_overlayfs}"
2015-02-13 15:17:00 +01:00
msg "BUILD QUEUE:"
2015-11-28 17:37:13 +01:00
run show_profile "${buildset_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
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"
# to force old way to have buildiso run in iso-profiles dir
# run_dir=$(pwd)
2015-12-05 19:37:40 +01:00
load_run_dir "${profile_repo}"
2015-12-01 12:24:23 +01:00
clean_first=true
2014-12-18 02:03:40 +01:00
pretend=false
images_only=false
2014-12-14 17:22:47 +01:00
iso_only=false
verbose=false
2014-12-07 06:36:46 +01:00
pacman_conf_arch='default'
2014-12-07 06:36:46 +01:00
usage() {
2015-02-13 15:17:00 +01:00
echo "Usage: ${0##*/} [options]"
echo " -p <profile> Buildset or profile [default: ${buildset_iso}]"
echo " -a <arch> Arch [default: ${arch}]"
echo " -b <branch> Branch [default: ${branch}]"
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}]"
2015-02-13 15:17:00 +01:00
echo ' -c Disable clean work dir'
echo ' -i Build images only'
echo ' -s Generate iso only'
echo ' Requires pre built images (-i)'
echo ' -v Verbose output, show profies 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=("$@")
opts='p:a:b:r:t:cisvqh'
2014-12-07 06:36:46 +01:00
while getopts "${opts}" arg; do
2015-02-13 15:17:00 +01:00
case "${arg}" in
p) buildset_iso="$OPTARG" ;;
a) arch="$OPTARG" ;;
b) branch="$OPTARG" ;;
r) chroots_iso="$OPTARG" ;;
2015-06-04 15:18:47 +02:00
t) cache_dir_iso="$OPTARG" ;;
k) keep_repo="$OPTARG" ;;
2015-02-13 15:17:00 +01:00
c) clean_first=false ;;
i) images_only=true ;;
s) iso_only=true ;;
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-11-28 17:37:13 +01:00
[[ "${arch}" == 'x86_64' ]] && pacman_conf_arch='multilib'
2014-12-09 23:23:54 +01:00
2015-12-08 12:33:28 +01:00
mirrors_conf="${DATADIR}/pacman-mirrors-${branch}.conf"
2015-01-12 01:09:13 +01:00
2015-01-15 02:49:21 +01:00
check_root "$0" "${orig_argv[@]}"
2014-12-05 02:22:14 +01:00
2015-12-01 12:24:23 +01:00
eval_buildset "${sets_dir_iso}" "${buildset_iso}"
import ${LIBDIR}/util-iso.sh
check_requirements
${pretend} && display_settings && exit 1
2015-11-28 17:37:13 +01:00
run make_profile "${buildset_iso}"