#!/bin/sh
# arctic-firstboot - shown once, the first time a finished install boots.
# Also usable by hand: arctic-firstboot
# shellcheck shell=sh disable=SC2039

if [ -t 1 ]; then
	R=$(printf '\033[0m'); B=$(printf '\033[1m')
	TEAL=$(printf '\033[38;5;44m'); SNOW=$(printf '\033[38;5;231m')
	GREY=$(printf '\033[38;5;245m')
else
	R= ; B= ; TEAL= ; SNOW= ; GREY=
fi

printf '\n%s' "$TEAL$B"
cat <<'ARCTIC'
 _____________________
< Enjoy Arctic linux! >
 ---------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/
ARCTIC
printf '%s\n' "$R"

# A short orientation note, only on a real first boot.
if [ "${1:-}" != "-q" ]; then
	rel=/etc/arctic-release
	k=$(sed -n 's/^KERNEL=//p' "$rel" 2>/dev/null)
	printf '  %skernel%s   %s\n' "$GREY" "$R" "${k:-$(uname -r)}"
	printf '  %spackages%s %s installed\n' "$GREY" "$R" \
		"$(ls -1 /var/lib/alpm/local 2>/dev/null | wc -l | tr -d ' ')"
	printf '\n'
	printf '  %salpm%s to install things, %sservice%s to run them,\n' \
		"$SNOW" "$R" "$SNOW" "$R"
	printf '  %sdoas%s when you need root.\n\n' "$SNOW" "$R"
fi
