remove buildserver check, replace grep with rg

This commit is contained in:
Tobias Powalowski 2024-06-24 20:14:11 +02:00
parent 4560b92989
commit 068a0536c4
2 changed files with 10 additions and 19 deletions

View file

@ -7,7 +7,6 @@ _SHIM=$(mktemp -d shim.XXX)
_SHIM32=$(mktemp -d shim32.XXX) _SHIM32=$(mktemp -d shim32.XXX)
_SHIMAA64=$(mktemp -d shimaa64.XXX) _SHIMAA64=$(mktemp -d shimaa64.XXX)
_root_check _root_check
_buildserver_check
_x86_64_check _x86_64_check
_prepare_shim_files || exit 1 _prepare_shim_files || exit 1
_upload_efi_files shim-fedora || exit 1 _upload_efi_files shim-fedora || exit 1

View file

@ -15,11 +15,11 @@ _DLPROG="curl -L -s"
_KERNELPKG="linux" _KERNELPKG="linux"
_KEYRING="archlinux-keyring" _KEYRING="archlinux-keyring"
_MEM_TOTAL="$(rg -w MemTotal /proc/meminfo | rg -o '\d+')" _MEM_TOTAL="$(rg -w MemTotal /proc/meminfo | rg -o '\d+')"
if echo "${_BASENAME}" | grep -qw aarch64; then if echo "${_BASENAME}" | rg -qw aarch64; then
_ARCHBOOT="archboot-arm" _ARCHBOOT="archboot-arm"
_KEYRING="${_KEYRING} archlinuxarm-keyring" _KEYRING="${_KEYRING} archlinuxarm-keyring"
_ARCH="aarch64" _ARCH="aarch64"
elif echo "${_BASENAME}" | grep -qw riscv64; then elif echo "${_BASENAME}" | rg -qw riscv64; then
_ARCHBOOT="archboot-riscv" _ARCHBOOT="archboot-riscv"
_ARCH="riscv64" _ARCH="riscv64"
else else
@ -53,7 +53,7 @@ _root_check() {
### check for archboot environment ### check for archboot environment
_archboot_check() { _archboot_check() {
if ! grep -qw 'archboot' /etc/hostname; then if ! rg -qw 'archboot' /etc/hostname; then
echo "This script should only be run in booted archboot environment. Aborting..." echo "This script should only be run in booted archboot environment. Aborting..."
exit 1 exit 1
fi fi
@ -152,7 +152,7 @@ _cleanup() {
} }
_run_update_environment() { _run_update_environment() {
if update | grep -q latest-install; then if update | rg -q latest-install; then
update -latest-install update -latest-install
else else
update -latest update -latest
@ -184,31 +184,23 @@ _kver() {
### check architecture ### check architecture
_architecture_check() { _architecture_check() {
echo "${_BASENAME}" | grep -qw aarch64 && _aarch64_check echo "${_BASENAME}" | rg -qw aarch64 && _aarch64_check
echo "${_BASENAME}" | grep -qw riscv64 && _riscv64_check echo "${_BASENAME}" | rg -qw riscv64 && _riscv64_check
echo "${_BASENAME}" | grep -qw x86_64 && _x86_64_check echo "${_BASENAME}" | rg -qw x86_64 && _x86_64_check
} }
### check if running in container ### check if running in container
_container_check() { _container_check() {
if grep -q bash /proc/1/sched ; then if rg -q bash /proc/1/sched ; then
echo "ERROR: Running inside container. Aborting..." echo "ERROR: Running inside container. Aborting..."
exit 1 exit 1
fi fi
} }
### check for tpowa's build server
_buildserver_check() {
if ! grep -qw 'T-POWA-LX' /etc/hostname; then
echo "This script should only be run on tpowa's build server. Aborting..."
exit 1
fi
}
_generate_keyring() { _generate_keyring() {
# use fresh one on normal systems # use fresh one on normal systems
# copy existing gpg cache on archboot usage # copy existing gpg cache on archboot usage
if ! grep -qw archboot /etc/hostname; then if ! rg -qw archboot /etc/hostname; then
# generate pacman keyring # generate pacman keyring
echo "Generating pacman keyring in container..." echo "Generating pacman keyring in container..."
${_NSPAWN} "${1}" pacman-key --init &>"${_NO_LOG}" ${_NSPAWN} "${1}" pacman-key --init &>"${_NO_LOG}"
@ -303,7 +295,7 @@ _pacman_key_system() {
} }
_cachedir_check() { _cachedir_check() {
if grep -q ^CacheDir /etc/pacman.conf; then if rg -q '^CacheDir' /etc/pacman.conf; then
echo "Error: CacheDir is set in /etc/pacman.conf. Aborting..." echo "Error: CacheDir is set in /etc/pacman.conf. Aborting..."
exit 1 exit 1
fi fi