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 07:57:34 +01:00
|
|
|
BINDIR='@bindir@'
|
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-iso.sh ]] && source ${LIBDIR}/util-iso.sh
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
display_settings(){
|
|
|
|
msg "manjaro-tools"
|
|
|
|
msg2 "version: ${version}"
|
2015-01-15 04:38:47 +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-10 04:16:30 +01:00
|
|
|
fi
|
2015-01-15 04:38:47 +01:00
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: ${arch}"
|
|
|
|
msg2 "branch: ${branch}"
|
2015-01-13 01:32:31 +01:00
|
|
|
msg2 "chroots_iso: ${chroots_iso}"
|
2015-01-15 04:38:47 +01:00
|
|
|
|
|
|
|
msg "PROFILE:"
|
|
|
|
msg2 "buildsets: $(load_sets ${sets_dir_iso})"
|
|
|
|
msg2 "buildset_iso: ${buildset_iso}"
|
|
|
|
msg2 "is_buildset: ${is_buildset}"
|
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
msg "ARGS:"
|
2014-12-17 02:37:01 +01:00
|
|
|
msg2 "clean_first: ${clean_first}"
|
2015-01-15 04:38:47 +01:00
|
|
|
msg2 "clean_cache_xorg: ${clean_cache_xorg}"
|
|
|
|
msg2 "clean_cache_lng: ${clean_cache_lng}"
|
|
|
|
msg2 "images_only: ${images_only}"
|
|
|
|
msg2 "iso_only: ${iso_only}"
|
|
|
|
|
|
|
|
msg "PATHS:"
|
|
|
|
msg2 "cache_dir_iso: ${cache_dir_iso}"
|
|
|
|
msg2 "cache_dir_xorg: ${cache_dir_xorg}"
|
|
|
|
msg2 "cache_dir_lng: ${cache_dir_lng}"
|
|
|
|
|
2014-12-17 02:14:15 +01:00
|
|
|
msg "IMAGES SETTINGS:"
|
2014-12-04 22:12:00 +01:00
|
|
|
msg2 "manjaro_kernel: ${manjaro_kernel}"
|
|
|
|
msg2 "manjaro_version: ${manjaro_version}"
|
2015-01-15 04:38:47 +01:00
|
|
|
|
2014-12-17 02:37:01 +01:00
|
|
|
msg2 "plymouth_theme: ${plymouth_theme}"
|
2015-01-15 04:38:47 +01:00
|
|
|
|
2014-12-04 22:12:00 +01:00
|
|
|
msg "ISO SETTINGS:"
|
|
|
|
msg2 "iso_label: ${iso_label}"
|
|
|
|
msg2 "iso_version: ${iso_version}"
|
|
|
|
msg2 "manjaroiso: ${manjaroiso}"
|
|
|
|
msg2 "code_name: ${code_name}"
|
|
|
|
msg2 "img_name: ${img_name}"
|
|
|
|
msg2 "install_dir: ${install_dir}"
|
2015-01-13 01:32:31 +01:00
|
|
|
msg2 "compression: ${compression}"
|
2015-01-15 04:38:47 +01:00
|
|
|
|
2014-12-11 04:03:12 +01:00
|
|
|
msg "LIVECD:"
|
2014-12-11 04:04:51 +01:00
|
|
|
msg2 "username: ${username}"
|
2014-12-11 04:03:12 +01:00
|
|
|
msg2 "password: ${password}"
|
|
|
|
msg2 "addgroups: ${addgroups}"
|
|
|
|
msg2 "hostname: ${hostname}"
|
2014-12-09 00:40:46 +01:00
|
|
|
|
2015-01-15 04:38:47 +01:00
|
|
|
msg "BUILD QUEUE:"
|
2015-01-15 02:49:21 +01:00
|
|
|
if ${is_buildset};then
|
2015-01-15 04:38:47 +01:00
|
|
|
local list=$(cat ${sets_dir_iso}/${buildset_iso}.set)
|
|
|
|
for item in ${list[@]}; do
|
|
|
|
msg3 "$item"
|
|
|
|
cd $item
|
|
|
|
load_desktop_definition
|
|
|
|
load_profile
|
|
|
|
work_dir=${chroots_iso}/$item/${arch}
|
|
|
|
msg2 "initsys: ${initsys}"
|
|
|
|
msg2 "displaymanager: ${displaymanager}"
|
|
|
|
msg2 "pacman_conf: ${pacman_conf}"
|
|
|
|
msg2 "work_dir: ${work_dir}"
|
|
|
|
msg2 "iso_file: ${iso_file}"
|
|
|
|
if [ ${initsys} == "systemd" ];then
|
|
|
|
msg2 "start_systemd: ${start_systemd[*]}"
|
|
|
|
msg2 "start_systemd_live: ${start_systemd_live[*]}"
|
|
|
|
else
|
|
|
|
msg2 "start_openrc: ${start_openrc[*]}"
|
|
|
|
msg2 "start_openrc_live: ${start_openrc_live[*]}"
|
|
|
|
fi
|
2015-01-15 02:49:21 +01:00
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
else
|
2015-01-15 04:38:47 +01:00
|
|
|
msg3 "${buildset_iso}"
|
2015-01-15 02:49:21 +01:00
|
|
|
cd ${buildset_iso}
|
2015-01-15 04:38:47 +01:00
|
|
|
load_desktop_definition
|
|
|
|
load_profile
|
|
|
|
work_dir=${chroots_iso}/${buildset_iso}/${arch}
|
|
|
|
msg2 "initsys: ${initsys}"
|
|
|
|
msg2 "displaymanager: ${displaymanager}"
|
|
|
|
msg2 "pacman_conf: ${pacman_conf}"
|
|
|
|
msg2 "work_dir: ${work_dir}"
|
|
|
|
msg2 "iso_file: ${iso_file}"
|
|
|
|
if [ ${initsys} == "systemd" ];then
|
|
|
|
msg2 "start_systemd: ${start_systemd[*]}"
|
|
|
|
msg2 "start_systemd_live: ${start_systemd_live[*]}"
|
|
|
|
else
|
|
|
|
msg2 "start_openrc: ${start_openrc[*]}"
|
|
|
|
msg2 "start_openrc_live: ${start_openrc_live[*]}"
|
|
|
|
fi
|
2015-01-15 02:49:21 +01:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-01-13 13:41:28 +01:00
|
|
|
load_user_info
|
2014-12-14 03:48:46 +01:00
|
|
|
|
2015-01-15 04:38:47 +01:00
|
|
|
load_config "${USER_CONFIG}/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-18 02:03:40 +01:00
|
|
|
clean_first=true
|
2015-01-14 23:14:44 +01:00
|
|
|
clean_cache_xorg=true
|
2014-12-18 06:03:21 +01:00
|
|
|
clean_cache_lng=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
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2014-12-08 22:16:06 +01:00
|
|
|
pacman_conf_arch='default'
|
|
|
|
|
2014-12-07 06:36:46 +01:00
|
|
|
usage() {
|
|
|
|
echo "Usage: ${0##*/} [options]"
|
2015-01-15 03:13:01 +01:00
|
|
|
echo " -p <profile> Set or profile [default: ${buildset_iso}]"
|
2015-01-15 02:49:21 +01:00
|
|
|
echo " -a <arch> Arch [default: ${arch}]"
|
|
|
|
echo " -b <branch> Branch [default: ${branch}]"
|
2015-01-13 01:32:31 +01:00
|
|
|
echo ' -r <dir> Chroots directory'
|
|
|
|
echo " [default: ${chroots_iso}]"
|
2015-01-15 05:19:48 +01:00
|
|
|
echo ' -c Disable clean work dir'
|
|
|
|
|
2014-12-07 06:36:46 +01:00
|
|
|
echo ' -q Query settings and pretend build'
|
2015-01-15 05:36:26 +01:00
|
|
|
echo ' -i Build images only'
|
|
|
|
echo ' -s Generate iso only'
|
2014-12-17 18:15:44 +01:00
|
|
|
echo ' Requires pre built images'
|
2015-01-15 05:36:26 +01:00
|
|
|
echo ' -x Disable clean xorg cache'
|
|
|
|
echo ' -l Disable clean lng cache'
|
2014-12-07 06:36:46 +01:00
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
2015-01-15 05:19:48 +01:00
|
|
|
exit $1
|
2014-12-07 06:36:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
orig_argv=("$@")
|
|
|
|
|
2015-01-15 05:36:26 +01:00
|
|
|
opts='p:a:b:r:cxlisqh'
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
|
|
|
case "${arg}" in
|
2015-01-15 02:49:21 +01:00
|
|
|
p) buildset_iso="$OPTARG" ;;
|
2014-12-07 06:36:46 +01:00
|
|
|
a) arch="$OPTARG" ;;
|
|
|
|
b) branch="$OPTARG" ;;
|
2015-01-13 01:32:31 +01:00
|
|
|
r) chroots_iso="$OPTARG" ;;
|
2015-01-15 05:19:48 +01:00
|
|
|
c) clean_first=false; iso_args+=(-f) ;;
|
2015-01-15 05:36:26 +01:00
|
|
|
x) clean_cache_xorg=false ;;
|
|
|
|
l) clean_cache_lng=false ;;
|
|
|
|
i) images_only=true ;;
|
|
|
|
s) iso_only=true ;;
|
2015-01-15 05:19:48 +01:00
|
|
|
q) pretend=true ;;
|
|
|
|
h|?) usage 0 ;;
|
|
|
|
*) echo "invalid argument '${arg}'"; usage 1 ;;
|
2014-12-07 06:36:46 +01:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
2014-12-09 23:23:54 +01:00
|
|
|
if [[ "$arch" == 'x86_64' ]]; then
|
|
|
|
pacman_conf_arch='multilib'
|
|
|
|
fi
|
|
|
|
|
2015-01-14 22:29:46 +01:00
|
|
|
sets_dir_iso="${sets_dir}/iso"
|
2015-01-14 23:14:44 +01:00
|
|
|
cache_dir_lng="${cache_dir}/lng"
|
|
|
|
cache_dir_xorg="${cache_dir}/xorg"
|
2015-01-15 04:38:47 +01:00
|
|
|
cache_dir_iso="${cache_dir}/iso"
|
2015-01-15 02:49:21 +01:00
|
|
|
|
|
|
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
2015-01-12 01:09:13 +01:00
|
|
|
|
2015-01-15 03:13:01 +01:00
|
|
|
create_args+=(-v -a ${arch} -D ${install_dir} -C ${pacman_conf} -M ${mirrors_conf})
|
2015-01-14 22:29:46 +01:00
|
|
|
|
2015-01-15 05:19:48 +01:00
|
|
|
iso_args+=(-v -x -a ${arch} -D ${install_dir} -L ${iso_label} -c ${compression})
|
2014-12-14 07:10:36 +01:00
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
2014-12-05 02:22:14 +01:00
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
eval_buildset "${buildset_iso}" "${sets_dir_iso}"
|
2014-12-18 06:03:21 +01:00
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
prepare_cachedirs
|
2014-12-04 22:12:00 +01:00
|
|
|
|
2015-01-15 04:38:47 +01:00
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
|
2015-01-15 02:49:21 +01:00
|
|
|
build_iso
|