add _archboot_check

This commit is contained in:
Tobias Powalowski 2023-09-01 13:28:32 +02:00
parent bfbdb5e11d
commit 9b42c8113d
3 changed files with 12 additions and 8 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
. /usr/lib/archboot/common.sh
_APPNAME=${0##*/}
_usage () {
echo "Check on missing binaries in archboot environment"
@ -12,10 +13,7 @@ _usage () {
exit 0
}
[[ -z "${1}" ]] && _usage
if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then
echo "This script should only be run in booted archboot environment. Aborting..."
exit 1
fi
_archboot_check
# update pacman db first
pacman -Sy
if [[ "${1}" == "base" ]]; then

View file

@ -1,10 +1,8 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org>
if [[ ! "$(cat /etc/hostname)" == "archboot" ]]; then
echo "This script should only be run in booted archboot environment. Aborting..."
exit 1
fi
. /usr/lib/archboot/common.sh
_archboot_check
rm -r /usr/share/licenses
pacman -Sy
pacman -Q | cut -d ' ' -f1 >packages.txt

View file

@ -39,6 +39,14 @@ _root_check() {
fi
}
### check for x86_64
_archboot_check() {
if ! grep -qw 'archboot' /etc/hostname; then
echo "This script should only be run in booted archboot environment. Aborting..."
exit 1
fi
}
### check for x86_64
_x86_64_check() {
if ! [[ "${_RUNNING_ARCH}" == "x86_64" ]]; then