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.
|
|
|
|
|
|
|
|
import ${LIBDIR}/util-iso.sh
|
|
|
|
import ${LIBDIR}/util-iso-calamares.sh
|
|
|
|
|
2016-09-16 19:42:20 +02:00
|
|
|
check_yaml(){
|
2016-09-18 02:04:10 +02:00
|
|
|
msg2 "Checking validity [%s] ..." "${1##*/}"
|
|
|
|
local name=${1##*/} file
|
2016-09-18 02:27:59 +02:00
|
|
|
case ${name##*.} in
|
2016-09-18 02:04:10 +02:00
|
|
|
yaml)
|
|
|
|
name=${name%.yaml}
|
|
|
|
file=$1
|
|
|
|
;;
|
|
|
|
conf)
|
|
|
|
name=${name%.conf}
|
|
|
|
file=${tmp_dir}/$name.yaml
|
|
|
|
cp -v $1 $file
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
pykwalify -d $file -s ${DATADIR}/schemas/$name.schema.yaml
|
2016-08-21 18:27:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
write_calamares_yaml(){
|
2016-09-16 19:42:20 +02:00
|
|
|
configure_calamares "${yaml_dir}"
|
2016-09-18 02:04:10 +02:00
|
|
|
local yf
|
|
|
|
if ${validate}; then
|
|
|
|
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
|
|
|
|
check_yaml "$conf"
|
|
|
|
done
|
|
|
|
fi
|
2016-08-21 18:27:15 +02:00
|
|
|
}
|
|
|
|
|
2016-08-21 15:20:29 +02:00
|
|
|
write_netgroup_yaml(){
|
2016-09-15 23:58:18 +02:00
|
|
|
msg2 "Writing %s ..." "${2##*/}"
|
|
|
|
echo "- name: '$1'" > "$2"
|
|
|
|
echo " description: '$1'" >> "$2"
|
|
|
|
echo " selected: false" >> "$2"
|
|
|
|
echo " hidden: false" >> "$2"
|
|
|
|
echo " packages:" >> "$2"
|
|
|
|
for p in ${packages[@]};do
|
|
|
|
echo " - $p" >> "$2"
|
|
|
|
done
|
2016-09-18 02:04:10 +02:00
|
|
|
${validate} && check_yaml "$2"
|
2016-08-21 15:20:29 +02:00
|
|
|
}
|
|
|
|
|
2016-09-15 00:09:56 +02:00
|
|
|
write_pacman_group_yaml(){
|
2016-09-15 23:58:18 +02:00
|
|
|
packages=$(pacman -Sgq "$1")
|
|
|
|
prepare_dir "${cache_dir_netinstall}/pacman"
|
|
|
|
write_netgroup_yaml "$1" "${cache_dir_netinstall}/pacman/$1.yaml"
|
2016-09-18 02:04:10 +02:00
|
|
|
${validate} && check_yaml "${cache_dir_netinstall}/pacman/$1.yaml"
|
2016-09-15 23:58:18 +02:00
|
|
|
user_own "${cache_dir_netinstall}/pacman" "-R"
|
2016-09-15 00:09:56 +02:00
|
|
|
}
|
|
|
|
|
2016-08-21 16:14:08 +02:00
|
|
|
prepare_check(){
|
2016-09-15 23:58:18 +02:00
|
|
|
profile=$1
|
|
|
|
edition=$(get_edition ${profile})
|
|
|
|
profile_dir=${run_dir}/${edition}/${profile}
|
|
|
|
check_profile
|
|
|
|
load_profile_config "${profile_dir}/profile.conf"
|
2016-08-21 15:20:29 +02:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
yaml_dir=${cache_dir_netinstall}/${profile}/${target_arch}
|
2016-08-21 15:20:29 +02:00
|
|
|
|
2016-09-15 23:58:18 +02:00
|
|
|
prepare_dir "${yaml_dir}"
|
|
|
|
user_own "${yaml_dir}"
|
2016-08-21 15:20:29 +02:00
|
|
|
}
|
|
|
|
|
2016-08-21 18:27:15 +02:00
|
|
|
gen_fn(){
|
2016-09-18 02:04:10 +02:00
|
|
|
echo "${yaml_dir}/$1-${target_arch}-${initsys}.yaml"
|
2016-08-21 15:20:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
make_profile_yaml(){
|
2016-09-15 23:58:18 +02:00
|
|
|
prepare_check "$1"
|
|
|
|
load_pkgs "${profile_dir}/Packages-Root"
|
|
|
|
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
|
|
|
|
if [[ -f "${packages_custom}" ]]; then
|
|
|
|
load_pkgs "${packages_custom}"
|
|
|
|
write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")"
|
|
|
|
fi
|
|
|
|
${calamares} && write_calamares_yaml "$1"
|
|
|
|
user_own "${cache_dir_netinstall}/$1" "-R"
|
|
|
|
reset_profile
|
|
|
|
unset yaml_dir
|
2016-08-21 15:20:29 +02:00
|
|
|
}
|