0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.135.249.76


Current Path : /proc/self/root/usr/share/initramfs-tools/scripts/init-top/
Upload File :
Current File : //proc/self/root/usr/share/initramfs-tools/scripts/init-top/console_setup

#! /bin/sh
# A crude much-simplified clone of setupcon for use in the initramfs.

OPTION=FRAMEBUFFER
PREREQ="framebuffer"

prereqs () {
	echo "$PREREQ"
}

case $1 in
prereqs)
	prereqs
	exit 0
	;;
esac

[ -r /etc/default/console-setup ] || exit 0
. /etc/default/console-setup

[ "$ACTIVE_CONSOLES" ] || exit 0

# CODESET
[ "$CODESET" != guess ] || CODESET=''
if [ -z "$CODESET" ]; then
    case "$CHARMAP" in
        UTF-8)            CODESET=Uni2;;
        ARMSCII-8)        CODESET=Armenian ;;
        CP1251)           CODESET=CyrSlav ;;
        CP1255)           CODESET=Hebrew ;;
        CP1256)           CODESET=Arabic ;;
        GEORGIAN-ACADEMY) CODESET=Georgian ;;
        GEORGIAN-PS)      CODESET=Georgian ;;
        IBM1133)          CODESET=Lao ;;
        ISIRI-3342)       CODESET=Arabic ;;
        ISO-8859-1)       CODESET=Lat15 ;;
        ISO-8859-2)       CODESET=Lat2 ;;
        ISO-8859-3)       CODESET=Lat38 ;;
        ISO-8859-4)       CODESET=Lat7 ;; # sometimes Lat15
        ISO-8859-5)       CODESET=CyrSlav ;;
        ISO-8859-6)       CODESET=Arabic ;;
        ISO-8859-7)       CODESET=Greek ;;
        ISO-8859-8)       CODESET=Hebrew ;;
        ISO-8859-9)       CODESET=Lat15 ;;
        ISO-8859-10)      CODESET=Lat15 ;;
        ISO-8859-11)      CODESET=Thai ;;
        ISO-8859-13)      CODESET=Lat7 ;;
        ISO-8859-14)      CODESET=Lat38 ;;
        ISO-8859-15)      CODESET=Lat15 ;;
        ISO-8859-16)      CODESET=Lat2 ;;
        KOI8-R)           CODESET=CyrKoi ;;
        KOI8-U)           CODESET=CyrKoi ;;
        TIS-620)          CODESET=Thai ;;
        VISCII)           CODESET=Vietnamese ;;
        *)	            ;;
    esac
fi

# FONTSIZE
if [ -z "$FONTSIZE" -o "$FONTSIZE" = guess ]; then
    FONTSIZE=16
fi
case "$FONTSIZE" in
    8x*)
        FONTSIZE=${FONTSIZE#*x}
        ;;
    *x8)
        FONTSIZE=${FONTSIZE%x*}
        ;;
    *x*)
        a=${FONTSIZE%x*}
        b=${FONTSIZE#*x}
        if [ "$a" -lt "$b" ]; then
            FONTSIZE=${b}x${a}
        fi
        ;;
esac

if [ "$VERBOSE_OUTPUT" = yes ]; then
	verbose=
else
	verbose='>/dev/null 2>&1'
fi

for i in 1 2 3 4 5 6; do
	[ -c /dev/tty$i ] || mknod /dev/tty$i c 4 $i
done

for console in $ACTIVE_CONSOLES; do
	[ -w $console ] || continue

	if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM$CHARMAP" ]; then
		printf '\033%%G' >$console
	else
		printf '\033%%@' >$console
	fi

	if [ "$FONT" ]; then
		FONT="/etc/console-setup/${FONT##*/}"
		FONT="${FONT%.gz}"
	else
		FONT="/etc/console-setup/$CODESET-$FONTFACE$FONTSIZE.psf"
	fi
	if [ -f "$FONT" ] || [ -f "$FONT.gz" ]; then
		if type consolechars >/dev/null 2>&1; then
			eval consolechars -v --tty=$console -f "$FONT" $verbose
		elif type setfont >/dev/null 2>&1; then
			eval setfont -v -C $console "$FONT" $verbose
		fi
	fi

	if [ "$ACM" ]; then
		ACM="/etc/console-setup/${ACM##*/}"
		ACM="${ACM%.gz}"
	else
		ACM="/etc/console-setup/$CHARMAP.acm"
	fi
	if [ -f "$ACM" ] || [ -f "$ACM.gz" ]; then
		if type consolechars >/dev/null 2>&1; then
			eval consolechars -v --tty=$console --acm "$ACM" \
				$verbose
		elif type setfont >/dev/null 2>&1; then
			eval setfont -v -C "$console" -m "$ACM" $verbose
		fi
	fi

	if type kbd_mode >/dev/null 2>&1; then
		if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM" ]; then
			kbd_mode -u <$console
		else
			kbd_mode -a <$console
		fi
	fi
done

if [ -f "/etc/console-setup/cached_${CHARMAP}_del.kmap.gz" ] && type loadkeys >/dev/null; then
	eval loadkeys "/etc/console-setup/cached_${CHARMAP}_del.kmap.gz" $verbose
fi

exit 0