Skip to content

Commit 906652a

Browse files
bladedvoxclassabbyamp
authored andcommitted
don't uninstall initramfs packages if they were manually installed by -p
1 parent baac937 commit 906652a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

mklive.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,21 @@ generate_initramfs() {
227227
esac
228228
}
229229

230+
array_contains() {
231+
local -n arr="$1"
232+
local val="$2"
233+
printf '%s\0' "${arr[@]}" | grep -Fxqz "$val"
234+
}
235+
230236
cleanup_rootfs() {
231237
for f in "${INITRAMFS_PKGS[@]}"; do
232-
revdeps=$(xbps-query -r "$ROOTFS" -X $f)
233-
if [ -n "$revdeps" ]; then
234-
xbps-pkgdb -r "$ROOTFS" -m auto $f
235-
else
236-
xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
238+
if ! array_contains PACKAGE_LIST $f; then
239+
revdeps=$(xbps-query -r "$ROOTFS" -X $f)
240+
if [ -n "$revdeps" ]; then
241+
xbps-pkgdb -r "$ROOTFS" -m auto $f
242+
else
243+
xbps-remove -r "$ROOTFS" -Ry ${f} >/dev/null 2>&1
244+
fi
237245
fi
238246
done
239247
rm -r "$ROOTFS"/usr/lib/dracut/modules.d/01vmklive

0 commit comments

Comments
 (0)