summaryrefslogtreecommitdiffstats
path: root/source/a/kbd/setconsolefont
diff options
context:
space:
mode:
Diffstat (limited to 'source/a/kbd/setconsolefont')
-rw-r--r--source/a/kbd/setconsolefont320
1 files changed, 52 insertions, 268 deletions
diff --git a/source/a/kbd/setconsolefont b/source/a/kbd/setconsolefont
index fe56a34f6..c35f0c1de 100644
--- a/source/a/kbd/setconsolefont
+++ b/source/a/kbd/setconsolefont
@@ -4,13 +4,22 @@
# Updated by Stuart Winter <mozes@slackware.com>
# Run 'setfont' in a chroot. This makes setfont work
# correctly in the installer.
-
# 2010-04-28, add LatKaCyrHeb-14.psfu.gz <volkerdi>
+# 25-Mar-2018, generate font list on the fly <David Woodfall>
if [ "$TMP" = "" ]; then
TMP=/var/log/setup/tmp
fi
+get_font_list() {
+ LS_FONTS=$(/bin/ls $T_PX/usr/share/kbd/consolefonts/*.gz \
+ | rev | cut -f 1 -d / | rev | tail -n +10 | sed "s%$% ''%g" | tr '\n' ' ')
+ CP_FONTS="'161.cp.gz -16' '' '162.cp.gz -16' '' '163.cp.gz -16' '' \
+ '164.cp.gz -16' '' '165.cp.gz -16' '' '737.cp.gz -16' '' \
+ '880.cp.gz -16' '' '928.cp.gz -16' '' '972.cp.gz -16' '' "
+ ALL_FONTS="$CP_FONTS$LS_FONTS"
+}
+
load_font() {
if [ ! -z "$T_PX" ]; then
CHROOT="chroot $T_PX"
@@ -47,212 +56,16 @@ out some custom screen fonts?" 5 60
exit
fi
fi
+
+ get_font_list
+
REPLY=`mktemp -q $TMP/temp.XXXXXX`
FONT="161.cp.gz -16"
while [ 0 ]; do
- dialog --default-item "$FONT" --title "SELECT A SCREEN FONT" --menu "Select one of the following \
-custom fonts. If you decide you like it, you can make it your new default \
-screen font. You'll be able to try as many of these as you like." 21 65 12 \
-"161.cp.gz -16" "" \
-"162.cp.gz -16" "" \
-"163.cp.gz -16" "" \
-"164.cp.gz -16" "" \
-"165.cp.gz -16" "" \
-"737.cp.gz -16" "" \
-"880.cp.gz -16" "" \
-"928.cp.gz -16" "" \
-"972.cp.gz -16" "" \
-"Agafari-12.psfu.gz" "" \
-"Agafari-14.psfu.gz" "" \
-"Agafari-16.psfu.gz" "" \
-"Cyr_a8x14.psfu.gz" "" \
-"Cyr_a8x16.psfu.gz" "" \
-"Cyr_a8x8.psfu.gz" "" \
-"Goha-12.psfu.gz" "" \
-"Goha-14.psfu.gz" "" \
-"Goha-16.psfu.gz" "" \
-"GohaClassic-12.psfu.gz" "" \
-"GohaClassic-14.psfu.gz" "" \
-"GohaClassic-16.psfu.gz" "" \
-"Lat2-Terminus16.psfu.gz" "" \
-"LatArCyrHeb-08.psfu.gz" "" \
-"LatArCyrHeb-14.psfu.gz" "" \
-"LatArCyrHeb-16+.psfu.gz" "" \
-"LatArCyrHeb-16.psfu.gz" "" \
-"LatArCyrHeb-19.psfu.gz" "" \
-"LatKaCyrHeb-14.psfu.gz" "" \
-"Mik_8x16.gz" "" \
-"UniCyrExt_8x16.psf.gz" "" \
-"UniCyr_8x14.psf.gz" "" \
-"UniCyr_8x16.psf.gz" "" \
-"UniCyr_8x8.psf.gz" "" \
-"alt-8x14.gz" "" \
-"alt-8x16.gz" "" \
-"alt-8x8.gz" "" \
-"altc-8x16.gz" "" \
-"aply16.psf.gz" "" \
-"arm8.fnt.gz" "" \
-"b.fnt.gz" "" \
-"c.fnt.gz" "" \
-"cp1250.psfu.gz" "" \
-"cp850-8x14.psfu.gz" "" \
-"cp850-8x16.psfu.gz" "" \
-"cp850-8x8.psfu.gz" "" \
-"cp857.08.gz" "" \
-"cp857.14.gz" "" \
-"cp857.16.gz" "" \
-"cp865-8x14.psfu.gz" "" \
-"cp865-8x16.psfu.gz" "" \
-"cp865-8x8.psfu.gz" "" \
-"cp866-8x14.psf.gz" "" \
-"cp866-8x16.psf.gz" "" \
-"cp866-8x8.psf.gz" "" \
-"cybercafe.fnt.gz" "" \
-"cyr-sun16.psfu.gz" "" \
-"default8x16.psfu.gz" "" \
-"default8x9.psfu.gz" "" \
-"drdos8x14.psfu.gz" "" \
-"drdos8x16.psfu.gz" "" \
-"drdos8x6.psfu.gz" "" \
-"drdos8x8.psfu.gz" "" \
-"gr737a-8x8.psfu.gz" "" \
-"gr737a-9x14.psfu.gz" "" \
-"gr737a-9x16.psfu.gz" "" \
-"gr737b-8x11.psfu.gz" "" \
-"gr737b-9x16-medieval.psfu.gz" "" \
-"gr737c-8x14.psfu.gz" "" \
-"gr737c-8x16.psfu.gz" "" \
-"gr737c-8x6.psfu.gz" "" \
-"gr737c-8x7.psfu.gz" "" \
-"gr737c-8x8.psfu.gz" "" \
-"gr737d-8x16.psfu.gz" "" \
-"gr928-8x16-thin.psfu.gz" "" \
-"gr928-9x14.psfu.gz" "" \
-"gr928-9x16.psfu.gz" "" \
-"gr928a-8x14.psfu.gz" "" \
-"gr928a-8x16.psfu.gz" "" \
-"gr928b-8x14.psfu.gz" "" \
-"gr928b-8x16.psfu.gz" "" \
-"greek-polytonic.psfu.gz" "" \
-"iso01-12x22.psfu.gz" "" \
-"iso01.08.gz" "" \
-"iso01.14.gz" "" \
-"iso01.16.gz" "" \
-"iso02-12x22.psfu.gz" "" \
-"iso02.08.gz" "" \
-"iso02.14.gz" "" \
-"iso02.16.gz" "" \
-"iso03.08.gz" "" \
-"iso03.14.gz" "" \
-"iso03.16.gz" "" \
-"iso04.08.gz" "" \
-"iso04.14.gz" "" \
-"iso04.16.gz" "" \
-"iso05.08.gz" "" \
-"iso05.14.gz" "" \
-"iso05.16.gz" "" \
-"iso06.08.gz" "" \
-"iso06.14.gz" "" \
-"iso06.16.gz" "" \
-"iso07.14.gz" "" \
-"iso07.16.gz" "" \
-"iso07u-16.psfu.gz" "" \
-"iso08.08.gz" "" \
-"iso08.14.gz" "" \
-"iso08.16.gz" "" \
-"iso09.08.gz" "" \
-"iso09.14.gz" "" \
-"iso09.16.gz" "" \
-"iso10.08.gz" "" \
-"iso10.14.gz" "" \
-"iso10.16.gz" "" \
-"koi8-14.psf.gz" "" \
-"koi8c-8x16.gz" "" \
-"koi8r-8x14.gz" "" \
-"koi8r-8x16.gz" "" \
-"koi8r-8x8.gz" "" \
-"koi8r.8x8.psfu.gz" "" \
-"koi8u_8x14.psfu.gz" "" \
-"koi8u_8x16.psfu.gz" "" \
-"koi8u_8x8.psfu.gz" "" \
-"lat0-08.psfu.gz" "" \
-"lat0-10.psfu.gz" "" \
-"lat0-12.psfu.gz" "" \
-"lat0-14.psfu.gz" "" \
-"lat0-16.psfu.gz" "" \
-"lat1-08.psfu.gz" "" \
-"lat1-10.psfu.gz" "" \
-"lat1-12.psfu.gz" "" \
-"lat1-14.psfu.gz" "" \
-"lat1-16.psfu.gz" "" \
-"lat2-08.psfu.gz" "" \
-"lat2-10.psfu.gz" "" \
-"lat2-12.psfu.gz" "" \
-"lat2-14.psfu.gz" "" \
-"lat2-16.psfu.gz" "" \
-"lat2a-16.psfu.gz" "" \
-"lat4-08.psfu.gz" "" \
-"lat4-10.psfu.gz" "" \
-"lat4-12.psfu.gz" "" \
-"lat4-14.psfu.gz" "" \
-"lat4-16+.psfu.gz" "" \
-"lat4-16.psfu.gz" "" \
-"lat4-19.psfu.gz" "" \
-"lat4a-08.psfu.gz" "" \
-"lat4a-10.psfu.gz" "" \
-"lat4a-12.psfu.gz" "" \
-"lat4a-14.psfu.gz" "" \
-"lat4a-16+.psfu.gz" "" \
-"lat4a-16.psfu.gz" "" \
-"lat4a-19.psfu.gz" "" \
-"lat5-12.psfu.gz" "" \
-"lat5-14.psfu.gz" "" \
-"lat5-16.psfu.gz" "" \
-"lat7-14.psfu.gz" "" \
-"lat7a-14.psfu.gz" "" \
-"lat7a-16.psf.gz" "" \
-"lat9-08.psf.gz" "" \
-"lat9-10.psf.gz" "" \
-"lat9-12.psf.gz" "" \
-"lat9-14.psf.gz" "" \
-"lat9-16.psf.gz" "" \
-"lat9u-08.psfu.gz" "" \
-"lat9u-10.psfu.gz" "" \
-"lat9u-12.psfu.gz" "" \
-"lat9u-14.psfu.gz" "" \
-"lat9u-16.psfu.gz" "" \
-"lat9v-08.psfu.gz" "" \
-"lat9v-10.psfu.gz" "" \
-"lat9v-12.psfu.gz" "" \
-"lat9v-14.psfu.gz" "" \
-"lat9v-16.psfu.gz" "" \
-"lat9w-08.psfu.gz" "" \
-"lat9w-10.psfu.gz" "" \
-"lat9w-12.psfu.gz" "" \
-"lat9w-14.psfu.gz" "" \
-"lat9w-16.psfu.gz" "" \
-"m.fnt.gz" "" \
-"ml.fnt.gz" "" \
-"mod_d.fnt.gz" "" \
-"mod_s.fnt.gz" "" \
-"mr.fnt.gz" "" \
-"mu.fnt.gz" "" \
-"r.fnt.gz" "" \
-"rl.fnt.gz" "" \
-"ro.fnt.gz" "" \
-"ruscii_8x16.psfu.gz" "" \
-"ruscii_8x8.psfu.gz" "" \
-"s.fnt.gz" "" \
-"sc.fnt.gz" "" \
-"scrawl_s.fnt.gz" "" \
-"scrawl_w.fnt.gz" "" \
-"sd.fnt.gz" "" \
-"sun12x22.psfu.gz" "" \
-"t.fnt.gz" "" \
-"t850b.fnt.gz" "" \
-"tcvn8x16.psf.gz" "" \
-"viscii10-8x16.psfu.gz" "" \
-2> $REPLY
+ sh -c "dialog --default-item \"$FONT\" --title \"SELECT A SCREEN FONT\" \
+ --menu \"Select one of the following custom fonts. If you decide you \
+like it, you can make it your new default screen font. You'll be able \
+to try as many of these as you like.\" 21 65 12 -- $ALL_FONTS 2> $REPLY"
if [ ! $? = 0 ]; then
load_font
exit
@@ -260,14 +73,24 @@ screen font. You'll be able to try as many of these as you like." 21 65 12 \
FONT=`cat $REPLY`
rm -f $REPLY
load_font $FONT
- dialog --title "SET AS DEFAULT FONT" --yesno "Well, what do you think? \
-If you'd like to make this your default font, select YES. You can change \
-the default font any time by typing 'setconsolefont' or by editing \
-/etc/rc.d/rc.font. If you don't \
-like this font, select NO, and you'll be returned to the font selection \
-menu. If you decide you want to stick with the default font, hit ESC or \
-CANCEL once you get to that menu." 11 60
- if [ $? = 0 ]; then
+ while [ 0 ]; do
+ # Match the dialog colors a little while doing the font test:
+ setterm -background cyan -foreground black -blank 0
+ clear
+ cat << EOF
+
+OK, the new font is now installed. You may now test it by typing
+anything you want. To quit testing the font, enter 1 on a line by
+itself to accept the font and go on, or 2 on a line by itself to
+reject the current font and select a new one.
+
+EOF
+ read REPLY
+ if [ "$REPLY" = "1" -o "$REPLY" = "2" ]; then
+ break;
+ fi
+ done
+ if [ "$REPLY" = "1" ]; then
cat << EOF > $T_PX/etc/rc.d/rc.font
#!/bin/sh
#
@@ -277,6 +100,7 @@ CANCEL once you get to that menu." 11 60
setfont -v $FONT
EOF
chmod 755 $T_PX/etc/rc.d/rc.font
+ reset
exit
else
load_font
@@ -289,54 +113,13 @@ else # no color!
if [ "$YESNO" = "n" ]; then
exit
fi
+ get_font_list
while [ 0 ]; do
cat << EOF
SELECT A SCREEN FONT. Your choices are:
-161.cp.gz 162.cp.gz 163.cp.gz 164.cp.gz 165.cp.gz 737.cp.gz 880.cp.gz 928.cp.gz
-972.cp.gz Agafari-12.psfu.gz Agafari-14.psfu.gz Agafari-16.psfu.gz
-Cyr_a8x14.psfu.gz Cyr_a8x16.psfu.gz Cyr_a8x8.psfu.gz Goha-12.psfu.gz
-Goha-14.psfu.gz Goha-16.psfu.gz GohaClassic-12.psfu.gz GohaClassic-14.psfu.gz
-GohaClassic-16.psfu.gz Lat2-Terminus16.psfu.gz LatArCyrHeb-08.psfu.gz
-LatArCyrHeb-14.psfu.gz LatArCyrHeb-16+.psfu.gz LatArCyrHeb-16.psfu.gz
-LatArCyrHeb-19.psfu.gz LatKaCyrHeb-14.psfu.gz
-Mik_8x16.gz UniCyrExt_8x16.psf.gz UniCyr_8x14.psf.gz
-UniCyr_8x16.psf.gz UniCyr_8x8.psf.gz alt-8x14.gz alt-8x16.gz alt-8x8.gz
-altc-8x16.gz aply16.psf.gz arm8.fnt.gz b.fnt.gz c.fnt.gz cp1250.psfu.gz
-cp850-8x14.psfu.gz cp850-8x16.psfu.gz cp850-8x8.psfu.gz cp857.08.gz cp857.14.gz
-cp857.16.gz cp865-8x14.psfu.gz cp865-8x16.psfu.gz cp865-8x8.psfu.gz
-cp866-8x14.psf.gz cp866-8x16.psf.gz cp866-8x8.psf.gz cybercafe.fnt.gz
-cyr-sun16.psfu.gz default8x16.psfu.gz default8x9.psfu.gz drdos8x14.psfu.gz
-drdos8x16.psfu.gz drdos8x6.psfu.gz drdos8x8.psfu.gz gr737a-8x8.psfu.gz
-gr737a-9x14.psfu.gz gr737a-9x16.psfu.gz gr737b-8x11.psfu.gz
-gr737b-9x16-medieval.psfu.gz gr737c-8x14.psfu.gz gr737c-8x16.psfu.gz
-gr737c-8x6.psfu.gz gr737c-8x7.psfu.gz gr737c-8x8.psfu.gz gr737d-8x16.psfu.gz
-gr928-8x16-thin.psfu.gz gr928-9x14.psfu.gz gr928-9x16.psfu.gz
-gr928a-8x14.psfu.gz gr928a-8x16.psfu.gz gr928b-8x14.psfu.gz gr928b-8x16.psfu.gz
-greek-polytonic.psfu.gz iso01-12x22.psfu.gz iso01.08.gz iso01.14.gz iso01.16.gz
-iso02-12x22.psfu.gz iso02.08.gz iso02.14.gz iso02.16.gz iso03.08.gz iso03.14.gz
-iso03.16.gz iso04.08.gz iso04.14.gz iso04.16.gz iso05.08.gz iso05.14.gz
-iso05.16.gz iso06.08.gz iso06.14.gz iso06.16.gz iso07.14.gz iso07.16.gz
-iso07u-16.psfu.gz iso08.08.gz iso08.14.gz iso08.16.gz iso09.08.gz iso09.14.gz
-iso09.16.gz iso10.08.gz iso10.14.gz iso10.16.gz koi8-14.psf.gz koi8c-8x16.gz
-koi8r-8x14.gz koi8r-8x16.gz koi8r-8x8.gz koi8r.8x8.psfu.gz koi8u_8x14.psfu.gz
-koi8u_8x16.psfu.gz koi8u_8x8.psfu.gz lat0-08.psfu.gz lat0-10.psfu.gz
-lat0-12.psfu.gz lat0-14.psfu.gz lat0-16.psfu.gz lat1-08.psfu.gz lat1-10.psfu.gz
-lat1-12.psfu.gz lat1-14.psfu.gz lat1-16.psfu.gz lat2-08.psfu.gz lat2-10.psfu.gz
-lat2-12.psfu.gz lat2-14.psfu.gz lat2-16.psfu.gz lat2a-16.psfu.gz lat4-08.psfu.gz
-lat4-10.psfu.gz lat4-12.psfu.gz lat4-14.psfu.gz lat4-16+.psfu.gz lat4-16.psfu.gz
-lat4-19.psfu.gz lat4a-08.psfu.gz lat4a-10.psfu.gz lat4a-12.psfu.gz
-lat4a-14.psfu.gz lat4a-16+.psfu.gz lat4a-16.psfu.gz lat4a-19.psfu.gz
-lat5-12.psfu.gz lat5-14.psfu.gz lat5-16.psfu.gz lat7-14.psfu.gz lat7a-14.psfu.gz
-lat7a-16.psf.gz lat9-08.psf.gz lat9-10.psf.gz lat9-12.psf.gz lat9-14.psf.gz
-lat9-16.psf.gz lat9u-08.psfu.gz lat9u-10.psfu.gz lat9u-12.psfu.gz
-lat9u-14.psfu.gz lat9u-16.psfu.gz lat9v-08.psfu.gz lat9v-10.psfu.gz
-lat9v-12.psfu.gz lat9v-14.psfu.gz lat9v-16.psfu.gz lat9w-08.psfu.gz
-lat9w-10.psfu.gz lat9w-12.psfu.gz lat9w-14.psfu.gz lat9w-16.psfu.gz m.fnt.gz
-ml.fnt.gz mod_d.fnt.gz mod_s.fnt.gz mr.fnt.gz mu.fnt.gz r.fnt.gz rl.fnt.gz
-ro.fnt.gz ruscii_8x16.psfu.gz ruscii_8x8.psfu.gz s.fnt.gz sc.fnt.gz
-scrawl_s.fnt.gz scrawl_w.fnt.gz sd.fnt.gz sun12x22.psfu.gz t.fnt.gz t850b.fnt.gz
-tcvn8x16.psf.gz viscii10-8x16.psfu.gz
+
+$(echo $ALL_FONTS | sed "s/'//g" | sed "s/ -16//g" | sed "s/ / /g" | sed "s/ / /g" | sed "s/ / /g" | tr '\n' ' ' | fold -w $(tput cols) -s)
EOF
echo -n "Which font would you like (or ENTER to quit)? "
@@ -355,20 +138,21 @@ Sorry, I couldn't find that font. Try again.
EOF
fi
load_font $FONT
- cat << EOF
-
-SET AS DEFAULT FONT
+ while [ 0 ]; do
+ cat << EOF
-Well, what do you think? If you'd like to make this your default font, select
-YES. You can change the default font any time by typing 'setconsolefont' or by
-editing /etc/rc.d/rc.font. If you don't like this font, select NO, and you'll
-be able to select a different one. If you decide you want to stick with the
-default font, hit RETURN once you return to the font selection menu.
+OK, the new font is now installed. You may now test it by typing
+anything you want. To quit testing the font, enter 1 on a line by
+itself to accept the font and go on, or 2 on a line by itself to
+reject the current font and select a new one.
EOF
- echo -n "Would you like to have this font loaded by default ([y]es, [n]o)? "
- read DEF
- if [ "$DEF" = "YES" -o "$DEF" = "y" ]; then
+ read REPLY
+ if [ "$REPLY" = "1" -o "$REPLY" = "2" ]; then
+ break;
+ fi
+ done
+ if [ "$REPLY" = "1" ]; then
cat << EOF > $T_PX/etc/rc.d/rc.font
#!/bin/sh
#
@@ -378,7 +162,7 @@ EOF
setfont -v $FONT
EOF
chmod 755 $T_PX/etc/rc.d/rc.font
- echo
+ reset
exit
else
load_font