add safety grep to cleanup hooks

This commit is contained in:
Tobias Powalowski 2023-10-16 08:29:56 +02:00
parent 0715961835
commit 98eb9ab21a
8 changed files with 9 additions and 2 deletions

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
_APPS="head id cksum tail test uptime w who whoami xargs \ _APPS="head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \ swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp dmesg egrep fgrep stty hdparm sync bsdcpio\ chgrp dmesg egrep fgrep stty hdparm sync bsdcpio\

View file

@ -4,7 +4,7 @@
_run () _run ()
{ {
### remove conflicting grub, man-db, mkinitcpio and rpcbind files ### remove conflicting grub, man-db, mkinitcpio,rpcbind and ukify files
tar -C / --exclude=/etc/systemd/system/multi-user.target.wants/remote-fs.target \ tar -C / --exclude=/etc/systemd/system/multi-user.target.wants/remote-fs.target \
--exclude=usr/share/bash-completion/completions/{grub,lsinitcpio,mkinitcpio} \ --exclude=usr/share/bash-completion/completions/{grub,lsinitcpio,mkinitcpio} \
--exclude=usr/lib/{modules-load.d/cdrecord.conf,systemd/system/{"man-db*","rpcbind*",\ --exclude=usr/lib/{modules-load.d/cdrecord.conf,systemd/system/{"man-db*","rpcbind*",\
@ -15,7 +15,6 @@ etc/{ca-certificates/extracted,default,pam.d,pinentry,profile.d,security,skel,ss
usr/lib/{coreutils,cryptsetup,gconv,modules-load.d,p11-kit,pam.d,pkcs11,security,sysctl.d,systemd,sysusers.d,tmpfiles.d,udev} \ usr/lib/{coreutils,cryptsetup,gconv,modules-load.d,p11-kit,pam.d,pkcs11,security,sysctl.d,systemd,sysusers.d,tmpfiles.d,udev} \
usr/share/{bash-completion,dbus-1,factory,hwdata,i18n/locales,makepkg,nano,pacman/keyrings,polkit-1,readline,systemd,terminfo} \ usr/share/{bash-completion,dbus-1,factory,hwdata,i18n/locales,makepkg,nano,pacman/keyrings,polkit-1,readline,systemd,terminfo} \
| tar -C "${_ROOTFS}" -xpf - | tar -C "${_ROOTFS}" -xpf -
if grep -qw 'archboot' /etc/hostname; then if grep -qw 'archboot' /etc/hostname; then
_map _binary locale-gen localedef _map _binary locale-gen localedef
_map _file /etc/locale.gen /usr/share/locale/locale.alias _map _file /etc/locale.gen /usr/share/locale/locale.alias
@ -89,6 +88,7 @@ var/lib/pacman/local \
done done
# add custom bash options # add custom bash options
echo ". /etc/profile.d/custom-bash-options.sh" >> "${_ROOTFS}/root/.bashrc" echo ". /etc/profile.d/custom-bash-options.sh" >> "${_ROOTFS}/root/.bashrc"
### add kmod related config file(s) ### add kmod related config file(s)
_file /usr/lib/depmod.d/search.conf _file /usr/lib/depmod.d/search.conf

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
# remove pacman-init.service # remove pacman-init.service
rm -f /tmp/etc/systemd/system/multi-user.target.wants/pacman-init.service rm -f /tmp/etc/systemd/system/multi-user.target.wants/pacman-init.service
rm -f /tmp/etc/systemd/system/pacman-init.service rm -f /tmp/etc/systemd/system/pacman-init.service

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
rm -rf /var/cache/pacman/pkg rm -rf /var/cache/pacman/pkg
} }

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
_APPS="mkswap badblocks blkid debugfs dumpe2fs e2fsck e2image e2undo findfs fsck \ _APPS="mkswap badblocks blkid debugfs dumpe2fs e2fsck e2image e2undo findfs fsck \
logsave mkfs.ext2 resize2fs chattr lsattr e2freefrag filefrag \ logsave mkfs.ext2 resize2fs chattr lsattr e2freefrag filefrag \
jfs_debugfs jfs_fsck jfs_fscklog jfs_logdump jfs_mkfs jfs_tune mkfs.xfs \ jfs_debugfs jfs_fsck jfs_fscklog jfs_logdump jfs_mkfs jfs_tune mkfs.xfs \

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
rm -r /lib/firmware rm -r /lib/firmware
} }

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
# save RAM with deleting already copied content # save RAM with deleting already copied content
rm -rf /var/cache/pacman/pkg rm -rf /var/cache/pacman/pkg
} }

View file

@ -4,6 +4,7 @@
_run () _run ()
{ {
! grep -qw 'archboot' /etc/hostname && return
_APPS="arping clockdiff tracepath ssh arpd \ _APPS="arping clockdiff tracepath ssh arpd \
genl ifstat ctstat rtstat lnstat nstat rtacct rtmon ss tc \ genl ifstat ctstat rtstat lnstat nstat rtacct rtmon ss tc \
bridge dcb devlink rdma tipc vdpa ethtool elinks brctl" bridge dcb devlink rdma tipc vdpa ethtool elinks brctl"