refactor messages, don't create tempdirs on options listing

This commit is contained in:
Tobias Powalowski 2024-09-08 22:31:33 +02:00
parent f9c0852d02
commit 74efa02b7d
4 changed files with 12 additions and 16 deletions

View file

@ -2,20 +2,17 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults . /etc/archboot/defaults
_ISODIR="$(mktemp -d ISODIR.XXX)"
_BOOTLOADER="/usr/share/archboot/bootloader" _BOOTLOADER="/usr/share/archboot/bootloader"
_usage () { _usage () {
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Create ${_ARCH} ISO Image\e[m" echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Create ${_ARCH} ISO Image\e[m"
echo -e "\e[1m--------------------------------------\e[m" echo -e "\e[1m----------------------------------------\e[m"
echo "This will create an Archboot ISO image." echo "Create an Archboot ISO image: <name>.iso"
echo echo
echo "Options:" echo "Options:"
echo -e " \e[1m-g\e[m Start generation of an ISO image." echo -e " \e[1m-g\e[m Start generation of an ISO image"
echo -e " \e[1m-c=CONFIG\e[m Which CONFIG should be used." echo -e " \e[1m-c=CONFIG\e[m CONFIG from ${_CONFIG_DIR}: default=${_ARCH}.conf"
echo " ${_CONFIG_DIR} includes the config files" echo -e " \e[1m-i=ISO\e[m Customize ISO name"
echo " default=${_ARCH}.conf"
echo -e " \e[1m-i=ISO\e[m Your custom ISO name."
echo -e " \e[1m-s\e[m Save initramfs files in current work directory" echo -e " \e[1m-s\e[m Save initramfs files in current work directory"
echo echo
echo -e "Usage: \e[1m${_BASENAME} <options>\e[m" echo -e "Usage: \e[1m${_BASENAME} <options>\e[m"

View file

@ -9,6 +9,7 @@ _parameters "$@"
_root_check _root_check
_architecture_check _architecture_check
_config _config
_ISODIR="$(mktemp -d ISODIR.XXX)"
if echo "${_BASENAME}" | rg -qw 'aarch64' || echo "${_BASENAME}" | rg -qw 'x86_64'; then if echo "${_BASENAME}" | rg -qw 'aarch64' || echo "${_BASENAME}" | rg -qw 'x86_64'; then
# running system = aarch64 or x86_64 # running system = aarch64 or x86_64
echo "Starting ISO creation..." echo "Starting ISO creation..."

View file

@ -9,6 +9,7 @@ _parameters "$@"
_root_check _root_check
_architecture_check _architecture_check
_config _config
_UKIDIR="$(mktemp -d UKIDIR.XXX)"
echo "Starting UKI creation..." echo "Starting UKI creation..."
_prepare_initramfs || exit 1 _prepare_initramfs || exit 1
_systemd_ukify || exit 1 _systemd_ukify || exit 1

View file

@ -2,20 +2,17 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# created by Tobias Powalowski <tpowa@archlinux.org> # created by Tobias Powalowski <tpowa@archlinux.org>
. /etc/archboot/defaults . /etc/archboot/defaults
_UKIDIR="$(mktemp -d UKIDIR.XXX)"
_usage () { _usage () {
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Create ${_ARCH} UKI Image\e[m" echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Create ${_ARCH} UKI Image\e[m"
echo -e "\e[1m--------------------------------------\e[m" echo -e "\e[1m----------------------------------------\e[m"
echo "This will create an Archboot UKI image." echo "Create an Archboot UKI image: <name>.efi"
echo echo
echo "Options:" echo "Options:"
echo -e " \e[1m-g\e[m Start generation of an UKI image." echo -e " \e[1m-g\e[m Start generation of an UKI image."
echo -e " \e[1m-c=CONFIG\e[m Which CONFIG should be used." echo -e " \e[1m-c=CONFIG\e[m CONFIG from ${_CONFIG_DIR}: default=${_ARCH}.conf"
echo " ${_CONFIG_DIR} includes the config files" echo -e " \e[1m-cli='options'\e[m Customize kernel commandline options"
echo " default=${_ARCH}.conf" echo -e " \e[1m-i=UKI\e[m Customize UKI image name"
echo -e " \e[1m-cli='options'\e[m Your custom kernel commandline options."
echo -e " \e[1m-i=UKI\e[m Your custom UKI image name."
echo echo
echo -e "Usage: \e[1m${_BASENAME} <options>\e[m" echo -e "Usage: \e[1m${_BASENAME} <options>\e[m"
exit 0 exit 0