X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=scripts%2Flive-functions;h=c5055a0a642c14458eb7fc708d10178c77e01826;hb=bd2cfbec5fe67ea696162c1caa5c80187a070bee;hp=7100603b474148bfebad4c943167d3323d7c6e92;hpb=ea5ccacffb14572b4800d14fc9eea23cad7ca893;p=live-boot-grml.git diff --git a/scripts/live-functions b/scripts/live-functions index 7100603..c5055a0 100644 --- a/scripts/live-functions +++ b/scripts/live-functions @@ -1,35 +1,60 @@ +#!/bin/sh . /scripts/functions . /live.vars -# Override this so we don't call PROGRESS -log_end_msg() +log_wait_msg () { - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "SUCCESS ok" - fi - _log_msg "Done." -} - -# Print a message and wait for enter -log_wait_msg() -{ - if [ -x /sbin/usplash_write ]; then - /sbin/usplash_write "INPUTENTER $@" + # Print a message and wait for enter + if [ -x /sbin/usplash_write ] + then + /sbin/usplash_write "INPUTENTER ${@}" read nunya < /dev/.initramfs/usplash_outfifo fi - _log_msg "Waiting: $@ ..." + + _log_msg "Waiting: ${@} ..." } really_export () { - STRING="${1}" - VALUE="$(eval echo -n \${$STRING})" + STRING="${1}" + VALUE="$(eval echo -n \${$STRING})" - if [ -f /live.vars ] && cat /live.vars | grep -sq "export ${STRING}" ; then - sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars - else - echo "export ${STRING}=\"${VALUE}\"" >> /live.vars - fi - eval export "${STRING}"="${VALUE}" + if [ -f /live.vars ] && cat /live.vars | grep -sq "export ${STRING}" + then + sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars + else + echo "export ${STRING}=\"${VALUE}\"" >> /live.vars + fi + + eval export "${STRING}"="${VALUE}" +} + +lang2locale() { + langpart="${1%%_*}" + if [ "$1" != "C" ]; then + # Match the language code with 3rd field in languagelist + line=$(grep -v "^#" /root/usr/share/live-initramfs/languagelist | cut -f3,4,5 -d\; | grep -v ';C$' | grep "^$langpart;") + if [ -n "$line" ]; then + if [ "$(echo "$line" | grep -c '')" -gt 1 ]; then + # More than one match; try matching the + # country as well. + countrypart="${1#*_}" + if [ "$countrypart" = "$1" ]; then + countryline="$(echo "$line" | head -n1)" + echo "${countryline##*;}" + return + fi + countrypart="${countrypart%%[@.]*}" + countryline="$(echo "$line" | grep ";$countrypart;" | head -n1 || true)" + if [ "$countryline" ]; then + echo "${countryline##*;}" + return + fi + fi + echo "${line##*;}" + fi + else + echo "C" + fi }