From: Frank Brehm Date: Fri, 12 Jun 2020 12:55:57 +0000 (+0200) Subject: Adding tweak snippets X-Git-Tag: 2.1.2^2~9^2~31^2~42 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=4a23a8821ef7918837d8f02900c9cd9eb588fa0b;p=pixelpark%2Fcreate-vmware-tpl.git Adding tweak snippets --- diff --git a/kickstart/template-centos8.ks b/kickstart/template-centos8.ks index eedf53f..4525507 100644 --- a/kickstart/template-centos8.ks +++ b/kickstart/template-centos8.ks @@ -169,4 +169,14 @@ echo echo "Using snippet $authkeys_snippet" $SNIPPET($authkeys_snippet) +#set $tweak_systemd_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.060.tweak_systemd.sh" +echo +echo "Using snippet $tweak_systemd_snippet" +$SNIPPET($tweak_systemd_snippet) + +#set $tweak_grub_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.070.tweak_grub.sh" +echo +echo "Using snippet $tweak_grub_snippet" +$SNIPPET($tweak_grub_snippet) + %end diff --git a/snippets/tpl.060.tweak_systemd.sh b/snippets/tpl.060.tweak_systemd.sh new file mode 100644 index 0000000..4a51004 --- /dev/null +++ b/snippets/tpl.060.tweak_systemd.sh @@ -0,0 +1,35 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +tweak_systemd() { + + echo + echo "${HASH_LINE}" + echo + log "Tweaking systemd ..." + + local sdir="/etc/systemd/system" + local getty_dir_tgt="${sdir}/getty.target.wants" + local getty_dir_at="${sdir}/getty@.service.d" + local getty_svc="/usr/lib/systemd/system/getty@.service" + local i= + local glink= + + mkdir -pv "${getty_dir_at}" + echo "Generating ${getty_dir_at}/noclear.conf ..." + cat <<-EOF >"${getty_dir_at}/noclear.conf" + [Service] + TTYVTDisallocate=no + EOF + + for i in 2 3 4 ; do + glink="${getty_dir_tgt}/gett@tty${i}.service" + ln -sv "${getty_svc}" "${glink}" + done + +} + + +#end raw +## vim: ts=4 et list diff --git a/snippets/tpl.070.tweak_grub.sh b/snippets/tpl.070.tweak_grub.sh new file mode 100644 index 0000000..5d0b629 --- /dev/null +++ b/snippets/tpl.070.tweak_grub.sh @@ -0,0 +1,35 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +tweak_grub() { + + local grub_cfg="/etc/default/grub" + if [[ -f "${grub_cfg}" ]] ; then + + echo + echo "${HASH_LINE}" + echo + log "Tweaking '${grub_cfg}' ..." + + echo "Selecting entry in /etc/grub2.cfg ..." + awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg + grub2-set-default 0 + grub2-editenv list + + echo "Removing quiet from '${grub_cfg}' ..." + sed --in-place -e 's/^\(GRUB_CMDLINE_LINUX=.*\)[ ]quiet\(.*\)/\1\2/' "${grub_cfg}" + + echo "Removing rhgb (RedHat Graphical Boot) from '${grub_cfg}' ..." + sed --in-place -e 's/^\(GRUB_CMDLINE_LINUX=.*\)[ ]rhgb\(.*\)/\1\2/' "${grub_cfg}" + + echo "Recreating /boot/grub2/grub.cfg ..." + grub2-mkconfig -o /boot/grub2/grub.cfg + + fi + +} +tweak_grub + +#end raw +## vim: ts=4 et list