feat: shorten long commands

This commit is contained in:
Ben Grande 2025-01-17 19:12:54 +01:00
parent f63b5132ba
commit bc1072d099
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
2 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
# SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
@ -26,9 +26,9 @@ writeconf(){
value="$3"
group_id="$(grep -B1 -e "^Description=${group}$" -- "${file}" | head -1 |
tr -d "[" | tr -d "]")"
tr -d "\[\]")"
if test -z "${group_id}"; then
highest_id="$(grep -e "\[[0-9]\+\]" -- "${file}" | tr -d "[" | tr -d "]" |
highest_id="$(grep -e "\[[0-9]\+\]" -- "${file}" | tr -d "\[\]" |
sort | tail -1)"
if test -n "${highest_id}"; then
group_id="$((highest_id+1))"

View File

@ -6,12 +6,10 @@
set -eu
conf="${HOME}/.bitcoin/conf.d/dbcache.conf"
domid="$(xenstore-read -- domid)"
xenstore_mem_dir="/local/domain/${domid}/memory"
if test -f /var/run/qubes-service/meminfo-writer; then
mem_KiB="$(xenstore-read -- "${xenstore_mem_dir}/hotplug-max")"
mem_KiB="$(xenstore-read -- memory/hotplug-max)"
else
mem_KiB="$(xenstore-read -- "${xenstore_mem_dir}/static-max")"
mem_KiB="$(xenstore-read -- memory/static-max)"
fi
cache_MiB=$((mem_KiB/1024))
cache="$((cache_MiB*80/100))"