mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
replace grep with rg
This commit is contained in:
parent
4ca32b67d2
commit
21f223b853
2 changed files with 12 additions and 12 deletions
|
@ -23,14 +23,14 @@ _select_mirror() {
|
||||||
_COUNTRY="$(${_DLPROG} "http://ip-api.com/csv/?fields=countryCode")"
|
_COUNTRY="$(${_DLPROG} "http://ip-api.com/csv/?fields=countryCode")"
|
||||||
_DOWNLOAD="Downloading latest mirrorlist for Region ${_COUNTRY}..."
|
_DOWNLOAD="Downloading latest mirrorlist for Region ${_COUNTRY}..."
|
||||||
_download_mirror | _dialog --title " Pacman Configuration " --no-mouse --gauge "${_DOWNLOAD}" 6 70 0
|
_download_mirror | _dialog --title " Pacman Configuration " --no-mouse --gauge "${_DOWNLOAD}" 6 70 0
|
||||||
if grep -q '#Server = https:' /tmp/pacman_mirrorlist.txt; then
|
if rg -q '#Server = https:' /tmp/pacman_mirrorlist.txt; then
|
||||||
mv "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}.bak"
|
mv "${_PACMAN_MIRROR}" "${_PACMAN_MIRROR}.bak"
|
||||||
cp /tmp/pacman_mirrorlist.txt "${_PACMAN_MIRROR}"
|
cp /tmp/pacman_mirrorlist.txt "${_PACMAN_MIRROR}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# This regex doesn't honor commenting
|
# This regex doesn't honor commenting
|
||||||
_MIRRORS=$(grep -E -o '(https)://[^/]*' "${_PACMAN_MIRROR}" | sed 's|$| _|g')
|
_MIRRORS=$(rg -o '(https)://[^/]*' "${_PACMAN_MIRROR}" | sd '$' ' _')
|
||||||
[[ -z ${_MIRRORS} ]] && _MIRRORS=$(grep -E -o '(http)://[^/]*' "${_PACMAN_MIRROR}" | sed 's|$| _|g')
|
[[ -z ${_MIRRORS} ]] && _MIRRORS=$(rg -o '(http)://[^/]*' "${_PACMAN_MIRROR}" | sd '$' ' _'|)
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
_dialog --cancel-label "${_LABEL}" --title " Package Mirror " --menu "" 13 55 7 \
|
_dialog --cancel-label "${_LABEL}" --title " Package Mirror " --menu "" 13 55 7 \
|
||||||
"Custom Mirror" "_" ${_MIRRORS} 2>${_ANSWER} || return 1
|
"Custom Mirror" "_" ${_MIRRORS} 2>${_ANSWER} || return 1
|
||||||
|
@ -45,7 +45,7 @@ _select_mirror() {
|
||||||
# our mirrorlist and pulling the full URL out. Substitute 'core' in
|
# our mirrorlist and pulling the full URL out. Substitute 'core' in
|
||||||
# for the repository name, and ensure that if it was listed twice we
|
# for the repository name, and ensure that if it was listed twice we
|
||||||
# only return one line for the mirror.
|
# only return one line for the mirror.
|
||||||
_SYNC_URL=$(grep -E -o "${_SERVER}.*" "${_PACMAN_MIRROR}" | head -n1)
|
_SYNC_URL=$(rg -o "${_SERVER}.*" "${_PACMAN_MIRROR}" | head -n1)
|
||||||
fi
|
fi
|
||||||
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"
|
echo "Using mirror: ${_SYNC_URL}" >"${_LOG}"
|
||||||
# comment already existing entries
|
# comment already existing entries
|
||||||
|
@ -60,7 +60,7 @@ _select_mirror() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_enable_testing() {
|
_enable_testing() {
|
||||||
if ! grep -q "^\[.*testing\]" /etc/pacman.conf; then
|
if ! rg -q "^\[.*testing\]" /etc/pacman.conf; then
|
||||||
_DOTESTING=""
|
_DOTESTING=""
|
||||||
_dialog --title " Testing Repositories " --defaultno --yesno "Do you want to enable testing repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 8 50 && _DOTESTING=1
|
_dialog --title " Testing Repositories " --defaultno --yesno "Do you want to enable testing repositories?\n\nOnly enable this if you need latest\navailable packages for testing purposes!" 8 50 && _DOTESTING=1
|
||||||
if [[ -n "${_DOTESTING}" ]]; then
|
if [[ -n "${_DOTESTING}" ]]; then
|
||||||
|
@ -95,18 +95,18 @@ _task_update_environment() {
|
||||||
_ONLINE_KERNEL=""
|
_ONLINE_KERNEL=""
|
||||||
pacman -Sy &>"${_LOG}"
|
pacman -Sy &>"${_LOG}"
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
_LOCAL_KERNEL="$(pacman -Qi ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
_LOCAL_KERNEL="$(pacman -Qi ${_KERNELPKG} | rg 'Version.*: (.*)' -r '$1')"
|
||||||
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
if [[ "${_RUNNING_ARCH}" == "aarch64" ]]; then
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG}-${_RUNNING_ARCH} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG}-${_RUNNING_ARCH} | rg 'Version.*: (.*)' -r '$1')"
|
||||||
else
|
else
|
||||||
if [[ -n "${_DOTESTING}" ]]; then
|
if [[ -n "${_DOTESTING}" ]]; then
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
_ONLINE_KERNEL="$(pacman -Si core-testing/${_KERNELPKG} 2>${_NO_LOG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
_ONLINE_KERNEL="$(pacman -Si core-testing/${_KERNELPKG} 2>${_NO_LOG} | rg 'Version.*: (.*)' -r '$1')"
|
||||||
fi
|
fi
|
||||||
if [[ -z "${_ONLINE_KERNEL}" ]]; then
|
if [[ -z "${_ONLINE_KERNEL}" ]]; then
|
||||||
#shellcheck disable=SC2086
|
#shellcheck disable=SC2086
|
||||||
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG} | grep Version | cut -d ':' -f2 | sed -e 's# ##')"
|
_ONLINE_KERNEL="$(pacman -Si ${_KERNELPKG} | rg 'Version.*: (.*)' -r '$1')"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "${_LOCAL_KERNEL} local kernel version and ${_ONLINE_KERNEL} online kernel version." >"${_LOG}"
|
echo "${_LOCAL_KERNEL} local kernel version and ${_ONLINE_KERNEL} online kernel version." >"${_LOG}"
|
||||||
|
@ -170,8 +170,8 @@ EOF
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [[ ! -e "/var/cache/pacman/pkg/archboot.db" ]] &&\
|
if [[ ! -e "/var/cache/pacman/pkg/archboot.db" ]] &&\
|
||||||
update | grep -q '\-latest' &&\
|
update | rg -q '\-latest' &&\
|
||||||
[[ "$(grep -w MemTotal /proc/meminfo | cut -d ':' -f2 | sed -e 's# ##g' -e 's#kB$##g')" -gt "2571000" ]] &&\
|
[[ "$(rg -o 'MemTotal.* (\d+)' -r '$1' /proc/meminfo)" -gt "2571000" ]] &&\
|
||||||
! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
|
! [[ "${_RUNNING_ARCH}" == "riscv64" ]]; then
|
||||||
_update_environment | _dialog --title " Pacman Configuration " --no-mouse --gauge "Checking on new online kernel version..." 6 70 0
|
_update_environment | _dialog --title " Pacman Configuration " --no-mouse --gauge "Checking on new online kernel version..." 6 70 0
|
||||||
if [[ -e /.new_kernel ]]; then
|
if [[ -e /.new_kernel ]]; then
|
||||||
|
|
|
@ -14,7 +14,7 @@ _LABEL="Exit"
|
||||||
_DLPROG="curl -L -s"
|
_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 -o 'MemTotal.* (\d+)' -r '$1' /proc/meminfo)"
|
||||||
if echo "${_BASENAME}" | rg -qw aarch64; then
|
if echo "${_BASENAME}" | rg -qw aarch64; then
|
||||||
_ARCHBOOT="archboot-arm"
|
_ARCHBOOT="archboot-arm"
|
||||||
_KEYRING="${_KEYRING} archlinuxarm-keyring"
|
_KEYRING="${_KEYRING} archlinuxarm-keyring"
|
||||||
|
|
Loading…
Reference in a new issue