From: Frank Brehm Date: Wed, 28 Mar 2018 12:16:51 +0000 (+0200) Subject: Fixing install_network and implementing tweak_systemd and tweak_grub in bin/postinst X-Git-Tag: 0.1.1~78 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=40af80c6bf68d3244ec8a0014cc2e415bca75ff9;p=pixelpark%2Fcreate-vmware-tpl.git Fixing install_network and implementing tweak_systemd and tweak_grub in bin/postinst --- diff --git a/bin/postinst b/bin/postinst index a59561f..e26693d 100644 --- a/bin/postinst +++ b/bin/postinst @@ -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 }