mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
replace grep with rg
This commit is contained in:
parent
6b88e521cb
commit
2cfdc65834
2 changed files with 27 additions and 27 deletions
|
@ -28,25 +28,25 @@ _archboot_check
|
|||
echo "Waiting for pacman keyring..."
|
||||
_pacman_keyring
|
||||
_run_test "journal"
|
||||
if ! journalctl -p3 -xb | grep -q 'No entries'; then
|
||||
if ! journalctl -p3 -xb | rg -q 'No entries'; then
|
||||
journalctl -p3 -xb >>journal-error.txt
|
||||
_TEST_FAIL=1
|
||||
fi
|
||||
_result journal-error.txt
|
||||
_run_test "ldd on /usr/bin"
|
||||
for i in /usr/bin/*; do
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | grep -q 'not found'; then
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | rg -q 'not found'; then
|
||||
echo "${i}" >>bin-binary-error.txt
|
||||
ldd "${i}" | grep 'not found' >>bin-binary-error.txt
|
||||
ldd "${i}" | rg 'not found' >>bin-binary-error.txt
|
||||
_TEST_FAIL=1
|
||||
fi
|
||||
done
|
||||
_result bin-binary-error.txt
|
||||
_run_test "ldd on executables in /usr/lib"
|
||||
for i in $(fd -u -t x -E '*.so.*' -E '*.so' . /usr/lib); do
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | grep -q 'not found'; then
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | rg -q 'not found'; then
|
||||
echo "${i}" >>lib-binary-error.txt
|
||||
ldd "${i}" | grep 'not found' >>lib-binary-error.txt
|
||||
ldd "${i}" | rg 'not found' >>lib-binary-error.txt
|
||||
_TEST_FAIL=1
|
||||
fi
|
||||
done
|
||||
|
@ -54,9 +54,9 @@ _result lib-binary-error.txt
|
|||
_run_test "ldd on /usr/lib"
|
||||
# ignore wrong reported libsystemd-shared by libsystemd-core
|
||||
for i in $(fd -u '.so' /usr/lib); do
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | grep -v -E 'tree_sitter|libsystemd-shared' | grep -q 'not found'; then
|
||||
if ldd "${i}" 2>"${_NO_LOG}" | rg -v 'tree_sitter|libsystemd-shared' | rg -q 'not found'; then
|
||||
echo "${i}" >>lib-error.txt
|
||||
ldd "${i}" | grep 'not found' >>lib-error.txt
|
||||
ldd "${i}" | rg 'not found' >>lib-error.txt
|
||||
_TEST_FAIL=1
|
||||
fi
|
||||
done
|
||||
|
@ -71,8 +71,8 @@ systemd-confext systemd-cryptsetup systemd-delta systemd-home-fallback-shell sys
|
|||
systemd-run systemd-vmspawn systemd-vpick varlinkctl xtrace"
|
||||
archboot-binary-check.sh base &>>"${_LOG}"
|
||||
#shellcheck disable=SC2013
|
||||
for i in $(grep '/usr/bin/' binary.txt | sed -e 's#^/usr/bin/##g'); do
|
||||
if ! echo "${_BASE_BLACKLIST}" | grep -qw "${i}"; then
|
||||
for i in $(rg '/usr/bin/(.*)' -r '$1' binary.txt); do
|
||||
if ! echo "${_BASE_BLACKLIST}" | rg -qw "${i}"; then
|
||||
echo "${i}" >> base-binary-error.txt
|
||||
_TEST_FAIL=1
|
||||
fi
|
||||
|
@ -86,8 +86,8 @@ _result fw-error.txt
|
|||
# uninstall base again!
|
||||
pacman --noconfirm -Rdd base gettext &>>"${_LOG}"
|
||||
_run_test "licenses"
|
||||
for i in $(pacman -Ql $(pacman -Q | cut -d ' ' -f 1) | cut -d ' ' -f2 | grep 'share/licenses'); do
|
||||
[[ -e "${i}" ]] || echo "${i}" | grep -v '/xz/' >>license-error.txt
|
||||
for i in $(pacman -Ql $(pacman -Q | cut -d ' ' -f 1) | rg -o '/usr/share/licenses/.*'); do
|
||||
[[ -e "${i}" ]] || echo "${i}" | rg -v '/xz/' >>license-error.txt
|
||||
done
|
||||
_result license-error.txt
|
||||
echo -e "Starting none tracked files in \e[1m10\e[m seconds... \e[1;92mCTRL-C\e[m to stop now."
|
||||
|
|
|
@ -107,27 +107,27 @@ _create_iso() {
|
|||
mv init-* boot/
|
||||
if [[ "${_ARCH}" == "riscv64" ]]; then
|
||||
for i in *.img; do
|
||||
if echo "${i}" | grep -v local | grep -vq latest; then
|
||||
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
||||
mcopy -m -i "${i}"@@1048576 ::/"${_KERNEL_ARCHBOOT}" ./"${_KERNEL_ARCHBOOT}"
|
||||
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD}"
|
||||
elif echo "${i}" | grep -q latest; then
|
||||
elif echo "${i}" | rg -q 'latest'; then
|
||||
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
||||
elif echo "${i}" | grep -q local; then
|
||||
elif echo "${i}" | rg -q 'local'; then
|
||||
mcopy -m -i "${i}"@@1048576 ::/"${_INITRD}" ./"${_INITRD_LOCAL}"
|
||||
fi
|
||||
done
|
||||
else
|
||||
for i in *.iso; do
|
||||
if echo "${i}" | grep -v local | grep -vq latest; then
|
||||
if echo "${i}" | rg -v 'local' | rg -vq 'latest'; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_AMD_UCODE}" ./"${_AMD_UCODE}"
|
||||
[[ "${_ARCH}" == "aarch64" ]] || mcopy -m -i efi.img ::/"${_INTEL_UCODE}" ./"${_INTEL_UCODE}"
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD}"
|
||||
mcopy -m -i efi.img ::/"${_KERNEL_ARCHBOOT}" ./"${_KERNEL_ARCHBOOT}"
|
||||
elif echo "${i}" | grep -q latest; then
|
||||
elif echo "${i}" | rg -q 'latest'; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LATEST}"
|
||||
elif echo "${i}" | grep -q local; then
|
||||
elif echo "${i}" | rg -q 'local'; then
|
||||
isoinfo -R -i "${i}" -x /efi.img 2>"${_NO_LOG}" > efi.img
|
||||
mcopy -m -i efi.img ::/"${_INITRD}" ./"${_INITRD_LOCAL}"
|
||||
fi
|
||||
|
@ -183,19 +183,19 @@ _create_iso() {
|
|||
echo "Tobias Powalowski <tpowa@archlinux.org>"
|
||||
echo ""
|
||||
echo "Requirement: ${_ARCH} with 800M RAM and higher"
|
||||
echo "Archboot:$(${_NSPAWN} "${_W_DIR}" pacman -Qi "${_ARCHBOOT}" | grep Version |\
|
||||
cut -d ":" -f2 | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g")"
|
||||
echo "Archboot:$(${_NSPAWN} "${_W_DIR}" pacman -Qi "${_ARCHBOOT}" |\
|
||||
rg -o 'Version.* (.*)' -r '$1')"
|
||||
[[ "${_ARCH}" == "riscv64" ]] || echo "Grub: $(${_NSPAWN} "${_W_DIR}" pacman -Qi grub |\
|
||||
grep Version | cut -d ":" -f3 | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g")"
|
||||
echo "Linux:$(${_NSPAWN} "${_W_DIR}" pacman -Qi linux | grep Version |\
|
||||
cut -d ":" -f2 | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g")"
|
||||
echo "Pacman:$(${_NSPAWN} "${_W_DIR}" pacman -Qi pacman | grep Version |\
|
||||
cut -d ":" -f2 | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g")"
|
||||
echo "Systemd:$(${_NSPAWN} "${_W_DIR}" pacman -Qi systemd | grep Version |\
|
||||
cut -d ":" -f2 | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g")"
|
||||
rg -o 'Version.* (.*)' -r '$1')"
|
||||
echo "Linux:$(${_NSPAWN} "${_W_DIR}" pacman -Qi linux |\
|
||||
rg -o 'Version.* (.*)' -r '$1')"
|
||||
echo "Pacman:$(${_NSPAWN} "${_W_DIR}" pacman -Qi pacman |\
|
||||
rg -o 'Version.* (.*)' -r '$1')"
|
||||
echo "Systemd:$(${_NSPAWN} "${_W_DIR}" pacman -Qi systemd |\
|
||||
rg -o 'Version.* (.*)' -r '$1')"
|
||||
echo ""
|
||||
if [[ -f "${_W_DIR}"/etc/archboot/ssh/archboot-key ]]; then
|
||||
${_NSPAWN} "${_W_DIR}" cat /etc/archboot/ssh/archboot-key | sed -e "s/\r//g" -e "s/\x1b\[[0-9;]*m//g"
|
||||
cat "${_W_DIR}"/etc/archboot/ssh/archboot-key
|
||||
fi
|
||||
echo ""
|
||||
echo "---Complete Package List---"
|
||||
|
|
Loading…
Reference in a new issue