Skip to content

Commit a5fa8f3

Browse files
committed
Add and run cleanup script
1 parent 01c59ac commit a5fa8f3

File tree

2 files changed

+107
-5
lines changed

2 files changed

+107
-5
lines changed

Configs/Arch.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@
263263
"arch_vulkan_pkgs/vulkan-headers-1:1.4.304-1-any.pkg.tar.zst",
264264
"arch_vulkan_pkgs/lib32-libxshmfence-1.3.3-1-x86_64.pkg.tar.zst",
265265
"arch_vulkan_pkgs/mesa-asahi-dummy-25.0.0_pre20241211-6-any.pkg.tar.xz",
266+
"Scripts/Arch/cleanup.sh",
266267
"Scripts/Arch/mega_install_packages.sh"
267268
],
268269

@@ -279,6 +280,7 @@
279280
["vulkan-headers-1:1.4.304-1-any.pkg.tar.zst", "root/"],
280281
["lib32-libxshmfence-1.3.3-1-x86_64.pkg.tar.zst", "root/"],
281282
["mesa-asahi-dummy-25.0.0_pre20241211-6-any.pkg.tar.xz", "root/"],
283+
["cleanup.sh", "/"],
282284
["mega_install_packages.sh", "root/"]
283285
],
284286

@@ -376,15 +378,16 @@
376378
"rmdir $ROOTFS/proc",
377379
"rmdir $ROOTFS/dev/pts",
378380
"rmdir $ROOTFS/dev",
379-
"rmdir $ROOTFS/sys"
381+
"rmdir $ROOTFS/sys",
382+
"sh $ROOTFS/cleanup.sh",
383+
"rm $ROOTFS/cleanup.sh"
380384
],
381385

382386
"RemoveFiles_Stage2_CMT": [
383387
"Removes files from the rootfs post Stage2 teardown"
384388
],
385389

386390
"RemoveFiles_Stage2": [
387-
"etc/pacman.d/gnupg/S*"
388391
],
389392

390393
"RemoveDirs_Stage2": [
@@ -393,9 +396,6 @@
393396
],
394397

395398
"RemoveDirs_Stage2": [
396-
"etc/credstore",
397-
"etc/credstore.encrypted",
398-
"var/cache/"
399399
],
400400

401401
"Commands_Stage3": [

Scripts/Arch/cleanup.sh

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
#!/usr/bin/env bash
2+
3+
# Fedora RootFS:
4+
# https://artifacts.dev.testing-farm.io/4aa345e8-5263-44db-b635-37e476c11c77/work-build-fex-rootfs8nc5v0ub/tmt/plans/asahi/build-fex-rootfs/execute/data/guest/default-0/tmt/tests/build-image-1/data/Fedora-FEX-RootFS-Rawhide.20241209.2006.x86_64.erofs.xz
5+
# Fedora cleanup script:
6+
# https://pagure.io/fedora-kiwi-descriptions/blob/rawhide/f/config.sh#_312
7+
# https://pagure.io/fedora-kiwi-descriptions/blob/rawhide/f/fex-excludes.yaml
8+
9+
# mkfs.erofs -x-1 -zlz4hc,12 default.erofs wip/
10+
11+
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
12+
#ROOTFSPATH="$SCRIPTPATH/RootFS"
13+
BASEPATH=$SCRIPTPATH
14+
15+
rm -rf "$BASEPATH/boot"
16+
rm -rf "$BASEPATH/dev"
17+
rm -rf "$BASEPATH/home"
18+
rm -rf "$BASEPATH/media"
19+
rm -rf "$BASEPATH/mnt"
20+
rm -rf "$BASEPATH/opt"
21+
rm -rf "$BASEPATH/proc"
22+
rm -rf "$BASEPATH/root"
23+
rm -rf "$BASEPATH/run"
24+
rm -rf "$BASEPATH/srv"
25+
rm -rf "$BASEPATH/sys"
26+
rm -rf "$BASEPATH/tmp"
27+
rm -rf "$BASEPATH/var"
28+
29+
# rm everything in /usr/share except wine and mesa related stuff
30+
find "$BASEPATH"/usr/share -mindepth 1 -maxdepth 1 \
31+
\! -name wine -a \
32+
\! -name mesa-demos -a \
33+
\! -name drirc.d -a \
34+
\! -name glvnd -a \
35+
\! -name vulkan -a \
36+
\! -name licenses \
37+
-exec rm -rf {} \;
38+
39+
40+
# rm everything in /etc except /etc/alternatives and ld stuff
41+
find "$BASEPATH"/etc -mindepth 1 -maxdepth 1 \
42+
\! -name 'resolv.conf' -a \
43+
\! -name 'ld.so*' -a \
44+
\! -name OpenCL \
45+
-exec rm -rf {} \;
46+
47+
# rm non-libs in lib/lib64
48+
rm -rf "$BASEPATH"/usr/lib/{locale,tmpfiles.d,systemd,modprobe.d,kbd,cmake}
49+
rm -rf "$BASEPATH"/usr/lib/python*
50+
51+
# rm misc stuff
52+
rm -rf $BASEPATH/usr/{include,games,local,src,tmp}
53+
rm -f $BASEPATH/version
54+
rm -f $BASEPATH/pkglist.x86_64.txt
55+
56+
# Finally, remove most binaries except Wine stuff, Mesa stuff, the shell,
57+
# path-related stuff, and system info tools.
58+
find "$BASEPATH/usr/bin" -mindepth 1 -maxdepth 1 \
59+
\! -name 'cat' -a \
60+
\! -name 'strace' -a \
61+
\! -name 'wine*' -a \
62+
\! -name 'mango*' -a \
63+
\! -name notepad -a \
64+
\! -name 'msi*' -a \
65+
\! -name regedit -a \
66+
\! -name regsvr32 -a \
67+
\! -name 'vulkan*' -a \
68+
\! -name 'vk*' -a \
69+
\! -name clinfo -a \
70+
\! -name 'eglinfo*' -a \
71+
\! -name 'glxinfo*' -a \
72+
\! -name 'egltri_*' -a \
73+
\! -name es2_info -a \
74+
\! -name 'es2gears_*' -a \
75+
\! -name es2tri -a \
76+
\! -name 'glxgears*' -a \
77+
\! -name vkgears -a \
78+
\! -name '*eglgears*' -a \
79+
\! -name 'xauth' -a \
80+
\! -name 'xeyes' -a \
81+
\! -name mesa-overlay-control.py -a \
82+
\! -name ulimit -a \
83+
\! -name ldd -a \
84+
\! -name ldconfig -a \
85+
\! -name env -a \
86+
\! -name sh -a \
87+
\! -name bash -a \
88+
\! -name ls -a \
89+
\! -name file -a \
90+
\! -name stat -a \
91+
\! -name dirname -a \
92+
\! -name realpath -a \
93+
\! -name readlink -a \
94+
\! -name basename -a \
95+
\! -name nproc -a \
96+
\! -name uname -a \
97+
\! -name arch -a \
98+
\! -name rm \
99+
-exec rm -rf {} \;
100+
101+
# Do this last for obvious reasons.
102+
rm -f $BASEPATH/usr/bin/rm

0 commit comments

Comments
 (0)