Skip to content

Commit 900b6e4

Browse files
committed
Add configuration control for /tmp file system
1 parent aa3669e commit 900b6e4

File tree

12 files changed

+63
-11
lines changed

12 files changed

+63
-11
lines changed

oracle-linux-image-tools/distr/ol7-slim/image-scripts.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616
#######################################
1717
# Validate distribution parameters
1818
# Globals:
19-
# ROOT_FS
19+
# ROOT_FS TMP_IN_TMPFS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS
2020
# Arguments:
2121
# None
2222
# Returns:
2323
# None
2424
#######################################
2525
distr::validate() {
2626
[[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm"
27+
[[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no"
2728
[[ "${UEK_RELEASE}" =~ ^[56]$ ]] || error "UEK_RELEASE must be 5 or 6"
2829
[[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no"
2930
[[ "${STRIP_LOCALES,,}" =~ ^(yes)|(no)$ ]] || error "STRIP_LOCALES must be yes or no"
3031
[[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal"
31-
readonly ROOT_FS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS
32+
readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE LINUX_FIRMWARE STRIP_LOCALES EXCLUDE_DOCS
3233
}
3334

3435
#######################################
@@ -75,6 +76,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr
7576
if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then
7677
sed -i -e 's!^%packages !%packages --excludedocs !' "${ks_file}"
7778
fi
79+
80+
# /tmp in tmpfs
81+
sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}"
7882
}
7983

8084
#######################################

oracle-linux-image-tools/distr/ol7-slim/ol7-ks.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,10 @@ fi
235235
sed -i -e 's/^DEFAULTKERNEL=.*/DEFAULTKERNEL='"${kernel}"'/' /etc/sysconfig/kernel
236236

237237
yum install -y ${yum_options} ${kernel}
238+
239+
# use tmpfs for /tmp
240+
TMP_IN_TMPFS=no
241+
if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then
242+
systemctl enable tmp.mount
243+
fi
238244
%end

oracle-linux-image-tools/distr/ol8-aarch64/image-scripts.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#######################################
1919
# Validate distribution parameters
2020
# Globals:
21-
# ISO_LABEL RESCUE_KERNEL ROOT_FS
21+
# ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE KERNEL_MODULES EXCLUDE_DOCS
2222
# Arguments:
2323
# None
2424
# Returns:
@@ -27,13 +27,14 @@
2727
distr::validate() {
2828
[[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm"
2929
[[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO"
30+
[[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no"
3031
[[ "${UEK_RELEASE}" =~ ^[67]$ ]] || error "UEK_RELEASE must be 6 or 7"
3132
[[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no"
3233
[[ -n ${ISO_LABEL} ]] || error "ISO_LABEL must be provided"
3334
[[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no"
3435
[[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no"
3536
[[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal"
36-
readonly ROOT_FS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE EXCLUDE_DOCS
37+
readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL ISO_LABEL LINUX_FIRMWARE KERNEL_MODULES EXCLUDE_DOCS
3738
}
3839

3940
#######################################
@@ -101,6 +102,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr
101102
if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then
102103
sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}"
103104
fi
105+
106+
# /tmp in tmpfs
107+
sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}"
104108
}
105109

106110
#######################################

oracle-linux-image-tools/distr/ol8-aarch64/ol8-aarch64-ks.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ else
233233
dnf install -y ${dnf_options} ${kernel}
234234
fi
235235

236+
# use tmpfs for /tmp
237+
TMP_IN_TMPFS=no
238+
if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then
239+
systemctl enable tmp.mount
240+
fi
236241
%end
237242

238243
%addon com_redhat_kdump --disable

oracle-linux-image-tools/distr/ol8-slim/image-scripts.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#######################################
2020
# Validate distribution parameters
2121
# Globals:
22-
# RESCUE_LERNEL ROOT_FS
22+
# ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS
2323
# Arguments:
2424
# None
2525
# Returns:
@@ -28,12 +28,13 @@
2828
distr::validate() {
2929
[[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm"
3030
[[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO"
31+
[[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no"
3132
[[ "${UEK_RELEASE}" =~ ^[67]$ ]] || error "UEK_RELEASE must be 6 or 7"
3233
[[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no"
3334
[[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no"
3435
[[ "${LINUX_FIRMWARE,,}" =~ ^(yes)|(no)$ ]] || error "LINUX_FIRMWARE must be yes or no"
3536
[[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal"
36-
readonly ROOT_FS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS
37+
readonly ROOT_FS TMP_IN_TMPFS UEK_RELEASE RESCUE_KERNEL KERNEL_MODULES LINUX_FIRMWARE EXCLUDE_DOCS
3738
}
3839

3940
#######################################
@@ -83,6 +84,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr
8384
if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then
8485
sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}"
8586
fi
87+
88+
# /tmp in tmpfs
89+
sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}"
8690
}
8791

8892
#######################################

oracle-linux-image-tools/distr/ol8-slim/ol8-ks.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ else
204204
dnf install -y ${dnf_options} ${kernel}
205205
fi
206206

207+
# use tmpfs for /tmp
208+
TMP_IN_TMPFS=no
209+
if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then
210+
systemctl enable tmp.mount
211+
fi
207212
%end
208213

209214
%addon com_redhat_kdump --disable

oracle-linux-image-tools/distr/ol9-aarch64/image-scripts.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#######################################
2020
# Validate distribution parameters
2121
# Globals:
22-
# ISO_LABEL RESCUE_LERNEL ROOT_FS
22+
# ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS
2323
# Arguments:
2424
# None
2525
# Returns:
@@ -28,11 +28,12 @@
2828
distr::validate() {
2929
[[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm"
3030
[[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO"
31+
[[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no"
3132
[[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no"
3233
[[ -n ${ISO_LABEL} ]] || error "ISO_LABEL must be provided"
3334
[[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no"
3435
[[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal"
35-
readonly ROOT_FS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS
36+
readonly ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL ISO_LABEL KERNEL_MODULES EXCLUDE_DOCS
3637
}
3738

3839
#######################################
@@ -82,6 +83,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr
8283
if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then
8384
sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}"
8485
fi
86+
87+
# /tmp in tmpfs
88+
sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}"
8589
}
8690

8791
#######################################

oracle-linux-image-tools/distr/ol9-aarch64/ol9-aarch64-ks.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ fi
211211
# Ensure we have the correct boot options
212212
grub2-mkconfig -o /boot/grub2/grub.cfg
213213

214+
# use tmpfs for /tmp
215+
TMP_IN_TMPFS=no
216+
if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then
217+
systemctl enable tmp.mount
218+
fi
214219
%end
215220

216221
%addon com_redhat_kdump --disable

oracle-linux-image-tools/distr/ol9-slim/image-scripts.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#######################################
2020
# Validate distribution parameters
2121
# Globals:
22-
# RESCUE_LERNEL ROOT_FS
22+
# ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS
2323
# Arguments:
2424
# None
2525
# Returns:
@@ -28,10 +28,11 @@
2828
distr::validate() {
2929
[[ "${ROOT_FS,,}" =~ ^(xfs)|(btrfs)|(lvm)$ ]] || error "ROOT_FS must be xfs, btrfs or lvm"
3030
[[ "${ROOT_FS,,}" = "btrfs" ]] && echo_message "Note that for btrfs root filesystem you need to use an UEK boot ISO"
31+
[[ "${TMP_IN_TMPFS,,}" =~ ^(yes)|(no)$ ]] || error "TMP_IN_TMPFS must be yes or no"
3132
[[ "${RESCUE_KERNEL,,}" =~ ^(yes)|(no)$ ]] || error "RESCUE_KERNEL must be yes or no"
3233
[[ "${KERNEL_MODULES,,}" =~ ^(yes)|(no)$ ]] || error "KERNEL_MODULES must be yes or no"
3334
[[ "${EXCLUDE_DOCS,,}" =~ ^(yes)|(no)|(minimal)$ ]] || error "EXCLUDE_DOCS must be yes, no or minimal"
34-
readonly ROOT_FS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS
35+
readonly ROOT_FS TMP_IN_TMPFS RESCUE_KERNEL KERNEL_MODULES EXCLUDE_DOCS
3536
}
3637

3738
#######################################
@@ -80,6 +81,9 @@ logvol / --fstype=\"xfs\" --vgname=vg_main --size=4096 --name=lv_root --gr
8081
if [[ "${EXCLUDE_DOCS,,}" = "yes" ]]; then
8182
sed -i -e 's!^%packages!%packages --excludedocs!' "${ks_file}"
8283
fi
84+
85+
# /tmp in tmpfs
86+
sed -i -e "s!^TMP_IN_TMPFS=no!TMP_IN_TMPFS=$TMP_IN_TMPFS!" "${ks_file}"
8387
}
8488

8589
#######################################

oracle-linux-image-tools/distr/ol9-slim/ol9-ks.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ fi
208208
# Ensure we have the correct boot options
209209
grub2-mkconfig -o /boot/grub2/grub.cfg
210210

211+
# use tmpfs for /tmp
212+
TMP_IN_TMPFS=no
213+
if [[ "${TMP_IN_TMPFS,,}" == "yes" ]]; then
214+
systemctl enable tmp.mount
215+
fi
211216
%end
212217

213218
%addon com_redhat_kdump --disable

0 commit comments

Comments
 (0)