manjaro-tools/bin/check-yaml.in

149 lines
4.3 KiB
Text
Raw Permalink Normal View History

2016-08-21 15:20:29 +02:00
#!/bin/bash
#
# 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.
version=@version@
LIBDIR='@libdir@'
DATADIR='@datadir@'
SYSCONFDIR='@sysconfdir@'
[[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-yaml.sh
2016-08-21 15:20:29 +02:00
show_profile(){
2016-09-15 23:58:18 +02:00
prepare_check "$1"
msg2 "yaml_dir: %s" "${yaml_dir}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "autologin: %s" "${autologin}"
msg2 "nonfree_mhwd: %s" "${nonfree_mhwd}"
msg2 "pxe_boot: %s" "${pxe_boot}"
msg2 "plymouth_boot: %s" "${plymouth_boot}"
${plymouth_boot} && msg2 "plymouth_theme: %s" "${plymouth_theme}"
[[ ${target_arch} == 'x86_64' ]] && msg2 "multilib: %s" "${multilib}"
msg2 "netinstall: %s" "${netinstall}"
msg2 "chrootcfg: %s" "${chrootcfg}"
2016-09-15 23:58:18 +02:00
${netinstall} && msg2 "netgroups: %s" "$(get_yaml)"
msg2 "geoip: %s" "${geoip}"
2016-09-15 23:58:18 +02:00
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}"
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
reset_profile
unset yaml_dir
2016-08-21 15:20:29 +02:00
}
display_settings(){
2016-09-15 23:58:18 +02:00
show_version
show_config
msg "PROFILE:"
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}"
msg "OPTIONS:"
msg2 "arch: %s" "${target_arch}"
msg2 "initsys: %s" "${initsys}"
msg2 "kernel: %s" "${kernel}"
msg "ARGS:"
msg2 "validate: %s" "${validate}"
2016-09-15 23:58:18 +02:00
msg2 "calamares: %s" "${calamares}"
msg2 "group: %s" "${group}"
2016-09-15 23:58:18 +02:00
msg "CHECK QUEUE:"
run show_profile "${build_list_iso}"
2016-08-21 15:20:29 +02:00
}
load_user_info
load_config "${USERCONFDIR}/manjaro-tools.conf" || load_config "${SYSCONFDIR}/manjaro-tools.conf"
# to force old way to have buildiso run in iso-profiles dir
# run_dir=$(pwd)
load_run_dir "${profile_repo}"
calamares=false
2016-08-21 16:14:08 +02:00
pretend=false
2016-09-15 00:09:56 +02:00
group=false
validate=false
2016-08-21 15:20:29 +02:00
cache_dir_netinstall="${cache_dir}/netinstall"
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 " -k <name> Kernel to use[default: ${kernel}]"
echo " -i <name> Init system to use [default: ${initsys}]"
echo ' -c Check also calamares yaml files generated for the profile'
echo ' -g Enable pacman group accepted for -p'
echo ' -v Validate by schema'
2016-09-15 23:58:18 +02:00
echo ' -q Query settings'
echo ' -h This help'
echo ''
echo ''
exit $1
2016-08-21 15:20:29 +02:00
}
orig_argv=("$@")
opts='p:a:i:k:gcvqh'
2016-08-21 15:20:29 +02: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" ;;
i) initsys="$OPTARG" ;;
k) kernel="$OPTARG" ;;
c) calamares=true ;;
g) group=true ;;
v) validate=true ;;
2016-09-15 23:58:18 +02:00
q) pretend=true ;;
h|?) usage 0 ;;
*) echo "invalid argument '${arg}'"; usage 1 ;;
esac
2016-08-21 15:20:29 +02:00
done
shift $(($OPTIND - 1))
check_root "$0" "${orig_argv[@]}"
2016-08-21 16:14:08 +02:00
prepare_dir "${tmp_dir}"
eval_build_list "${list_dir_iso}" "${build_list_iso}"
${pretend} && display_settings && exit 1
2016-09-15 00:09:56 +02:00
${group} && write_pacman_group_yaml "${build_list_iso}" && exit 0
2016-08-21 15:20:29 +02:00
run make_profile_yaml "${build_list_iso}"