]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Fixing install_network and implementing tweak_systemd and tweak_grub in bin/postinst
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 28 Mar 2018 12:16:51 +0000 (14:16 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 28 Mar 2018 12:16:51 +0000 (14:16 +0200)
bin/postinst

index a59561fdaf000e38dadbe7f9e6fef112ec741dfb..e26693dceac3125fc745e9b445fd56599df6b6a2 100644 (file)
@@ -154,10 +154,11 @@ install_network() {
     echo
     log "Generating network configuration ..."
 
-    local temp_dir=$( mktemp -d 'tmp.XXXXXXXXXX.cobbler' )
+    local temp_dir=$( mktemp -p /tmp -d 'tmp.XXXXXXXXXX.cobbler' )
     local tmp_nw_cfg="${temp_dir}/network"
     local tmp_nw_script_dir="${temp_dir}/network-scripts"
-    local old_dir="/etc/sysconfig/network/network-scripts/.old"
+    local nw_script_dir="/etc/sysconfig/network-scripts"
+    local old_dir="${nw_script_dir}/.old"
     local ifcfg_file=
 
     mkdir -pv "${tmp_nw_script_dir}"
@@ -196,14 +197,14 @@ install_network() {
 
        EOF
 
-    for ifcfg_file in /etc/sysconfig/network-scripts/ifcfg-* ; do
+    for ifcfg_file in ${nw_script_dir}/ifcfg-* ; do
         local bname=$(basename "${ifcfg_file}" )
         if [[ "${bname}" == "ifcfg-lo" ]] ; then
             continue
         fi
         mv -v "${ifcfg_file}" "${old_dir}"
     done
-    mv -v "${dev_file}" "/etc/sysconfig/network/network-scripts"
+    mv -v "${dev_file}" "${nw_script_dir}"
 
     rm -vf "${temp_dir}"
 
@@ -226,6 +227,49 @@ manage_dns() {
 
 }
 
+#-----------------------------------------------------------
+tweak_systemd() {
+
+    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
+
+}
+
+#-----------------------------------------------------------
+tweak_grub() {
+
+    local grub_cfg="/etc/default/grub"
+    if [[ -f "${grub_cfg}" ]] ; then
+
+        echo
+        log "Tweaking '${grub_cfg}' ..."
+
+        sed --in-place=".bak.$( date -r ${grub_cfg} +'%Y-%m-%d_%H:%M:%S' )" -e 's/^\(GRUB_CMDLINE_LINUX=.*\)[  ]quiet\(.*\)/\1\2/' "${grub_cfg}"
+        grub2-mkconfig -o /boot/grub2/grub.cfg
+
+    fi
+
+}
+
 #-----------------------------------------------------------
 main() {
 
@@ -236,6 +280,10 @@ main() {
     disable_ipv6
     install_network
     manage_dns
+    tweak_systemd
+
+
+    tweak_grub
 
 }