forked from rhinstaller/kickstart-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautopart-nohome.ks.in
59 lines (46 loc) · 1.14 KB
/
autopart-nohome.ks.in
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
47
48
49
50
51
52
53
54
55
56
57
58
59
#test name: autopart-nohome
%ksappend repos/default.ks
network --bootproto=dhcp
bootloader --timeout=1
zerombr
clearpart --all --initlabel
# Include the generated autopart command.
%include /tmp/ksinclude
keyboard us
lang en
timezone America/New_York
rootpw qweqwe
shutdown
%packages
%end
%pre
# Generate the autopart command.
autopart="autopart --type=plain --nohome"
if [ "@KSTEST_OS_NAME@" == "fedora" ]; then
autopart="$autopart --noboot --noswap"
fi
echo "$autopart" >/tmp/ksinclude
%end
%post
# Check the non-existence of partitions.
check_partition() {
local name=$1 pattern=$2
kname="$( \
lsblk -o TYPE,MOUNTPOINT,KNAME --noheadings \
| awk -v pattern="$pattern" '$1 ~ /^part$/ && $2 ~ pattern { print $3; }' \
)"
if [ -n "$kname" ]; then
echo "$name partition shouldn't exist: $kname" >> /root/RESULT
fi
}
# Check /home, /boot and swap.
check_partition "/home" '^/home$'
if [ "@KSTEST_OS_NAME@" == "fedora" ]; then
check_partition "/boot" '^/boot$'
check_partition "swap" '^\\[SWAP\\]$'
fi
# The test was successful.
if [ ! -e /root/RESULT ]; then
echo SUCCESS > /root/RESULT
fi
%end