From 69981d72b5e1a04f34bf508a41b3221217d10f38 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 8 Nov 2023 17:48:54 +0100 Subject: [PATCH] Adding and using snippet tpl.240.rc.local.sh --- etc/cobbler-distros.d/almalinux-8.yaml | 1 + etc/cobbler-distros.d/centos-7.yaml | 1 + etc/cobbler-distros.d/centos-stream-8.yaml | 1 + etc/cobbler-distros.d/centos-stream-9.yaml | 1 + etc/cobbler-distros.d/oel-7.yaml | 1 + etc/cobbler-distros.d/rhel-9.yaml | 1 + etc/cobbler-distros.d/rocky-8.yaml | 1 + snippets/tpl.240.rc.local.sh | 46 ++++++++++++++++++++++ 8 files changed, 53 insertions(+) create mode 100644 snippets/tpl.240.rc.local.sh diff --git a/etc/cobbler-distros.d/almalinux-8.yaml b/etc/cobbler-distros.d/almalinux-8.yaml index 035378b..87a7c6e 100644 --- a/etc/cobbler-distros.d/almalinux-8.yaml +++ b/etc/cobbler-distros.d/almalinux-8.yaml @@ -68,6 +68,7 @@ cobbler-distros: - 'tpl.210.bashrc-el8.sh' - 'tpl.220.locales-el8.sh' - 'tpl.230.vimrc-el8.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el8.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.300.create-motd.sh' diff --git a/etc/cobbler-distros.d/centos-7.yaml b/etc/cobbler-distros.d/centos-7.yaml index 01108a1..f24aa0d 100644 --- a/etc/cobbler-distros.d/centos-7.yaml +++ b/etc/cobbler-distros.d/centos-7.yaml @@ -47,6 +47,7 @@ cobbler-distros: - 'tpl.175.repos_el7.sh' - 'tpl.200.init-repos.sh' - 'tpl.225.vimrc-el7.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el7.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.320.root-ssh-login.sh' diff --git a/etc/cobbler-distros.d/centos-stream-8.yaml b/etc/cobbler-distros.d/centos-stream-8.yaml index 34d1156..1d8acf1 100644 --- a/etc/cobbler-distros.d/centos-stream-8.yaml +++ b/etc/cobbler-distros.d/centos-stream-8.yaml @@ -52,6 +52,7 @@ cobbler-distros: - 'tpl.185.repos_el8.sh' - 'tpl.200.init-repos.sh' - 'tpl.230.vimrc-el8.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el8.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.320.root-ssh-login.sh' diff --git a/etc/cobbler-distros.d/centos-stream-9.yaml b/etc/cobbler-distros.d/centos-stream-9.yaml index e7bc6d4..368839e 100644 --- a/etc/cobbler-distros.d/centos-stream-9.yaml +++ b/etc/cobbler-distros.d/centos-stream-9.yaml @@ -68,6 +68,7 @@ cobbler-distros: - 'tpl.210.bashrc-el8.sh' - 'tpl.220.locales-el8.sh' - 'tpl.230.vimrc-el8.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el8.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.300.create-motd.sh' diff --git a/etc/cobbler-distros.d/oel-7.yaml b/etc/cobbler-distros.d/oel-7.yaml index 4e7ab44..61eac77 100644 --- a/etc/cobbler-distros.d/oel-7.yaml +++ b/etc/cobbler-distros.d/oel-7.yaml @@ -52,6 +52,7 @@ cobbler-distros: - 'tpl.175.repos_el7.sh' - 'tpl.200.init-repos.sh' - 'tpl.225.vimrc-el7.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el7.sh' - 'tpl.270.remove-uek.sh' - 'tpl.280.dist-upgrade.sh' diff --git a/etc/cobbler-distros.d/rhel-9.yaml b/etc/cobbler-distros.d/rhel-9.yaml index 4fda09b..a7887a3 100644 --- a/etc/cobbler-distros.d/rhel-9.yaml +++ b/etc/cobbler-distros.d/rhel-9.yaml @@ -48,6 +48,7 @@ cobbler-distros: - 'tpl.195.repos_el9.sh' - 'tpl.200.init-repos.sh' - 'tpl.231.vimrc-centos9.sh' + - 'tpl.240.rc.local.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.320.root-ssh-login.sh' - 'tpl.400.chrony.sh' diff --git a/etc/cobbler-distros.d/rocky-8.yaml b/etc/cobbler-distros.d/rocky-8.yaml index 217d1e4..4803cb4 100644 --- a/etc/cobbler-distros.d/rocky-8.yaml +++ b/etc/cobbler-distros.d/rocky-8.yaml @@ -68,6 +68,7 @@ cobbler-distros: - 'tpl.210.bashrc-el8.sh' - 'tpl.220.locales-el8.sh' - 'tpl.230.vimrc-el8.sh' + - 'tpl.240.rc.local.sh' - 'tpl.250.pkgs-el8.sh' - 'tpl.280.dist-upgrade.sh' - 'tpl.300.create-motd.sh' diff --git a/snippets/tpl.240.rc.local.sh b/snippets/tpl.240.rc.local.sh new file mode 100644 index 0000000..4ec7f77 --- /dev/null +++ b/snippets/tpl.240.rc.local.sh @@ -0,0 +1,46 @@ +## !/bin/bash +#raw + +#----------------------------------------------------------- +manage_rc_local() { + + echo -e "\e[0Ksection_start:$( date +%s ):ks_manage_rc_local[collapsed=true]\r\e[0KManaging /etc/rc.d/rc.local ..." + echo + echo "${HASH_LINE}" + echo "Calling manage_rc_local() ..." + echo + + if [[ -d /etc/rc.d ]] ; then + echo "Creating /etc/rc.d/rc.local ..." + cat <<-EOF >/etc/rc.d/rc.local + #!/bin/bash + # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES + # + # It is highly advisable to create own systemd services or udev rules + # to run scripts during boot instead of using this file. + # + # In contrast to previous versions due to parallel execution during boot + # this script will NOT be run after all other services. + # + # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure + # that this script will be executed during boot. + + # touch /var/lock/subsys/local + + EOF + + chmod --verbose 0744 /etc/rc.d/rc.local + echo + + echo "Created /etc/rc.d/rc.local:" + echo "----------- snip -----------" + cat /etc/rc.d/rc.local + echo "----------- snip -----------" + + fi + + echo -e "\e[0Ksection_end:$( date +%s ):ks_manage_rc_local\r\e[0K" +} + +#end raw +## vim: ts=4 et list -- 2.39.5