Commit c9e8ff30 authored by Tails developers's avatar Tails developers
Browse files

Remove syslinux language choosing menu.

This branch is about using syslinux to select other kind of options.
tails-greeter allows choosing a !English language.
parent 0225ef67
#!/bin/bash
# Including common functions
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
# Setting static variables
DESCRIPTION="$(Echo 'internationalizing the syslinux menu')"
HELP=""
USAGE="${PROGRAM}"
# Reading configuration files
Read_conffiles config/all config/common config/binary
Set_defaults
if [ "${LB_BOOTLOADER}" != "syslinux" ]
then
exit 0
fi
Echo_message "internationalizing the syslinux menu"
# Get AMNESIA_SUPPORTED_LANGUAGES
. config/amnesia
if [ -e config/amnesia.local ] ; then
. config/amnesia.local
fi
# Setting boot method specific variables
case "${LB_BINARY_IMAGES}" in
iso|iso-hybrid)
SYSLINUX_PATH="binary/isolinux"
;;
usb-hdd)
SYSLINUX_PATH="binary/syslinux"
;;
esac
# Setting variables
SYSLINUX_LIVE_CFG="${SYSLINUX_PATH}/live.cfg"
ORIG_SYSLINUX_LIVE_CFG="${SYSLINUX_PATH}/live.cfg.orig"
CFG_SNIPPET="${SYSLINUX_PATH}/tmp.cfg"
# Backup the original live.cfg
mv "${SYSLINUX_LIVE_CFG}" "${ORIG_SYSLINUX_LIVE_CFG}"
# Get needed values from the original live.cfg
ORIG_KERNEL="`grep -E --max-count=1 '^[ ]+kernel ' "${ORIG_SYSLINUX_LIVE_CFG}"`"
ORIG_APPEND="`grep -E --max-count=1 '^[ ]+append ' "${ORIG_SYSLINUX_LIVE_CFG}"`"
# Sanity checks
if [ -z "${ORIG_KERNEL}" ]; then
Echo_error "Could not parse kernel line in ${ORIG_SYSLINUX_LIVE_CFG}"
exit 15
fi
if [ -z "${ORIG_APPEND}" ]; then
Echo_error "Could not parse append line in ${ORIG_SYSLINUX_LIVE_CFG}"
exit 16
fi
# Make sure all languages are visible in the menu
NUM_LANGUAGES="$(echo ${AMNESIA_SUPPORTED_LANGUAGES} | wc -w)"
echo "menu vshift $[24-${NUM_LANGUAGES}]" >> "${SYSLINUX_LIVE_CFG}"
echo "menu rows ${NUM_LANGUAGES}" >> "${SYSLINUX_LIVE_CFG}"
# Add menu entries
for LANG_CODE in ${AMNESIA_SUPPORTED_LANGUAGES}; do
case "${LANG_CODE}" in
ar)
LANG_NAME='^Arabic'
LANG_APPEND='locales=ar_EG.UTF-8 keyboard-layouts=us,ara'
;;
de)
LANG_NAME='^German'
LANG_APPEND='locales=de_DE.UTF-8 keyboard-layouts=de'
;;
en)
LANG_NAME='^English'
LANG_APPEND=''
;;
es)
LANG_NAME='^Spanish'
LANG_APPEND='locales=es keyboard-layouts=es'
;;
fa)
LANG_NAME='Fa^rsi'
LANG_APPEND='locales=fa_IR.UTF-8 keyboard-layouts=us,ir'
;;
fr)
LANG_NAME='^French'
LANG_APPEND='locales=fr_FR.UTF-8 keyboard-layouts=fr'
;;
it)
LANG_NAME='^Italian'
LANG_APPEND='locales=it keyboard-layouts=it'
;;
pt)
LANG_NAME='^Portuguese'
LANG_APPEND='locales=pt keyboard-layouts=pt'
;;
ru)
LANG_NAME='R^ussian'
LANG_APPEND='locales=ru keyboard-layouts=us,ru'
;;
vi)
LANG_NAME='^Vietnamese'
LANG_APPEND='locales=vi_VN.UTF-8 keyboard-layouts=vn'
;;
zh)
LANG_NAME='^Chinese'
LANG_APPEND='locales=zh_CN.UTF-8'
;;
*)
Echo_error "Language ${LANG_CODE} is not supported yet, ask Tails developpers!"
exit 17
;;
esac
echo "label tails-${LANG_CODE}" >> "${CFG_SNIPPET}"
echo " menu label ${LANG_NAME}" >> "${CFG_SNIPPET}"
if [ "${LANG_CODE}" = 'en' ]; then
echo ' menu default' >> "${CFG_SNIPPET}"
fi
echo "${ORIG_KERNEL}" >> "${CFG_SNIPPET}"
echo "${ORIG_APPEND} ${LANG_APPEND} " >> "${CFG_SNIPPET}"
cat "${CFG_SNIPPET}" >> "${SYSLINUX_LIVE_CFG}"
rm -f "${CFG_SNIPPET}"
done
# Cleanup
rm -f "${ORIG_SYSLINUX_LIVE_CFG}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment