]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Adding tweak snippets
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 12 Jun 2020 12:55:57 +0000 (14:55 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 12 Jun 2020 12:55:57 +0000 (14:55 +0200)
kickstart/template-centos8.ks
snippets/tpl.060.tweak_systemd.sh [new file with mode: 0644]
snippets/tpl.070.tweak_grub.sh [new file with mode: 0644]

index eedf53f566695d2581556173978ef92d48c254ee..45255074aaee1e84c657209bd1f1ca7b8eee761a 100644 (file)
@@ -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 (file)
index 0000000..4a51004
--- /dev/null
@@ -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 (file)
index 0000000..5d0b629
--- /dev/null
@@ -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