diff --git a/oracle-linux-image-tools/distr/ol7-slim/image-scripts.sh b/oracle-linux-image-tools/distr/ol7-slim/image-scripts.sh index 2bb3a05..c5e8aa1 100755 --- a/oracle-linux-image-tools/distr/ol7-slim/image-scripts.sh +++ b/oracle-linux-image-tools/distr/ol7-slim/image-scripts.sh @@ -16,7 +16,7 @@ ####################################### # Validate distribution parameters # Globals: -# ROOT_FS +# ROOT_FS TMP_IN_TMPFS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS # Arguments: # None # Returns: @@ -24,11 +24,12 @@ ####################################### distr::validate() { [[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm" + [[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no" [[ "${UEK_RELEASE}" =~ ^[56]$ ]] || error "UEK_RELEASE must be 5 or 6" [[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no" [[ "${STRIP_LOCALES,,}" =~ ^(yes)|(no)$ ]] || error "STRIP_LOCALES must be yes or no" [[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal" - readonly ROOT_FS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS + readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS } ####################################### @@ -75,6 +76,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then sed -i -e 's!^%packages !%packages --excludedocs !' "${ks_file}" fi + + # /tmp in tmpfs + sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}" } ####################################### diff --git a/oracle-linux-image-tools/distr/ol7-slim/ol7-ks.cfg b/oracle-linux-image-tools/distr/ol7-slim/ol7-ks.cfg index df74aac..bc6e499 100644 --- a/oracle-linux-image-tools/distr/ol7-slim/ol7-ks.cfg +++ b/oracle-linux-image-tools/distr/ol7-slim/ol7-ks.cfg @@ -235,4 +235,10 @@ fi sed -i -e 's/^DEFAULTKERNEL=.*/DEFAULTKERNEL='"${kernel}"'/' /etc/sysconfig/kernel yum install -y ${yum_options} ${kernel} + +# use tmpfs for /tmp +TMP_IN_TMPFS=no +if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then + systemctl enable tmp.mount +fi %end diff --git a/oracle-linux-image-tools/distr/ol8-aarch64/image-scripts.sh b/oracle-linux-image-tools/distr/ol8-aarch64/image-scripts.sh index 712bcc8..c0889d8 100755 --- a/oracle-linux-image-tools/distr/ol8-aarch64/image-scripts.sh +++ b/oracle-linux-image-tools/distr/ol8-aarch64/image-scripts.sh @@ -18,7 +18,7 @@ ####################################### # Validate distribution parameters # Globals: -# ISO_LABEL RESCUE_KERNEL ROOT_FS +# ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE KERNEL_MODULES EXCLUDE_DOCS # Arguments: # None # Returns: @@ -27,13 +27,14 @@ distr::validate() { [[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm" [[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO" + [[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no" [[ "${UEK_RELEASE}" =~ ^[67]$ ]] || error "UEK_RELEASE must be 6 or 7" [[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no" [[ -n ${ISO_LABEL} ]] || error "ISO_LABEL must be provided" [[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no" [[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no" [[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal" - readonly ROOT_FS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE EXCLUDE_DOCS + readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE KERNEL_MODULES EXCLUDE_DOCS } ####################################### @@ -101,6 +102,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}" fi + + # /tmp in tmpfs + sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}" } ####################################### diff --git a/oracle-linux-image-tools/distr/ol8-aarch64/ol8-aarch64-ks.cfg b/oracle-linux-image-tools/distr/ol8-aarch64/ol8-aarch64-ks.cfg index 0e8a022..c69bad9 100644 --- a/oracle-linux-image-tools/distr/ol8-aarch64/ol8-aarch64-ks.cfg +++ b/oracle-linux-image-tools/distr/ol8-aarch64/ol8-aarch64-ks.cfg @@ -233,6 +233,11 @@ else dnf install -y ${dnf_options} ${kernel} fi +# use tmpfs for /tmp +TMP_IN_TMPFS=no +if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then + systemctl enable tmp.mount +fi %end %addon com_redhat_kdump --disable diff --git a/oracle-linux-image-tools/distr/ol8-slim/image-scripts.sh b/oracle-linux-image-tools/distr/ol8-slim/image-scripts.sh index 6946942..afbe1af 100755 --- a/oracle-linux-image-tools/distr/ol8-slim/image-scripts.sh +++ b/oracle-linux-image-tools/distr/ol8-slim/image-scripts.sh @@ -19,7 +19,7 @@ ####################################### # Validate distribution parameters # Globals: -# RESCUE_LERNEL ROOT_FS +# ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS # Arguments: # None # Returns: @@ -28,12 +28,13 @@ distr::validate() { [[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm" [[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO" + [[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no" [[ "${UEK_RELEASE}" =~ ^[67]$ ]] || error "UEK_RELEASE must be 6 or 7" [[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no" [[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no" [[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no" [[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal" - readonly ROOT_FS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS + readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS } ####################################### @@ -83,6 +84,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}" fi + + # /tmp in tmpfs + sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}" } ####################################### diff --git a/oracle-linux-image-tools/distr/ol8-slim/ol8-ks.cfg b/oracle-linux-image-tools/distr/ol8-slim/ol8-ks.cfg index 2bcb1c0..cb82344 100644 --- a/oracle-linux-image-tools/distr/ol8-slim/ol8-ks.cfg +++ b/oracle-linux-image-tools/distr/ol8-slim/ol8-ks.cfg @@ -204,6 +204,11 @@ else dnf install -y ${dnf_options} ${kernel} fi +# use tmpfs for /tmp +TMP_IN_TMPFS=no +if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then + systemctl enable tmp.mount +fi %end %addon com_redhat_kdump --disable diff --git a/oracle-linux-image-tools/distr/ol9-aarch64/image-scripts.sh b/oracle-linux-image-tools/distr/ol9-aarch64/image-scripts.sh index 9cf2926..e5a11e3 100755 --- a/oracle-linux-image-tools/distr/ol9-aarch64/image-scripts.sh +++ b/oracle-linux-image-tools/distr/ol9-aarch64/image-scripts.sh @@ -19,7 +19,7 @@ ####################################### # Validate distribution parameters # Globals: -# ISO_LABEL RESCUE_LERNEL ROOT_FS +# ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS # Arguments: # None # Returns: @@ -28,11 +28,12 @@ distr::validate() { [[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm" [[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO" + [[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no" [[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no" [[ -n ${ISO_LABEL} ]] || error "ISO_LABEL must be provided" [[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no" [[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal" - readonly ROOT_FS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS + readonly ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS } ####################################### @@ -82,6 +83,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}" fi + + # /tmp in tmpfs + sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}" } ####################################### diff --git a/oracle-linux-image-tools/distr/ol9-aarch64/ol9-aarch64-ks.cfg b/oracle-linux-image-tools/distr/ol9-aarch64/ol9-aarch64-ks.cfg index 0b834ec..4e2d1fc 100644 --- a/oracle-linux-image-tools/distr/ol9-aarch64/ol9-aarch64-ks.cfg +++ b/oracle-linux-image-tools/distr/ol9-aarch64/ol9-aarch64-ks.cfg @@ -211,6 +211,11 @@ fi # Ensure we have the correct boot options grub2-mkconfig -o /boot/grub2/grub.cfg +# use tmpfs for /tmp +TMP_IN_TMPFS=no +if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then + systemctl enable tmp.mount +fi %end %addon com_redhat_kdump --disable diff --git a/oracle-linux-image-tools/distr/ol9-slim/image-scripts.sh b/oracle-linux-image-tools/distr/ol9-slim/image-scripts.sh index c72944b..fc60828 100755 --- a/oracle-linux-image-tools/distr/ol9-slim/image-scripts.sh +++ b/oracle-linux-image-tools/distr/ol9-slim/image-scripts.sh @@ -19,7 +19,7 @@ ####################################### # Validate distribution parameters # Globals: -# RESCUE_LERNEL ROOT_FS +# ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS # Arguments: # None # Returns: @@ -28,10 +28,11 @@ distr::validate() { [[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm" [[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO" + [[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no" [[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no" [[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no" [[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal" - readonly ROOT_FS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS + readonly ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS } ####################################### @@ -80,6 +81,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}" fi + + # /tmp in tmpfs + sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}" } ####################################### diff --git a/oracle-linux-image-tools/distr/ol9-slim/ol9-ks.cfg b/oracle-linux-image-tools/distr/ol9-slim/ol9-ks.cfg index 3d05bbb..4a3163f 100644 --- a/oracle-linux-image-tools/distr/ol9-slim/ol9-ks.cfg +++ b/oracle-linux-image-tools/distr/ol9-slim/ol9-ks.cfg @@ -208,6 +208,11 @@ fi # Ensure we have the correct boot options grub2-mkconfig -o /boot/grub2/grub.cfg +# use tmpfs for /tmp +TMP_IN_TMPFS=no +if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then + systemctl enable tmp.mount +fi %end %addon com_redhat_kdump --disable diff --git a/oracle-linux-image-tools/env.properties b/oracle-linux-image-tools/env.properties index 8f46e86..9a0d1cb 100644 --- a/oracle-linux-image-tools/env.properties +++ b/oracle-linux-image-tools/env.properties @@ -50,6 +50,9 @@ CLOUD="none" # Root filesystem: btrfs, xfs or lvm (Default: xfs) # ROOT_FS= +# Set /tmp to tmpfs +# TMP_IN_TMPFS="no" + # Which kernel? (uek, rhck, modrhck, default is distribution / cloud specific) # KERNEL= diff --git a/oracle-linux-image-tools/env.properties.defaults b/oracle-linux-image-tools/env.properties.defaults index 27c3119..509d57c 100644 --- a/oracle-linux-image-tools/env.properties.defaults +++ b/oracle-linux-image-tools/env.properties.defaults @@ -24,6 +24,9 @@ SELINUX="enforcing" # Allocated disk size for the image. DISK_SIZE_GB=15 +# Set /tmp to tmpfs +TMP_IN_TMPFS="no" + # Root access to the VM. You must provide either a password or a key file. SSH_PASSWORD= SSH_KEY_FILE= @@ -50,7 +53,7 @@ QEMU_BINARY="" # If defined, override generated VM_NAME VM_NAME= -# The following two parameters can be specified when using a boot install image +# The following two parameters can be specified when using a boot install image # instead of a full DVD ISO image # URL to an installation tree on a remote server REPO_URL=