888 lines
31 KiB
Bash
888 lines
31 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -euxo pipefail
|
||
|
|
||
|
#======================================
|
||
|
# Functions...
|
||
|
#--------------------------------------
|
||
|
test -f /.kconfig && . /.kconfig
|
||
|
test -f /.profile && . /.profile
|
||
|
|
||
|
#======================================
|
||
|
# Greeting...
|
||
|
#--------------------------------------
|
||
|
echo "Configure image: [$kiwi_iname]-[$kiwi_profiles]..."
|
||
|
|
||
|
################################################################################
|
||
|
# ALL OF OUR FUNCTIONS
|
||
|
function common_live_steps() {
|
||
|
# this isn't needed in our testing, but we'll put it here just in case
|
||
|
systemctl set-default graphical.target
|
||
|
systemctl enable livesys.service livesys-late.service
|
||
|
systemctl enable tmp.mount
|
||
|
cat >> /etc/fstab << EOF
|
||
|
vartmp /var/tmp tmpfs defaults 0 0
|
||
|
EOF
|
||
|
rm -f /var/lib/rpm/__db*
|
||
|
majorver=$(rpm --eval '%{rhel}')
|
||
|
rpm --import "/etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-${majorver}"
|
||
|
rm -f /var/lib/rpm/__db*
|
||
|
/usr/bin/mandb
|
||
|
rm -f /core*
|
||
|
rm -f /boot/*-rescue*
|
||
|
}
|
||
|
|
||
|
function live_gnome_steps() {
|
||
|
sed -i 's/^livesys_session=.*/livesys_session="gnome"/' /etc/sysconfig/livesys
|
||
|
}
|
||
|
|
||
|
function live_kde_steps() {
|
||
|
sed -i 's/^livesys_session=.*/livesys_session="kde"/' /etc/sysconfig/livesys
|
||
|
cat > /root/.gtkrc-2.0 << EOF
|
||
|
include "/usr/share/themes/Adwaita/gtk-2.0/gtkrc"
|
||
|
include "/etc/gtk-2.0/gtkrc"
|
||
|
gtk-theme-name="Adwaita"
|
||
|
EOF
|
||
|
mkdir -p /root/.config/gtk-3.0
|
||
|
cat > /root/.config/gtk-3.0/settings.ini << EOF
|
||
|
[Settings]
|
||
|
gtk-theme-name = Adwaita
|
||
|
EOF
|
||
|
|
||
|
rm -f /usr/share/wallpapers/Fedora
|
||
|
ln -s rocky-abstract-2 /usr/share/wallpapers/Fedora
|
||
|
|
||
|
systemctl enable --force sddm.service
|
||
|
|
||
|
cat > /etc/sddm.conf.d/theme.conf <<THEMEEOF
|
||
|
[Theme]
|
||
|
Current=breeze
|
||
|
THEMEEOF
|
||
|
}
|
||
|
|
||
|
function live_cinnamon_steps() {
|
||
|
sed -i 's/^livesys_session=.*/livesys_session="cinnamon"/' /etc/sysconfig/livesys
|
||
|
cat > /etc/sysconfig/desktop <<EOF
|
||
|
PREFERRED=/usr/bin/cinnamon-session
|
||
|
DISPLAYMANAGER=/usr/sbin/lightdm
|
||
|
EOF
|
||
|
systemctl enable --force lightdm.service
|
||
|
}
|
||
|
|
||
|
function live_mate_steps() {
|
||
|
sed -i 's/^livesys_session=.*/livesys_session="mate"/' /etc/sysconfig/livesys
|
||
|
systemctl enable --force lightdm.service
|
||
|
}
|
||
|
|
||
|
function live_xfce_steps() {
|
||
|
sed -i 's/^livesys_session=.*/livesys_session="xfce"/' /etc/sysconfig/livesys
|
||
|
systemctl enable --force lightdm.service
|
||
|
cat > /etc/sysconfig/desktop <<EOF
|
||
|
PREFERRED=/usr/bin/startxfce4
|
||
|
DISPLAYMANAGER=/usr/sbin/lightdm
|
||
|
EOF
|
||
|
|
||
|
# set default background
|
||
|
cat > /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml <<XFCEEOF
|
||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
|
||
|
<channel name="xfce4-desktop" version="1.0">
|
||
|
<property name="backdrop" type="empty">
|
||
|
<property name="screen0" type="empty">
|
||
|
<property name="monitor0" type="empty">
|
||
|
<property name="color-style" type="int" value="0"/>
|
||
|
<property name="image-style" type="int" value="5"/>
|
||
|
<property name="last-image" type="string" value="/usr/share/backgrounds/rocky-default-9-abstract-2-day.png"/>
|
||
|
<property name="last-single-image" type="string" value="/usr/share/backgrounds/rocky-default-9-abstract-2-day.png"/>
|
||
|
<property name="image-path" type="string" value="/usr/share/backgrounds/rocky-default-9-abstract-2-day.png"/>
|
||
|
</property>
|
||
|
</property>
|
||
|
</property>
|
||
|
</channel>
|
||
|
XFCEEOF
|
||
|
}
|
||
|
|
||
|
function epel_de_steps() {
|
||
|
dnf config-manager --set-enabled crb
|
||
|
}
|
||
|
|
||
|
# live fixes if we need them
|
||
|
function live_fixes() {
|
||
|
sed -i "s/org.fedoraproject.AnacondaInstaller/anaconda/" /usr/share/applications/liveinst.desktop
|
||
|
}
|
||
|
|
||
|
function common_cloud_steps() {
|
||
|
# This can be done via systemctl set-default, but sometimes it doesn't work.
|
||
|
# systemctl set-default multi-user.target
|
||
|
rm -f /etc/systemd/system/default.target
|
||
|
ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
|
||
|
|
||
|
# chrony should already be enabled, let's make sure
|
||
|
systemctl enable chronyd
|
||
|
# make a persistent journal
|
||
|
mkdir -p /var/log/journal
|
||
|
|
||
|
dnf -C -y remove linux-firmware avahi\*
|
||
|
dnf -C -y remove firewalld --setopt="clean_requirements_on_remove=1"
|
||
|
dnf -C -y remove langpacks-*
|
||
|
sed -i '/^#NAutoVTs=.*/ a\
|
||
|
NAutoVTs=0' /etc/systemd/logind.conf
|
||
|
truncate -s 0 /etc/resolv.conf
|
||
|
if [ -f /etc/tuned/active_profile ]; then
|
||
|
echo "virtual-guest" > /etc/tuned/active_profile
|
||
|
fi
|
||
|
rm -f /etc/udev/rules.d/70*
|
||
|
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
|
||
|
cat > /etc/sysconfig/network << EOF
|
||
|
NETWORKING=yes
|
||
|
NOZEROCONF=yes
|
||
|
EOF
|
||
|
cat > /etc/hosts << EOF
|
||
|
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
|
||
|
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
|
||
|
|
||
|
EOF
|
||
|
|
||
|
echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
|
||
|
|
||
|
echo -e 'rocky\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
||
|
sed -i '1i # Modified for cloud image' /etc/cloud/cloud.cfg
|
||
|
sed -i 's/name: cloud-user/name: rocky/g' /etc/cloud/cloud.cfg
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# Azure
|
||
|
function azure_cloud_steps() {
|
||
|
echo 'azure' > /etc/dnf/vars/infra
|
||
|
cat << EOF | tee -a /etc/NetworkManager/conf.d/dhcp-timeout.conf
|
||
|
# Configure dhcp timeout to 300s by default
|
||
|
[connection]
|
||
|
ipv4.dhcp-timeout=300
|
||
|
EOF
|
||
|
systemctl enable waagent
|
||
|
sed -i 's/Provisioning.UseCloudInit=n/Provisioning.UseCloudInit=y/g' /etc/waagent.conf
|
||
|
sed -i 's/Provisioning.Enabled=y/Provisioning.Enabled=n/g' /etc/waagent.conf
|
||
|
cat << EOF | tee -a /etc/udev/rules.d/68-azure-sriov-nm-unmanaged.rules
|
||
|
# Accelerated Networking on Azure exposes a new SRIOV interface to the VM.
|
||
|
# This interface is transparently bonded to the synthetic interface,
|
||
|
# so NetworkManager should just ignore any SRIOV interfaces.
|
||
|
SUBSYSTEM=="net", DRIVERS=="hv_pci", ACTION=="add", ENV{NM_UNMANAGED}="1"
|
||
|
EOF
|
||
|
|
||
|
cat << EOF | tee -a /etc/udev/rules.d/98-hyperv-ptp.rules
|
||
|
## See: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/time-sync#check-for-ptp-clock-source
|
||
|
SUBSYSTEM=="ptp", ATTR{clock_name}=="hyperv", SYMLINK += "ptp_hyperv"
|
||
|
EOF
|
||
|
|
||
|
cat << EOF | tee -a /etc/chrony.conf
|
||
|
# Setup hyperv PTP device as refclock
|
||
|
refclock PHC /dev/ptp_hyperv poll 3 dpoll -2 offset 0 stratum 2
|
||
|
EOF
|
||
|
|
||
|
cat << EOF | tee -a /etc/modprobe.d/azure-blacklist.conf
|
||
|
blacklist amdgpu
|
||
|
blacklist nouveau
|
||
|
blacklist radeon
|
||
|
EOF
|
||
|
|
||
|
cat << EOF | tee /etc/cloud/cloud.cfg.d/10-azure-kvp.cfg
|
||
|
# Enable logging to the Hyper-V kvp in Azure
|
||
|
reporting:
|
||
|
logging:
|
||
|
type: log
|
||
|
telemetry:
|
||
|
type: hyperv
|
||
|
EOF
|
||
|
|
||
|
cat << EOF | tee -a /etc/dracut.conf.d/80-azure.conf
|
||
|
add_drivers+=" hv_vmbus hv_netvsc hv_storvsc "
|
||
|
EOF
|
||
|
|
||
|
#dracut -f -v
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# EC2
|
||
|
function ec2_cloud_steps() {
|
||
|
echo 'ec2' > /etc/dnf/vars/infra
|
||
|
cat >> /etc/dhcp/dhclient.conf << EOF
|
||
|
timeout 300;
|
||
|
retry 60;
|
||
|
EOF
|
||
|
|
||
|
if [ -f /boot/grub2/grub.conf ]; then
|
||
|
sed -i -e 's/ rhgb quiet//' /boot/grub2/grub.conf
|
||
|
fi
|
||
|
sed -i -e 's/ rhgb quiet//' /etc/default/grub
|
||
|
cat > /etc/modprobe.d/blacklist-nouveau.conf << EOL
|
||
|
blacklist nouveau
|
||
|
EOL
|
||
|
|
||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||
|
DEVICE="eth0"
|
||
|
ONBOOT="yes"
|
||
|
BOOTPROTO="dhcp"
|
||
|
TYPE="Ethernet"
|
||
|
USERCTL="no"
|
||
|
PEERDNS="yes"
|
||
|
IPV6INIT="no"
|
||
|
PERSISTENT_DHCLIENT="1"
|
||
|
EOF
|
||
|
|
||
|
echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf
|
||
|
echo 'add_drivers+=" xen-netfront xen-blkfront "' > /etc/dracut.conf.d/xen.conf
|
||
|
#KERNEL_VERSION=$(rpm -q kernel --qf '%{V}-%{R}.%{arch}\n')
|
||
|
#dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
|
||
|
|
||
|
cat >> /etc/chrony.conf << EOF
|
||
|
# Amazon Time Sync Service
|
||
|
server 169.254.169.123 prefer iburst minpoll 4 maxpoll 4
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# Generic Cloud (genclo)
|
||
|
function genclo_cloud_steps() {
|
||
|
echo 'genclo' > /etc/dnf/vars/infra
|
||
|
cat >> /etc/dhcp/dhclient.conf << EOF
|
||
|
timeout 300;
|
||
|
retry 60;
|
||
|
EOF
|
||
|
|
||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||
|
DEVICE="eth0"
|
||
|
ONBOOT="yes"
|
||
|
BOOTPROTO="dhcp"
|
||
|
BOOTPROTOV6="dhcp"
|
||
|
TYPE="Ethernet"
|
||
|
USERCTL="no"
|
||
|
PEERDNS="yes"
|
||
|
IPV6INIT="yes"
|
||
|
PERSISTENT_DHCLIENT="1"
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# OCP
|
||
|
function ocp_cloud_steps() {
|
||
|
cat >> /etc/dhcp/dhclient.conf << EOF
|
||
|
timeout 300;
|
||
|
retry 60;
|
||
|
EOF
|
||
|
|
||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||
|
DEVICE="eth0"
|
||
|
ONBOOT="yes"
|
||
|
BOOTPROTO="dhcp"
|
||
|
TYPE="Ethernet"
|
||
|
USERCTL="no"
|
||
|
PEERDNS="yes"
|
||
|
IPV6INIT="no"
|
||
|
PERSISTENT_DHCLIENT="1"
|
||
|
EOF
|
||
|
|
||
|
# OCI - Import repo GPG key
|
||
|
cat <<EOF > /tmp/key
|
||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||
|
|
||
|
mQINBGHncu8BEAC2dhocMZkdapnP9o/MvAnKOczaSpF4Cj9yqt49bxLPJCY57jz9
|
||
|
2ZkJ5iGk6kpBt4rPTh18aAl30T+nPP8VMQjMhvH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
r4ArVJYX5LrswnWEQMOelugUG6S3ZjMfcyOa/O0364iY73vyVgaYK+2XtT2usMux
|
||
|
VL469Kj5m13T6w==
|
||
|
=Mjs/
|
||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||
|
EOF
|
||
|
|
||
|
rpm --import /tmp/key
|
||
|
# remove these for debugging
|
||
|
if [ -f /boot/grub2/grub.conf ]; then
|
||
|
sed -i -e 's/ rhgb quiet//' /boot/grub2/grub.conf
|
||
|
fi
|
||
|
sed -i -e 's/ rhgb quiet//' /etc/default/grub
|
||
|
|
||
|
# enable resizing on copied AMIs
|
||
|
echo 'install_items+=" sgdisk "' > /etc/dracut.conf.d/sgdisk.conf
|
||
|
|
||
|
# OCI - Need iscsi as a dracut module
|
||
|
echo 'add_dracutmodules+=" iscsi "' > /etc/dracut.conf.d/iscsi.conf
|
||
|
|
||
|
# OCI - Virtio drivers
|
||
|
echo 'add_drivers+=" virtio virtio_blk virtio_net virtio_pci virtio_ring virtio_scsi virtio_console "' > /etc/dracut.conf.d/virtio.conf
|
||
|
|
||
|
# OCI - YOLO
|
||
|
mkdir -p /usr/lib/dracut/modules.d/95oci
|
||
|
OCIDRACUT="H4sIAGtFHmMAA+2WWW/bOBCA/Vr+illZzQXoluPUhgMURYrmpS02fevuGpJIWYQVUiWpJoHr/15S
|
||
|
crLZZBs3QA8U5QfYosQ5NUNSrRRBTfMAi6xoVXDOcVsT6ePg2YgXNBh8C0LNeDTqrpq7124cpfF4
|
||
|
nIzT8fhwEEaj+HA8gNE38b6FVqpMAAwE5+ohuW3zvyjtw/UnLMtr4lFZSOrlV00mpS+rR/rYUv84
|
||
|
StJBlIx10ZNREscD/SRNkwGE3yXjO/zm9R/+EeSUBbJCQ/AOPNANQCYgK1LXniwEbdQUKMOEKU9l
|
||
|
ufT6eUbrqRby8kzSwuNlKYmaQDo1JrQhcjkBJWdHIC9mKUg9TIEoKGlN1FVDZtobGr7NVFFB11nm
|
||
|
3YLikNU1v4A8ozXwVgEtQVUE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cyBkaXNhYmxlZAojLSByaF9zdWJzY3Jp
|
||
|
cHRpb24KIC0geXVtLWFkZC1yZXBvCiAtIHBhY2thZ2UtdXBkYXRlLXVwZ3JhZGUtaW5zdGFsbAog
|
||
|
LSB0aW1lem9uZQogLSBudHAKIC0gcHVwcGV0CiAtIGNoZWYKIC0gc2FsdC1taW5pb24KIC0gbWNv
|
||
|
bGxlY3RpdmUKIC0gZGlzYWJsZS1lYzItbWV0YWRhdGEKIC0gcnVuY21kCgpjbG91ZF9maW5hbF9t
|
||
|
b2R1bGVzOgogLSByaWdodHNjYWxlX3VzZXJkYXRhCiAtIHNjcmlwdHMtcGVyLW9uY2UKIC0gc2Ny
|
||
|
aXB0cy1wZXItYm9vdAogLSBzY3JpcHRzLXBlci1pbnN0YW5jZQogLSBzY3JpcHRzLXVzZXIKIC0g
|
||
|
c3NoLWF1dGhrZXktZmluZ2VycHJpbnRzCiAtIGtleXMtdG8tY29uc29sZQogLSBwaG9uZS1ob21l
|
||
|
CiAtIGZpbmFsLW1lc3NhZ2UKIyBPQ0k6IHBvd2VyLXN0YXRlLWNoYW5nZSBpcyBkaXNhYmxlZAoj
|
||
|
LSBwb3dlci1zdGF0ZS1jaGFuZ2UKCg=="
|
||
|
|
||
|
base64 -d <<<"$OCICLOUDCFG" >> /etc/cloud/cloud.cfg.d/99_oci.cfg
|
||
|
|
||
|
# Remove system.devices because Oracle does things.
|
||
|
rm -fv /etc/lvm/devices/system.devices
|
||
|
|
||
|
}
|
||
|
|
||
|
function cloud_cleanup_steps() {
|
||
|
truncate -c -s 0 /var/log/dnf.log
|
||
|
rm -rf /var/log/yum.log
|
||
|
rm -rf /var/lib/yum/*
|
||
|
rm -rf /root/install.log
|
||
|
rm -rf /root/install.log.syslog
|
||
|
rm -rf /root/anaconda-ks.cfg
|
||
|
rm -rf /var/log/anaconda*
|
||
|
|
||
|
rm -f /var/lib/systemd/random-seed
|
||
|
|
||
|
touch /var/log/cron
|
||
|
touch /var/log/boot.log
|
||
|
mkdir -p /var/cache/yum
|
||
|
|
||
|
# Azure Only
|
||
|
if [[ "$kiwi_profiles" == *"Azure"* ]]; then
|
||
|
rm -f /var/log/waagent.log
|
||
|
cloud-init clean
|
||
|
waagent -force -deprovision+user
|
||
|
fi
|
||
|
|
||
|
# Attempt to fix file permissions
|
||
|
for x in $(rpm -qa); do rpm --setperms "${x}" ; done
|
||
|
|
||
|
# Attempt to fix labeling
|
||
|
/usr/sbin/fixfiles -R -a restore
|
||
|
}
|
||
|
|
||
|
function azure_cleanup_steps() {
|
||
|
rm -f /var/log/waagent.log
|
||
|
cloud-init clean
|
||
|
waagent -force -deprovision+user
|
||
|
}
|
||
|
|
||
|
function common_container_steps() {
|
||
|
/bin/date +%Y-%m-%d_%H:%M:%S > /etc/BUILDTIME
|
||
|
echo 'container' > /etc/dnf/vars/infra
|
||
|
LANG="en_US"
|
||
|
echo "%_install_langs $LANG" > /etc/rpm/macros.image-language-conf
|
||
|
echo 'LANG="C.UTF-8"' > /etc/locale.conf
|
||
|
releasever=$(rpm --eval '%{?rocky}')
|
||
|
rpm --import "/etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-${releasever}"
|
||
|
:> /etc/machine-id
|
||
|
echo "# placeholder" > /etc/resolv.conf
|
||
|
chmod 644 /etc/resolv.conf
|
||
|
rm -rf /tmp/*
|
||
|
printf "tsflags=nodocs\n" >>/etc/dnf/dnf.conf
|
||
|
}
|
||
|
|
||
|
function minimal_container_steps() {
|
||
|
microdnf -y remove langpacks-en || true
|
||
|
rm -fv /usr/share/gnupg/help*.txt
|
||
|
rm /usr/lib/rpm/rpm.daily
|
||
|
rm -rfv /usr/lib64/nss/unsupported-tools/
|
||
|
rm -fv /usr/sbin/{glibc_post_upgrade.x86_64,sln}
|
||
|
ln /usr/bin/ln usr/sbin/sln
|
||
|
rm -rfv /var/lib/dnf
|
||
|
rm -rfv /usr/share/icons/*
|
||
|
rm -fv /usr/bin/pinky
|
||
|
rm -rfv /usr/lib/systemd
|
||
|
}
|
||
|
|
||
|
function toolbox_container_steps() {
|
||
|
rm -f /etc/rpm/macros.image-language-conf
|
||
|
sed -i '/tsflags=nodocs/d' /etc/dnf/dnf.conf
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# Vagrant
|
||
|
function common_vagrant_steps() {
|
||
|
fallocate -l 2G /swapfile
|
||
|
chmod 600 /swapfile
|
||
|
mkswap /swapfile
|
||
|
echo "/swapfile none swap defaults 0 0" >> /etc/fstab
|
||
|
|
||
|
cat > /etc/sudoers.d/vagrant << EOF
|
||
|
Defaults:vagrant !requiretty
|
||
|
%vagrant ALL=(ALL) NOPASSWD: ALL
|
||
|
EOF
|
||
|
chmod 0440 /etc/sudoers.d/vagrant
|
||
|
# This may have to be changed for 10
|
||
|
sed -i 's/^\(PasswordAuthentication\) yes$/\1 no/' /etc/ssh/sshd_config
|
||
|
sed -i 's/^#\(UseDNS\) yes$/\r\1 no/' /etc/ssh/sshd_config
|
||
|
|
||
|
cat >>/etc/sysconfig/sshd <<EOF
|
||
|
# Decrease connection time by preventing reverse DNS lookups
|
||
|
# (see https://lists.centos.org/pipermail/centos-devel/2016-July/014981.html)
|
||
|
OPTIONS="-u0"
|
||
|
EOF
|
||
|
|
||
|
# Setup insecure key by default
|
||
|
mkdir -m 0700 -p /home/vagrant/.ssh
|
||
|
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" >> /home/vagrant/.ssh/authorized_keys
|
||
|
chmod 600 /home/vagrant/.ssh/authorized_keys
|
||
|
chown -R vagrant:vagrant /home/vagrant/.ssh
|
||
|
|
||
|
echo 'vag' > /etc/yum/vars/infra
|
||
|
echo blacklist floppy > /etc/modprobe.d/nofloppy.conf
|
||
|
pushd /etc/dracut.conf.d
|
||
|
# Enable VMware PVSCSI support for VMware Fusion guests.
|
||
|
echo 'add_drivers+=" vmw_pvscsi "' > vmware-fusion-drivers.conf
|
||
|
echo 'add_drivers+=" hv_netvsc hv_storvsc hv_utils hv_vmbus hid-hyperv "' > hyperv-drivers.conf
|
||
|
# There's no floppy controller, but probing for it generates timeouts
|
||
|
echo 'omit_drivers+=" floppy "' > nofloppy.conf
|
||
|
popd
|
||
|
#echo "Regenerating kernel"
|
||
|
#KERNEL_VERSION=$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n')
|
||
|
#dracut -f -v
|
||
|
rm -rf /etc/ssh/ssh_host_*
|
||
|
|
||
|
# Might not be needed for 10
|
||
|
ex -s /etc/pam.d/su <<'EOF'
|
||
|
/^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/
|
||
|
:append
|
||
|
account [success=1 default=ignore] \\
|
||
|
pam_succeed_if.so user = vagrant use_uid quiet
|
||
|
account required pam_succeed_if.so user notin root:vagrant
|
||
|
.
|
||
|
:update
|
||
|
:quit
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
function vbox_vagrant_steps() {
|
||
|
# legacy stuff, we won't have this for 10
|
||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||
|
DEVICE="eth0"
|
||
|
BOOTPROTO="dhcp"
|
||
|
ONBOOT="yes"
|
||
|
TYPE="Ethernet"
|
||
|
PERSISTENT_DHCLIENT="yes"
|
||
|
EOF
|
||
|
|
||
|
# Install VBoxGuestAdditions for installed kernel.
|
||
|
# https://git.resf.org/sig_kernel/meta/issues/13
|
||
|
#kver=$(rpm -q --queryformat="%{VERSION}-%{RELEASE}.%{ARCH}" kernel)
|
||
|
#echo "stg/rocky" > /etc/dnf/vars/contentdir
|
||
|
#sed -i 's/^#baseurl/baseurl/g;s/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/rocky*repo
|
||
|
#dnf -y install kernel-headers-$kver kernel-devel gcc make perl elfutils-libelf-devel
|
||
|
#sed -i 's/^baseurl/#baseurl/g;s/^#mirrorlist/mirrorlist/g' /etc/yum.repos.d/rocky*repo
|
||
|
#echo "pub/rocky" > /etc/dnf/vars/contentdir
|
||
|
#curl -L -o /tmp/vboxadditions.iso https://download.virtualbox.org/virtualbox/7.0.16/VBoxGuestAdditions_7.0.16.iso
|
||
|
#mkdir -p /media/VBoxGuestAdditions
|
||
|
#mount -o loop,ro /tmp/vboxadditions.iso /media/VBoxGuestAdditions
|
||
|
#mkdir -p /tmp/VBoxGuestAdditions
|
||
|
#sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run --nox11 --noexec --keep --target /tmp/VBoxGuestAdditions
|
||
|
#pushd /tmp/VBoxGuestAdditions
|
||
|
#./install.sh
|
||
|
#/sbin/rcvboxadd quicksetup all
|
||
|
#popd
|
||
|
#ls "/lib/modules/${kver}/misc/"
|
||
|
#modinfo "/lib/modules/${kver}/misc/vboxsf.ko"
|
||
|
#rm -rf /tmp/VBoxGuestAdditions
|
||
|
#umount /media/VBoxGuestAdditions
|
||
|
#rm -f /tmp/vboxadditions.iso
|
||
|
#rmdir /media/VBoxGuestAdditions
|
||
|
#dnf -y remove kernel-devel gcc make perl elfutils-libelf-devel
|
||
|
}
|
||
|
|
||
|
function libvirt_vagrant_steps() {
|
||
|
# legacy stuff, we won't have this for 10
|
||
|
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF
|
||
|
DEVICE="eth0"
|
||
|
BOOTPROTO="dhcp"
|
||
|
ONBOOT="yes"
|
||
|
TYPE="Ethernet"
|
||
|
PERSISTENT_DHCLIENT="yes"
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
################################################################################
|
||
|
# SBC
|
||
|
function common_sbc_steps() {
|
||
|
:> /etc/machine-id
|
||
|
rm -f /etc/sysconfig/network-scripts/ifcfg-link
|
||
|
rm -f /etc/ssh/*_key*
|
||
|
dnf clean all
|
||
|
chown -R sssd:sssd /var/lib/sss/{db,pipes,mc,pubconf,gpo_cache}
|
||
|
cat > /etc/sysconfig/cpupower << EOF
|
||
|
CPUPOWER_START_OPTS="frequency-set -g ondemand"
|
||
|
CPUPOWER_STOP_OPTS="frequency-set -g ondemand"
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
function raspberrypi_sbc_steps() {
|
||
|
cd /lib/firmware/brcm
|
||
|
xz -d -k brcmfmac43430-sdio.raspberrypi,3-model-b.txt.xz
|
||
|
cat > /boot/cmdline.txt << EOF
|
||
|
console=ttyAMA0,115200 console=tty1 root=LABEL=RPIROOT rootfstype=ext4 elevator=deadline rootwait
|
||
|
EOF
|
||
|
}
|
||
|
|
||
|
function genericarm_sbc_steps() {
|
||
|
mkdir -p /boot/efi/EFI/BOOT
|
||
|
if [ -d /boot/efi/EFI/rocky/ ] && [ -f /boot/efi/EFI/rocky/grubaa64.efi ];then
|
||
|
for j in grub.cfg grubenv;do
|
||
|
if [ -f "/boot/grub2/${j}" ]; then
|
||
|
mv -f /boot/grub2/${j} /boot/efi/EFI/rocky/
|
||
|
ln -s ../efi/EFI/rocky/${j} /boot/grub2/${j}
|
||
|
fi
|
||
|
done
|
||
|
cp -f /boot/efi/EFI/rocky/grubaa64.efi /boot/efi/EFI/BOOT/BOOTAA64.EFI
|
||
|
fi
|
||
|
|
||
|
if [ -f /usr/share/uboot/rpi_3/u-boot.bin ]; then
|
||
|
cp -f /usr/share/uboot/rpi_3/u-boot.bin /boot/efi/rpi3-u-boot.bin
|
||
|
fi
|
||
|
if [ -f /usr/share/uboot/rpi_4/u-boot.bin ]; then
|
||
|
cp -f /usr/share/uboot/rpi_4/u-boot.bin /boot/efi/rpi4-u-boot.bin
|
||
|
fi
|
||
|
if [ -f /usr/share/uboot/rpi_arm64/u-boot.bin ]; then
|
||
|
cp -f /usr/share/uboot/rpi_arm64/u-boot.bin /boot/efi/rpi-u-boot.bin
|
||
|
fi
|
||
|
|
||
|
rpm -e dracut-config-generic
|
||
|
if [ -x /lib/kernel/install.d/10-devicetree.install ]; then
|
||
|
/lib/kernel/install.d/10-devicetree.install remove
|
||
|
fi
|
||
|
|
||
|
cat << EOF > /etc/sysconfig/kernel
|
||
|
# Written by image installer
|
||
|
# UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default
|
||
|
UPDATEDEFAULT=yes
|
||
|
|
||
|
# DEFAULTKERNEL specifies the default kernel package type
|
||
|
DEFAULTKERNEL=kernel-core
|
||
|
EOF
|
||
|
chmod 644 /etc/sysconfig/kernel
|
||
|
|
||
|
### Write grub defaults, turn off OS probing as it is always wrong for image creation
|
||
|
cat << EOF > /etc/default/grub
|
||
|
GRUB_TIMEOUT=5
|
||
|
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
|
||
|
GRUB_DEFAULT=saved
|
||
|
GRUB_DISABLE_SUBMENU=true
|
||
|
GRUB_TERMINAL_OUTPUT="console"
|
||
|
GRUB_CMDLINE_LINUX=""
|
||
|
GRUB_DISABLE_RECOVERY="true"
|
||
|
GRUB_DISABLE_OS_PROBER="true"
|
||
|
GRUB_ENABLE_BLSCFG="false"
|
||
|
EOF
|
||
|
chmod 644 /etc/default/grub
|
||
|
rm -f /boot/dtb
|
||
|
|
||
|
cat >/usr/local/bin/rootfs-expand << EOF
|
||
|
#!/bin/bash
|
||
|
clear
|
||
|
part=\$(mount |grep '^/dev.* / ' |awk '{print \$1}')
|
||
|
if [ -z "\$part" ];then
|
||
|
echo "Error detecting rootfs"
|
||
|
exit -1
|
||
|
fi
|
||
|
dev=\$(echo \$part|sed 's/[0-9]*\$//g')
|
||
|
devlen=\${#dev}
|
||
|
num=\${part:\$devlen}
|
||
|
if [[ "\$dev" =~ ^/dev/mmcblk[0-9]*p\$ ]];then
|
||
|
dev=\${dev:0:-1}
|
||
|
fi
|
||
|
if [ ! -x /usr/bin/growpart ];then
|
||
|
echo "Please install cloud-utils-growpart (sudo yum install cloud-utils-growpart)"
|
||
|
exit -2
|
||
|
fi
|
||
|
if [ ! -x /usr/sbin/resize2fs ];then
|
||
|
echo "Please install e2fsprogs (sudo yum install e2fsprogs)"
|
||
|
exit -3
|
||
|
fi
|
||
|
echo \$part \$dev \$num
|
||
|
|
||
|
echo "Extending partition \$num to max size ...."
|
||
|
growpart \$dev \$num
|
||
|
echo "Resizing ext4 filesystem ..."
|
||
|
resize2fs \$part
|
||
|
echo "Done."
|
||
|
df -h |grep \$part
|
||
|
EOF
|
||
|
chmod +x /usr/local/bin/rootfs-expand
|
||
|
}
|
||
|
|
||
|
#
|
||
|
################################################################################
|
||
|
|
||
|
cat /dev/null > /etc/machine-id
|
||
|
|
||
|
# Gets around grub-bls issue
|
||
|
echo "GRUB_DEFAULT=saved" >> /etc/default/grub
|
||
|
|
||
|
# All cloud and live
|
||
|
if [[ "$kiwi_profiles" == *"Cloud"* ]] || [[ "$kiwi_profiles" == *"Live"* ]]; then
|
||
|
passwd -d root
|
||
|
passwd -l root
|
||
|
fi
|
||
|
|
||
|
################################################################################
|
||
|
# Just about all the cloud images should do these things.
|
||
|
if [[ "$kiwi_profiles" == *"Cloud"* ]]; then
|
||
|
common_cloud_steps
|
||
|
fi
|
||
|
|
||
|
################################################################################
|
||
|
# Azure specific settings
|
||
|
if [[ "$kiwi_profiles" == *"Azure"* ]]; then
|
||
|
azure_cloud_steps
|
||
|
fi
|
||
|
|
||
|
################################################################################
|
||
|
# EC2 specific settings
|
||
|
if [[ "$kiwi_profiles" == *"EC2"* ]]; then
|
||
|
ec2_cloud_steps
|
||
|
fi
|
||
|
|
||
|
################################################################################
|
||
|
# GenClo specific settings
|
||
|
if [[ "$kiwi_profiles" == *"GenericCloud"* ]]; then
|
||
|
genclo_cloud_steps
|
||
|
fi
|
||
|
|
||
|
################################################################################
|
||
|
# OCP specific settings
|
||
|
if [[ "$kiwi_profiles" == *"OCP"* ]]; then
|
||
|
ocp_cloud_steps
|
||
|
fi
|
||
|
|
||
|
# cloud clean up
|
||
|
if [[ "$kiwi_profiles" == *"Cloud"* ]]; then
|
||
|
echo "cleanup time"
|
||
|
cloud_cleanup_steps
|
||
|
|
||
|
# Azure Only
|
||
|
if [[ "$kiwi_profiles" == *"Azure"* ]]; then
|
||
|
azure_cleanup_steps
|
||
|
fi
|
||
|
|
||
|
rm -f ~/.bash_history
|
||
|
export HISTSIZE=0
|
||
|
fi
|
||
|
|
||
|
# Live Images Only
|
||
|
if [[ "$kiwi_profiles" == *"Live"* ]]; then
|
||
|
common_live_steps
|
||
|
if [[ "$kiwi_profiles" == *"Workstation"* ]]; then
|
||
|
live_gnome_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"KDE"* ]]; then
|
||
|
live_kde_steps
|
||
|
epel_de_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"Cinnamon"* ]]; then
|
||
|
live_cinnamon_steps
|
||
|
epel_de_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"MATE"* ]]; then
|
||
|
live_mate_steps
|
||
|
epel_de_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"XFCE"* ]]; then
|
||
|
live_xfce_steps
|
||
|
epel_de_steps
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# Containers only
|
||
|
if [[ "$kiwi_profiles" == *"Container"* ]]; then
|
||
|
common_container_steps
|
||
|
if [[ "$kiwi_profiles" == *"Container-Minimal"* ]]; then
|
||
|
minimal_container_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"Container-Toolbox"* ]]; then
|
||
|
toolbox_container_steps
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# Vagrant only
|
||
|
if [[ "$kiwi_profiles" == *"Vagrant"* ]]; then
|
||
|
common_vagrant_steps
|
||
|
if [[ "$kiwi_profiles" == *"Vagrant-Libvirt"* ]]; then
|
||
|
libvirt_vagrant_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"Vagrant-Vbox"* ]]; then
|
||
|
vbox_vagrant_steps
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
# SBC Only
|
||
|
if [[ "$kiwi_profiles" == *"SBC"* ]]; then
|
||
|
common_sbc_steps
|
||
|
if [[ "$kiwi_profiles" == *"SBC-RaspberryPi"* ]]; then
|
||
|
raspberrypi_sbc_steps
|
||
|
fi
|
||
|
if [[ "$kiwi_profiles" == *"SBC-GenericArm"* ]]; then
|
||
|
genericarm_sbc_steps
|
||
|
fi
|
||
|
fi
|