File: common.sh

package info (click to toggle)
scap-security-guide 0.1.76-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 110,644 kB
  • sloc: xml: 241,883; sh: 73,777; python: 32,527; makefile: 27
file content (46 lines) | stat: -rw-r--r-- 1,289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

# this file prepares unified test environment used by other scenarios
# These should be tuned per product to match defaults

{{% if product in ["ol8", "rhel8"] -%}}
mkdir -p /boot/grub2
rm -f /boot/grub2/grubenv
	# File size must be exactly 1KiB
	{
		echo '# GRUB Environment Block'
		echo 'boot_indeterminate=0'
		echo 'boot_success=1'
		echo 'kernelopts=root=UUID=abc-def rhgb ro quiet mock'
		dd if=/dev/zero bs=1K count=1 | tr '\0' '#'
	} > /boot/grub2/grubenv
	truncate --size=1K /boot/grub2/grubenv
{{% endif %}}


mkdir -p /etc/default
rm -f /etc/default/grub
	{
		echo 'GRUB_CMDLINE_LINUX="rhgb ro ouiet"'
		echo 'GRUB_CMDLINE_LINUX_DEFAULT="rhgb ro quiet mock"'
		echo 'GRUB_DEFAULT=saved'
		echo 'GRUB_DISABLE_RECOVERY=true'
		echo 'GRUB_DISABLE_SUBMENU=true'
		echo 'GRUB_ENABLE_BLSCFG=true'
		echo 'GRUB_TIMEOUT=30'
	} > /etc/default/grub

{{% if product in ["fedora", "ol8", "ol9", "rhel8", "rhel9", "rhel10"] -%}}
mkdir -p /boot/loader/entries
shopt -s nullglob
rm -f /boot/loader/entries/*.conf
	{
		echo 'title OS 1'
		echo 'version 5.0'
		echo 'linux /vmlinuz'
		echo 'initrd /initramfs'
		echo 'options root=UUID=abc-def rhgb ro quiet mock'
		echo 'grub_users $grub_users'
		echo 'grub_arg --unrestricted'
	} > /boot/loader/entries/mock.conf
{{%- endif -%}}