Commits

TZ86 committed c274b00

start to port away from systemd tools

Comments (0)

Files changed (2)

 	calc_columns
 }
 
+set_consolefont() {
+        [[ $CONSOLEFONT ]] || return 0
+        stat_busy "Loading Console Font: $CONSOLEFONT"
+                #CONSOLEMAP in UTF-8 shouldn't be used
+                [[ $CONSOLEMAP && ${LOCALE,,} =~ utf ]] && CONSOLEMAP=""
+                local i
+                for i in /dev/tty[0-9]*; do
+                        setfont ${CONSOLEMAP:+-m "${CONSOLEMAP}"} \
+                                "$CONSOLEFONT" -C ${i} &>/dev/null
+                done
+        if (( $? )); then
+                stat_fail
+        else
+                stat_done
+        fi
+}
+
 activate_vgs() {
 	[[ $USELVM = [yY][eE][sS] && -x $(type -P lvm) && -d /sys/block ]] || return 0
 	stat_busy "Activating LVM2 groups"
 udevd_modprobe sysinit
 
 # this must be done after udev has loaded the KMS modules
-status 'Configuring virtual consoles' /usr/lib/systemd/systemd-vconsole-setup
+#status 'Configuring virtual consoles' /usr/lib/systemd/systemd-vconsole-setup
+if [[ ${LOCALE,,} =~ utf ]]; then
+        stat_busy "Setting Consoles to UTF-8 mode"
+                # UTF-8 consoles are default since 2.6.24 kernel
+                # this code is needed not only for older kernels,
+                # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
+                for i in /dev/tty[0-9]*; do
+                        kbd_mode -u < ${i}
+                        printf "\e%%G" > ${i}
+                done
+                echo 1 >| /sys/module/vt/parameters/default_utf8
+        stat_done
+else
+        stat_busy "Setting Consoles to legacy mode"
+                # make non-UTF-8 consoles work on 2.6.24 and newer kernels
+                for i in /dev/tty[0-9]*; do
+                        kbd_mode -a < ${i}
+                        printf "\e%%@" > ${i}
+                done
+                echo 0 >| /sys/module/vt/parameters/default_utf8
+        stat_done
+fi
+
+# Set console font and keymap if required
+set_consolefont
+
+[[ $KEYMAP ]] &&
+        status "Loading Keyboard Map: $KEYMAP" loadkeys -q $KEYMAP
 
 # bring up the loopback interface
 [[ -d /sys/class/net/lo ]] &&