File: gparted-console-font-size

package info (click to toggle)
clonezilla 5.9.9-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,516 kB
  • sloc: sh: 40,222; perl: 193; python: 59; makefile: 26
file content (75 lines) | stat: -rwxr-xr-x 2,344 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Program to tune the GParted live console font size in KMS mode, especially for HiDPI monitor.
# For the font size, run "man console-setup" for more details. The following is from "man console-setup":
# FONTFACE and FONTSIZE
#   Valid font faces are: VGA (sizes 8x8, 8x14, 8x16, 16x28 and 16x32), Terminus (sizes 6x12, 8x14, 8x16, 10x20,
#   12x24,  14x28  and  16x32),  TerminusBold (sizes 8x14, 8x16, 10x20, 12x24, 14x28 and 16x32), TerminusBoldVGA
#   (sizes 8x14 and 8x16), and Fixed (sizes 8x13, 8x14, 8x15, 8x16 and  8x18).   If  however  CODESET=Ethiopian,
#   then the available font faces are Goha and GohaClassic, each in sizes 8x12, 8x14 and 8x16.

# Load GParted live functions
. /usr/share/gparted/bin/gl-functions
# Load the config
[ -e /etc/gparted-live/gparted-live.conf ] && . /etc/gparted-live/gparted-live.conf

# Settings
console_setup_cfg="/etc/default/console-setup"
default_font_size="16x32" # Available size: 6x12, 8x14, 8x16, 10x20, 12x24,  14x28  and  16x32

#
check_if_root

# Functions
USAGE() {
   echo "Usage: $0 [Font size] "
   echo "Available font size: 6x12, 8x14, 8x16, 10x20, 12x24, 14x28 and 16x32. Default is $default_font_size."
   echo "Ex:"
   echo "To set the font size as 14x28, run"
   echo "   $ocs 14x28"
   echo
}

####################
### Main program ###
####################

ocs_file="$0"
ocs=`basename $ocs_file`
#
while [ $# -gt 0 ]; do
 case "$1" in
   -*)     echo "${0}: ${1}: invalid option" >&2
           USAGE >& 2
           exit 2 ;;
   *)      break ;;
 esac
done
#
font_size="$1"

#
[ -z "$font_size" ] && font_size="$default_font_size"
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "Using font size for the console: $font_size"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
#

##############
#### main ####
##############

if [ ! -e "$console_setup_cfg" ]; then
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "Config file $console_setup_cfg not found."
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo "$msg_program_stop!"
  my_ocs_exit 1
fi
cp $console_setup_cfg ${console_setup_cfg}.ocs-saved
perl -pi -e "s/^CODESET=.*/CODESET=\"Uni2\"/g" $console_setup_cfg
perl -pi -e "s/^FONTFACE=.*/FONTFACE=\"Terminus\"/g" $console_setup_cfg
perl -pi -e "s/^FONTSIZE=.*/FONTSIZE=\"$font_size\"/g" $console_setup_cfg
# Make it take effect
setupcon
rc=$?
exit $rc