55
55
56
56
KICKSTART_PATH = "/tmp/payload.ks"
57
57
58
+ WEBUI_PAYLOAD_SPEC = """
59
+ Name: webui_payload
60
+ Version: 1
61
+ Release: 1
62
+ Summary: Inject what's needed to Web UI image.
63
+ License: FIXME
58
64
59
- def build_payload (image : str , output : str ) -> None :
65
+ %description
66
+ Inject what's needed to Web UI image.
67
+
68
+ %source0 webui-payload.tar.gz
69
+
70
+ %prep
71
+
72
+ # we have no source, so nothing here
73
+ ls -lah
74
+ cp /root/webui-payload.tar.gz .
75
+
76
+ %build
77
+ cat > custom_interactive-defaults.ks <<EOF
78
+
79
+ use local live payload tarball for the Web UI
80
+ liveimg --url="file://live.tar.xz"
81
+ EOF
82
+
83
+ %install
84
+ mkdir -p %{buildroot}/usr/bin/
85
+ mkdir -p %{buildroot}/usr/share/anaconda/
86
+
87
+ install -m 755 webui-payload.tar.gz %{buildroot}/live.tar.xz
88
+ install -m 755 custom_interactive-defaults.ks %{buildroot}/usr/share/anaconda/custom_interactive-defaults.ks
89
+
90
+ %files
91
+ /live.tar.xz
92
+ /usr/share/anaconda/custom_interactive-defaults.ks
93
+
94
+ %posttrans
95
+ cp /usr/share/anaconda/custom_interactive-defaults.ks /usr/share/anaconda/interactive-defaults.ks
96
+
97
+ %changelog
98
+ """
99
+
100
+
101
+ def build_payload_rpm (image : str , output : str ) -> None :
60
102
subprocess .check_call ([os .path .join (BOTS_DIR , "image-download" ), image ])
61
103
machine = testvm .VirtMachine (image = image , memory_mb = 4096 )
62
104
try :
@@ -72,9 +114,19 @@ def build_payload(image: str, output: str) -> None:
72
114
)
73
115
74
116
# Change directory to /mnt/sysimage/ and create archive
75
- machine .execute ("cd /mnt/sysimage && tar --selinux --acls --xattrs -zcvf /root/payload.tar.gz *" , timeout = 100 )
117
+ machine .execute (
118
+ "cd /mnt/sysimage && tar --selinux --acls --xattrs -zcvf /root/webui-payload.tar.gz *" ,
119
+ timeout = 100
120
+ )
121
+
122
+ # Create the payload RPM Spec file
123
+ machine .execute (f"echo \" { WEBUI_PAYLOAD_SPEC } \" > /root/webui-payload.spec" )
124
+
125
+ # Build the RPM
126
+ machine .execute ("rpmbuild -bb /root/webui-payload.spec" , timeout = 300 )
76
127
77
- machine .download ("/root/payload.tar.gz" , output )
128
+ # Download the RPM
129
+ machine .download ("/root/rpmbuild/RPMS/x86_64/webui_payload-1-1.x86_64.rpm" , output )
78
130
finally :
79
131
machine .stop ()
80
132
@@ -88,7 +140,7 @@ def main() -> None:
88
140
if not args .output :
89
141
raise RuntimeError ("Output path not specified" )
90
142
91
- build_payload (args .image , args .output )
143
+ build_payload_rpm (args .image , args .output )
92
144
93
145
94
146
main ()
0 commit comments