aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Bornkessel <hd_brummy@gentoo.org>2015-01-01 18:15:46 +0100
committerJoerg Bornkessel <hd_brummy@gentoo.org>2015-01-01 18:15:46 +0100
commit707151b74bdd220dd19e1d19955cc40e16449f02 (patch)
tree44a961b3286ff3c53e9c7b7aed6a70c5ca6d3fbe
parentsystemd readme, written by L.Muresan; added L.Muresan as maintainer for syste... (diff)
downloadgentoo-vdr-scripts-707151b74bdd220dd19e1d19955cc40e16449f02.tar.gz
gentoo-vdr-scripts-707151b74bdd220dd19e1d19955cc40e16449f02.tar.bz2
gentoo-vdr-scripts-707151b74bdd220dd19e1d19955cc40e16449f02.zip
fixed LANG handling, some cleanups for baselayout1; fixed fails to set locale on systemd, thx to D.Ferdinand for reporting and some hints how to fix it, wrt bug #530690
-rw-r--r--ChangeLog7
-rw-r--r--usr/share/vdr/rcscript/pre-start-45-locales.sh46
-rw-r--r--usr/share/vdr/systemd/vdr-systemd_helper.sh10
3 files changed, 41 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 341d7e6..7ac98a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for gentoo-vdr-scripts
# $Id$
+ 01 Jan 2015; Joerg Bornkessel <hd_brummy@gentoo.org>
+ usr/share/vdr/rcscript/pre-start-45-locales.sh,
+ usr/share/vdr/systemd/vdr-systemd_helper.sh:
+ fixed LANG handling, some cleanups for baselayout1; fixed fails to set locale
+ on systemd, thx to D.Ferdinand for reporting and some hints how to fix it,
+ wrt bug #530690
+
27 Nov 2014; Joerg Bornkessel <hd_brummy@gentoo.org> README, README.systemd,
etc/conf.d/vdr, etc/systemd/system/vdr.service.d/00-gentoo-vdr-user.conf:
systemd readme, written by L.Muresan; added L.Muresan as maintainer for
diff --git a/usr/share/vdr/rcscript/pre-start-45-locales.sh b/usr/share/vdr/rcscript/pre-start-45-locales.sh
index aa1e110..4792df0 100644
--- a/usr/share/vdr/rcscript/pre-start-45-locales.sh
+++ b/usr/share/vdr/rcscript/pre-start-45-locales.sh
@@ -3,6 +3,8 @@
# disable all locale settings from the system
# mostly used to get away from utf8 if vdr does
# not support it
+source /etc/conf.d/vdr
+
unset_all_locale_settings() {
local LOCALE_VARS="LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY
LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE
@@ -51,31 +53,31 @@ addon_main() {
else
ewarn "You have not set a locale/charmap!"
ewarn "Please set LANG in /etc/conf.d/vdr"
-
- if [ ! -e /lib/librc.so ]; then
- # baselayout1
- ewarn "or do this system-wide in /etc/env.d/02locale"
- fi
- fi
-
- # Lets guess
-
- # try an english utf8 locale first
- local l="$(locale -a|grep utf8|grep ^en|head -n 1)"
-
- if [ "${l}" = "" ]; then
- # none found
- # try any existing utf8 locale
- l="$(locale -a|grep utf8|head -n 1)"
fi
-
- if [ "${l}" != "" ]; then
- export LANG="${l}"
- einfo "Auto-selected locale: ${l}"
+ else
+ # Lets guess UTF-8
+ if [ -n "${LANG}" ]; then
+ # LANG should defined to UTF-8 on baselayout2
+ # export LANG from systemwide settings or LANG from /etc/conf.d/vdr, if specified
+ export LANG="${LANG}"
else
- ewarn "Did not find an utf8 locale. You may have problems with non-ASCII characters"
- fi
+ # if LANG is not defined (fix your setup, dude), we try to auto detect an existing UTF-8 locale
+ # we try an english utf8 locale first
+ local l="$(locale -a|grep utf8|grep ^en|head -n 1)"
+
+ if [ "${l}" = "" ]; then
+ # none english locale found
+ # try any existing utf8 locale
+ l="$(locale -a|grep utf8|head -n 1)"
+ fi
+ if [ "${l}" != "" ]; then
+ export LANG="${l}"
+ einfo "Auto-selected locale: ${l}"
+ else
+ ewarn "Did not find an utf8 locale. You may have problems with non-ASCII characters"
+ fi
+ fi
fi
else
# vdr does not support utf8
diff --git a/usr/share/vdr/systemd/vdr-systemd_helper.sh b/usr/share/vdr/systemd/vdr-systemd_helper.sh
index f2b3f46..5ec6495 100644
--- a/usr/share/vdr/systemd/vdr-systemd_helper.sh
+++ b/usr/share/vdr/systemd/vdr-systemd_helper.sh
@@ -90,11 +90,21 @@ if [ "$1" = "--start-pre" ]; then
init_params
init_plugin_loader start || eexitfail "init_plugin_loader start"
load_addons_prefixed pre-start || eexitfail "load_addons_prefixed pre-start"
+
# these options are what we need to start VDR from the systemd unit file
echo "VDR_OPTS=\"${vdr_opts}\"" > ${SYSTEMD_ENV_FILE}
+
+ # LANG LC_COLLATE from /etc/conf.d/vdr will be ignored, wrt bug 530690
+ echo "LANG=$LANG" >> ${SYSTEMD_ENV_FILE}
+ echo "LC_COLLATE=${VDR_SORT_ORDER}" >> ${SYSTEMD_ENV_FILE}
+ # Using LC_ALL is strongly discouraged as it can't be overridden later on.
+ # Please use it only when testing and never set it in a startup file.
+# echo "LC_ALL=$LANG" >> ${SYSTEMD_ENV_FILE}
+
# remove the command line --user argument if set by the scripts so far,
# as the user under which vdr will run is controlled by systemd
sed -e "s:'-u' 'vdr' ::" -i ${SYSTEMD_ENV_FILE}
+
sync
eend "--start-pre"
elif [ "$1" = "--start-post" ]; then