# Attempt to add missing en_US latin1 locale
if ! locale -a |grep -q '^en_US$'; do
# half-arsed Ubuntu detection
if [ -x /usr/bin/lsb_release ] && [ "x$(lsb_release -si)" = "xUbuntu" ]; then
supd=/var/lib/locales/supported.d/local
if [ -e $supd ]; then
if ! grep -q '^en_US.ISO-8859-1' $supd; then
echo "Appending en_US.ISO-8859-1 to $supd."
echo 'en_US.ISO-8859-1 ISO8859-1' >> $supd
do_localegen=1
else
echo 'W: en_US.ISO-8859-1 already present in $supd but no en_US in output of "locale -a".'
echo ' This should not happen. dsmcad service may misbehave or fail to start!'
fi
else
echo "Creating $supd."
echo 'en_US.ISO-8859-1 ISO8859-1' > $supd
do_localegen=1
fi
else # assume Debian
[...]
fi
fi