check-yaml: use generic preset in cal mode

This commit is contained in:
udeved 2016-08-21 18:27:15 +02:00
parent 805c33bcd7
commit ff96c85395
5 changed files with 43 additions and 14 deletions

View file

@ -80,6 +80,7 @@ LIBS_ISO = \
SHARED_ISO = \ SHARED_ISO = \
data/pacman-mhwd.conf \ data/pacman-mhwd.conf \
data/desktop.map \ data/desktop.map \
data/linux.preset \
data/profile.conf.example data/profile.conf.example
CPIOHOOKS = \ CPIOHOOKS = \

14
data/linux.preset Normal file
View file

@ -0,0 +1,14 @@
# mkinitcpio preset file for the 'linux' package
ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-@kvmaj@.@kvmin@-@arch@"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-@kvmaj@.@kvmin@-@arch@.img"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-@kvmaj@.@kvmin@-@arch@-fallback.img"
fallback_options="-S autodetect"

View file

@ -36,7 +36,7 @@ write_finished_conf(){
write_bootloader_conf(){ write_bootloader_conf(){
local conf="$1/etc/calamares/modules/bootloader.conf" local conf="$1/etc/calamares/modules/bootloader.conf"
source "$2.preset" source "$2"
echo '---' > "$conf" echo '---' > "$conf"
echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf" echo "efiBootLoader: \"${efi_boot_loader}\"" >> "$conf"
echo "kernel: \"$(echo ${ALL_kver} | sed s'|/boot||')\"" >> "$conf" echo "kernel: \"$(echo ${ALL_kver} | sed s'|/boot||')\"" >> "$conf"

View file

@ -257,7 +257,7 @@ configure_live_image(){
configure_mhwd "$1" configure_mhwd "$1"
configure_system "$1" configure_system "$1"
configure_services "$1" configure_services "$1"
configure_calamares "$1" "$1/etc/mkinitcpio.d/${kernel}" configure_calamares "$1" "$1/etc/mkinitcpio.d/${kernel}.preset"
write_live_session_conf "$1" write_live_session_conf "$1"
msg "Done configuring [live-image]" msg "Done configuring [live-image]"
} }

View file

@ -17,6 +17,28 @@ check_yaml(){
[[ $? -ne 0 ]] && error "yaml error: %s [msg: %s]" "$1" [[ $? -ne 0 ]] && error "yaml error: %s [msg: %s]" "$1"
} }
get_preset(){
local p=${tmp_dir}/${kernel}.preset kvmaj kvmin
cp ${DATADIR}/linux ${tmp_dir}/$p
digit=${kernel##linux}
kvmaj=${digit:0:1}
kvmin=${digit:1}
sed -e "s|@kvmaj@|$kvmaj|g" \
-e "s|@kvmin@|$kvmin|g" \
-e "s|@arch@|${target_arch}|g"\
-i $p
echo $p
}
write_calamares_yaml(){
configure_calamares "${yaml_dir}" "$(get_preset)"
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
check_yaml "$conf"
done
}
write_netgroup_yaml(){ write_netgroup_yaml(){
echo "- name: '$1'" > "$2" echo "- name: '$1'" > "$2"
echo " description: '$1'" >> "$2" echo " description: '$1'" >> "$2"
@ -43,28 +65,20 @@ prepare_check(){
chown "${OWNER}:${OWNER}" "${yaml_dir}" chown "${OWNER}:${OWNER}" "${yaml_dir}"
} }
write_calamares_yaml(){ gen_fn(){
local preset=${work_dir}/root-image/etc/mkinitcpio.d/${kernel} echo ${yaml_dir}/$1-${target_arch}-${initsys}.yaml
[[ -f ${preset}.preset ]] || die "The profile needs to be built at least one time!"
configure_calamares "${yaml_dir}" "${preset}"
for conf in "${yaml_dir}"/etc/calamares/modules/*.conf "${yaml_dir}"/etc/calamares/settings.conf; do
check_yaml "$conf"
done
} }
make_profile_yaml(){ make_profile_yaml(){
prepare_check "$1" prepare_check "$1"
load_pkgs "${profile_dir}/Packages-Root" load_pkgs "${profile_dir}/Packages-Root"
yaml="${yaml_dir}/Packages-Root-${target_arch}-${initsys}.yaml" write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
write_netgroup_yaml "$1" "${yaml}"
if [[ -f "${packages_custom}" ]]; then if [[ -f "${packages_custom}" ]]; then
load_pkgs "${packages_custom}" load_pkgs "${packages_custom}"
yaml="${yaml_dir}/${packages_custom##*/}-${target_arch}-${initsys}.yaml" write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")"
write_netgroup_yaml "$1" "${yaml}"
fi fi
${calamares} && write_calamares_yaml "$1" ${calamares} && write_calamares_yaml "$1"
user_own "${yaml_dir}" user_own "${yaml_dir}"
reset_profile reset_profile
unset yaml
unset yaml_dir unset yaml_dir
} }