-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
290 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# (Auto)Removes unneeded packages and upgrades | ||
# the distro. | ||
|
||
exec 1>&2 | ||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
dnf install -y epel-release | ||
|
||
dnf update -y --skip-broken | ||
|
||
# Ensure packages needed for post-processing scripts do exist. | ||
dnf install -y curl gawk grep jq sed | ||
|
||
sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Sets kernel command line (net.ifnames=0 is particularily important), | ||
# then updates initramfs/initrd and grub2. | ||
|
||
exec 1>&2 | ||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
rm -rf /etc/default/grub.d/ | ||
|
||
# Drop unwanted. | ||
|
||
gawk -i inplace -f- /etc/default/grub <<'EOF' | ||
/^GRUB_CMDLINE_LINUX[^=]*=/ { gsub(/\<quiet\>/, "") } | ||
/^GRUB_CMDLINE_LINUX[^=]*=/ { gsub(/\<splash\>/, "") } | ||
/^GRUB_CMDLINE_LINUX[^=]*=/ { gsub(/\<console=ttyS[^ ]*\>/, "") } | ||
/^GRUB_CMDLINE_LINUX[^=]*=/ { gsub(/\<earlyprintk=ttyS[^ ]*\>/, "") } | ||
/^GRUB_CMDLINE_LINUX[^=]*=/ { gsub(/\<crashkernel=[^ ]*\>/, "crashkernel=no") } | ||
{ print } | ||
EOF | ||
|
||
# Ensure required. | ||
|
||
gawk -i inplace -f- /etc/default/grub <<'EOF' | ||
/^GRUB_CMDLINE_LINUX=/ { found = 1 } | ||
/^GRUB_CMDLINE_LINUX=/ && !/net.ifnames=0/ { gsub(/"$/, " net.ifnames=0\"") } | ||
/^GRUB_CMDLINE_LINUX=/ && !/biosdevname=0/ { gsub(/"$/, " biosdevname=0\"") } | ||
{ print } | ||
END { if (!found) print "GRUB_CMDLINE_LINUX=\" net.ifnames=0 biosdevname=0\"" >> FILENAME } | ||
EOF | ||
|
||
gawk -i inplace -f- /etc/default/grub <<'EOF' | ||
BEGIN { update = "GRUB_TIMEOUT=0" } | ||
/^GRUB_TIMEOUT=/ { $0 = update; found = 1 } | ||
{ print } | ||
END { if (!found) print update >> FILENAME } | ||
EOF | ||
|
||
# Cleanup. | ||
|
||
gawk -i inplace -f- /etc/default/grub <<'EOF' | ||
{ gsub(/(" *| *")/, "\""); gsub(/ */, " ") } | ||
{ print } | ||
EOF | ||
|
||
dnf install -y dracut-config-generic dracut-network | ||
|
||
INITRAMFS_IMG=$(find /boot/ -maxdepth 1 -name 'initramfs-*.img' ! -name '*rescue*' ! -name '*kdump*' | sort -V | tail -1) | ||
INITRAMFS_VER=$(sed -e 's/^.*initramfs-//' -e 's/\.img$//' <<< "$INITRAMFS_IMG") | ||
dracut --force "$INITRAMFS_IMG" "$INITRAMFS_VER" | ||
|
||
grub2-mkconfig -o /boot/grub2/grub.cfg | ||
|
||
sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Downloads and installs the latest one-context package. | ||
|
||
: "${CTX_SUFFIX:=.el8.noarch.rpm}" | ||
|
||
exec 1>&2 | ||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
if ! stat /context/one-context*$CTX_SUFFIX; then ( | ||
install -d /context/ && cd /context/ | ||
curl -fsSL https://api.github.com/repos/OpenNebula/addon-context-linux/releases \ | ||
| jq -r ".[0].assets[].browser_download_url | select(endswith(\"$CTX_SUFFIX\"))" \ | ||
| xargs -r -n1 curl -fsSLO | ||
) fi | ||
|
||
dnf install -y /context/one-context*$CTX_SUFFIX haveged open-vm-tools | ||
|
||
systemctl enable haveged | ||
|
||
# >>> Apply only on one-context >= 6.1 >>> | ||
if ! rpm -q --queryformat '%{VERSION}' one-context | grep -E '^([1-5]\.|6\.0\.)'; then | ||
dnf install -y --setopt=install_weak_deps=False NetworkManager systemd-networkd | ||
fi | ||
# <<< Apply only on one-context >= 6.1 <<< | ||
|
||
sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Configures critical settings for OpenSSH server. | ||
|
||
exec 1>&2 | ||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
gawk -i inplace -f- /etc/ssh/sshd_config <<'EOF' | ||
BEGIN { update = "PasswordAuthentication no" } | ||
/^[#\s]*PasswordAuthentication\s*/ { $0 = update; found = 1 } | ||
{ print } | ||
END { if (!found) print update >> FILENAME } | ||
EOF | ||
|
||
gawk -i inplace -f- /etc/ssh/sshd_config <<'EOF' | ||
BEGIN { update = "PermitRootLogin without-password" } | ||
/^[#\s]*PermitRootLogin\s*/ { $0 = update; found = 1 } | ||
{ print } | ||
END { if (!found) print update >> FILENAME } | ||
EOF | ||
|
||
gawk -i inplace -f- /etc/ssh/sshd_config <<'EOF' | ||
BEGIN { update = "UseDNS no" } | ||
/^[#\s]*UseDNS\s*/ { $0 = update; found = 1 } | ||
{ print } | ||
END { if (!found) print update >> FILENAME } | ||
EOF | ||
|
||
sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Cleans DNF caches, removes temporary files / logs, | ||
# removes leftover / temporary unneeded packages. | ||
|
||
exec 1>&2 | ||
set -o errexit -o nounset -o pipefail | ||
set -x | ||
|
||
kdump="kdump.service" | ||
systemctl list-units --full -all | grep -Fq "$kdump" && systemctl disable "$kdump" | ||
|
||
# Remove old kernels. | ||
dnf remove -y $(dnf repoquery --installonly --latest-limit=-1 -q) | ||
|
||
dnf remove -y fwupd linux-firmware | ||
|
||
dnf clean -y all | ||
|
||
rm -rf /boot/*-rescue-* | ||
rm -rf /context/ | ||
|
||
sync |
Oops, something went wrong.