From a80c10bcea2ac23e81e0d7e053f63393b3701e55 Mon Sep 17 00:00:00 2001 From: Dennis ten Hoove Date: Thu, 22 Jun 2023 02:27:51 +0200 Subject: [PATCH] Make printfs bold --- bttrfs-build | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bttrfs-build b/bttrfs-build index 0f78a67..d8efd42 100755 --- a/bttrfs-build +++ b/bttrfs-build @@ -35,7 +35,7 @@ declare -r output_target='./output.img' cleanup_and_quit () { # If any paramters are passed we will assume it to be an error - [[ -n $1 ]] && printf "\e[1;31m<#>\e[0m $*\n" >&2 + [[ -n $1 ]] && printf "\e[1;31m<#>\e[0m $*\e[0m\n" >&2 # Remove temporary btrfs volumes [[ ! -n $BTTRFS_NO_CLEANUP ]] && btrfs subvolume delete $workdir 2> /dev/null @@ -52,20 +52,20 @@ cleanup_and_quit () { # # Quit if not root [[ ! $EUID -eq 0 ]] && - printf '\e[31m<#>\e[0m This program has to be run as root\n' && + printf '\e[1;31m<#>\e[0m\e[1m This program has to be run as root\n\e[0m' && exit 1 # Check if all dependencies are installed, quit if not for prog in btrfs pacstrap; do if ! command -v $prog > /dev/null; then - printf "\e[31m<#>\e[0m Failed to locate $prog, ensure it is installed\n" + printf "\e[1;31m<#>\e[0m\e[1m Failed to locate $prog, ensure it is installed\e[0m\n" exit 1 fi done # Check if requested variant exists [[ ! -d $variant ]] && - printf '\e[31m<#>\e[0m The requested variant does not exist\n' && + printf '\e[1;31m<#>\e[0m\e[1m The requested variant does not exist\e[0m\n' && exit 1 ## Variants @@ -75,28 +75,28 @@ if [[ $type -eq 'archlinux' ]]; then # Ensure base.list exists, if not error and quit [[ ! -e $variant/base.list ]] && - printf "\e[31m<#>\e[0m The required file 'base.list' is not preset in $(readlink -m $variant)\n" && + printf "\e[1;31m<#>\e[0m\e[1m The required file 'base.list' is not preset in $(readlink -m $variant)\e[0m\n" && exit 1 # Check if optional packages.list file exists, if not notify and continue [[ ! -e $variant/packages.list ]] && - printf "\e[34m-->\e[0m The optional file 'packages.list' is not preset in $(readlink -m $variant), running without it\n" && + printf "\e[1;34m-->\e[0m\e[1m The optional file 'packages.list' is not preset in $(readlink -m $variant), running without it\e[0m\n" && skip_secondary_package_installation=1 - printf '\e[34m-->\e[0m Started Arch linux image build\n' + printf '\e[1;34m-->\e[0m\e[1m Started Arch linux image build\e[0m\n' # Create temporary Btrfs subvolume - printf "\e[34m-->\e[0m Creating temporary Btrfs subvolume at $workdir\n" + printf "\e[1;34m-->\e[0m\e[1m Creating temporary Btrfs subvolume at $workdir\e[0m\n" btrfs subvolume create $workdir || cleanup_and_quit "Failed to create btrfs subvolume $workdir" # Read base package list and install base system readarray base_packages < $variant/base.list - printf "\e[34m-->\e[0m Installing base packages\n" + printf "\e[1;34m-->\e[0m\e[1m Installing base packages\e[0m\n" pacstrap $workdir ${base_packages[*]} || cleanup_and_quit 'Failed to install secondary package list' # Read package list and install secondary system components, skip if not used if [[ ! -n skip_secondary_package_installation ]]; then - printf '\e[34m-->\e[0m Installing secondary packages...\n' + printf '\e[1;34m-->\e[0m\e[1m Installing secondary packages...\e[0m\n' readarray packages < $variant/packages.list arch-chroot $workdir pacman -S --noconfirm ${packages[*]} || cleanup_and_quit 'Failed to install base packages' fi @@ -108,18 +108,18 @@ if [[ $type -eq 'archlinux' ]]; then # Remove subvolumes created by systemd [[ -d $workdir/var/lib/portables ]] && - printf "\e[34m-->\e[0m Removing systemd subvolume var/lib/portables\n" && + printf "\e[1;34m-->\e[0m\e[1m Removing systemd subvolume var/lib/portables\e[0m\n" && btrfs subvolume delete $workdir/var/lib/portables [[ -d $workdir/var/lib/machines ]] && - printf "\e[34m-->\e[0m Removing systemd subvolume var/lib/machines\n" && + printf "\e[1;34m-->\e[0m\e[1m Removing systemd subvolume var/lib/machines\e[0m\n" && btrfs subvolume delete $workdir/var/lib/machines # Make subvolume read-only - printf "\e[34m-->\e[0m Adding read-only property to subvolume\n" + printf "\e[1;34m-->\e[0m\e[1m Adding read-only property to subvolume\e[0m\n" btrfs property set -ts $workdir ro true # Write subvolume to image - printf "\e[34m-->\e[0m Writing image...\n" + printf "\e[1;34m-->\e[0m\e[1m Writing image...\e[0m\n" btrfs send -f $output_target $workdir cleanup_and_quit