diff options
author | 2005-11-30 10:03:22 +0000 | |
---|---|---|
committer | 2005-11-30 10:03:22 +0000 | |
commit | 4979098b2f4324a062eeaebe3039fd596d8b4e28 (patch) | |
tree | f832d482627bf1b28b2b14df8e25858a465fa272 | |
parent | Import the latest baselayout changes. Merging revision 1634. (diff) | |
download | baselayout-vserver-4979098b2f4324a062eeaebe3039fd596d8b4e28.tar.gz baselayout-vserver-4979098b2f4324a062eeaebe3039fd596d8b4e28.tar.bz2 baselayout-vserver-4979098b2f4324a062eeaebe3039fd596d8b4e28.zip |
Import the latest baselayout changes. Merging revision 1648.
svn path=/baselayout-vserver/trunk/; revision=123
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.vserver | 16 | ||||
-rw-r--r-- | STYLE | 13 | ||||
-rw-r--r-- | etc/conf.d/rc | 6 | ||||
-rwxr-xr-x | init.d/bootmisc | 14 | ||||
-rwxr-xr-x | init.d/domainname | 14 | ||||
-rwxr-xr-x | init.d/hostname | 6 | ||||
-rwxr-xr-x | init.d/local | 8 | ||||
-rw-r--r-- | po/Makefile | 36 | ||||
-rwxr-xr-x | sbin/functions.sh | 4 | ||||
-rwxr-xr-x | sbin/runscript.sh | 5 |
11 files changed, 109 insertions, 21 deletions
@@ -1,6 +1,14 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 + 29 Nov 2005; Martin Schlemmer <azarah@gentoo.org>: + + Add po/Makefile, based mostly on work done by Rach Holmes <Rach.Holmes@GMX.net> + and James Rowe <Jay@jnrowe.uklinux.net> since Mike changed most rc-scripts to + support it. + + Set TEXTDOMAIN and TEXTDOMAINDIR. Install locale into $svclib. + 28 Nov 2005; Roy Marples <uberlord@gentoo.org>: Fixed fallback_routes, #113776. diff --git a/ChangeLog.vserver b/ChangeLog.vserver index dc480b5..7bed750 100644 --- a/ChangeLog.vserver +++ b/ChangeLog.vserver @@ -1,6 +1,22 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPLv2 + 30 Nov 2005; Christian Heim <phreak@gentoo.org>: + Import the latest baselayout changes. Merging revision 1648. + + ChangeLog | 8 ++++ + ChangeLog.vserver | 16 ++++++++ + STYLE | 13 ++++++ + etc/conf.d/rc | 6 +++ + init.d/bootmisc | 14 +++---- + init.d/domainname | 14 +++---- + init.d/hostname | 6 +-- + init.d/local | 8 ++-- + po/Makefile | 36 ++++++++++++++++++ + sbin/functions.sh | 4 ++ + sbin/runscript.sh | 5 ++ + 11 files changed, 109 insertions(+), 21 deletions(-) + 28 Nov 2005; Christian Heim <phreak@gentoo.org>: Import the latest baselayout changes. Merging revision 1634. @@ -56,6 +56,19 @@ or #gentoo-base on irc.freenode.net. Do not lead with 'function ' e.g. function foo() { +####### +# NLS # +####### +- General - + When displaying strings that a user would read, + use the $"" form so that it can be localized. + However, you generally you dont want to localize + config files that only a program would parse. + e.g. ebegin $"Starting blahblah" + e.g. echo "SOMETHING=foobar" > /etc/config.file + e.g. echo $"Notice for user" > /etc/motd + e.g. ewarn $"Skipping running booga" + ############ # COMMENTS # ############ diff --git a/etc/conf.d/rc b/etc/conf.d/rc index a672722..eb880fb 100644 --- a/etc/conf.d/rc +++ b/etc/conf.d/rc @@ -35,6 +35,12 @@ RC_NET_STRICT_CHECKING="none" RC_AUTO_INTERFACE="no" +# RC_VERBOSE will make init scripts more verbose. Only networking scripts +# really use this at this time, and this is useful for trouble shooting +# any issues you may have. +# +RC_VERBOSE="no" + # Set to "yes" if you want to use gentoo init style # in the util-vserver configuration diff --git a/init.d/bootmisc b/init.d/bootmisc index f9a76b3..5cc2907 100755 --- a/init.d/bootmisc +++ b/init.d/bootmisc @@ -15,17 +15,17 @@ start() { # system startup is complete. # if [[ ${DELAYLOGIN} == "yes" ]] ; then - echo "System bootup in progress - please wait" > /etc/nologin + echo $"System bootup in progress - please wait" > /etc/nologin cp /etc/nologin /etc/nologin.boot &> /dev/null fi if ! touch /var/run/.keep 2> /dev/null ; then - ewarn "Skipping /var and /tmp initialization (ro root?)" + ewarn $"Skipping /var and /tmp initialization (ro root?)" return 0 fi if [[ -x /sbin/env-update.sh ]] ; then - ebegin "Updating environment" + ebegin $"Updating environment" /sbin/env-update.sh -u > /dev/null eend 0 fi @@ -35,12 +35,12 @@ start() { # if [[ -d /var/lib/net-scripts/state ]] ; then - ebegin "Cleaning /var/lib/net-scripts/state" + ebegin $"Cleaning" /var/lib/net-scripts/state rm -rf /var/lib/net-scripts/state/* eend 0 fi - ebegin "Cleaning /var/lock, /var/run" + ebegin $"Cleaning" /var/lock, /var/run rm -rf /var/run/console.lock /var/run/console/* # @@ -71,7 +71,7 @@ start() { if [[ -d /tmp ]] ; then cd /tmp if [[ ${WIPE_TMP} == "yes" ]] ; then - ebegin "Wiping /tmp directory" + ebegin $"Wiping /tmp directory" # This eval stuff sucks, so if someone has a better *working* # solution, please file a bug at http://bugs.gentoo.org/ # Originally ripped from Debian init scripts @@ -92,7 +92,7 @@ start() { eval find . -xdev -depth ${exceptions} -type d -empty -exec rmdir '{}' \\';' eend 0 else - ebegin "Cleaning /tmp directory" + ebegin $"Cleaning /tmp directory" ( rm -f /tmp/.X*-lock /tmp/esrv* /tmp/kio* /tmp/jpsock.* /tmp/.fam* rm -rf /tmp/.esd* /tmp/orbit-* /tmp/ssh-* /tmp/ksocket-* /tmp/.*-unix diff --git a/init.d/domainname b/init.d/domainname index 619ad38..5de43cd 100755 --- a/init.d/domainname +++ b/init.d/domainname @@ -9,7 +9,7 @@ depend() { checkconfig_nis() { if [[ -f /etc/nisdomainname ]] ; then - ewarn "You should stop using /etc/nisdomainname and use /etc/conf.d/domainname" + ewarn $"You should stop using /etc/nisdomainname and use /etc/conf.d/domainname" export NISDOMAIN=$(</etc/nisdomainname) return 0 fi @@ -18,13 +18,13 @@ checkconfig_nis() { checkconfig_dns() { if [[ -f /etc/dnsdomainname ]] ; then - ewarn "You should stop using /etc/dnsdomainname and use /etc/conf.d/domainname" + ewarn $"You should stop using /etc/dnsdomainname and use /etc/conf.d/domainname" export DNSDOMAIN=$(</etc/dnsdomainname) fi [[ -z ${DNSDOMAIN} ]] && return 1 if ! touch /etc/resolv.conf 2> /dev/null ; then - ewarn "Unable to set domain in resolv.conf (ro root?)" + ewarn $"Unable to set domain in resolv.conf (ro root?)" return 1 else return 0 @@ -39,21 +39,21 @@ start() { local retval2=0 if checkconfig_nis ; then - ebegin "Setting NIS domainname to ${NISDOMAIN}" + ebegin $"Setting NIS domainname to" ${NISDOMAIN} hostname -y "${NISDOMAIN}" retval=$? - eend ${retval} "Failed to set the NIS domainname" + eend ${retval} $"Failed to set the NIS domainname" fi if checkconfig_dns ; then - ebegin "Setting DNS domainname to ${DNSDOMAIN}" + ebegin $"Setting DNS domainname to" ${DNSDOMAIN} resolv=$(grep -v '^[[:space:]]*domain' /etc/resolv.conf) [[ ${OVERRIDE} == "1" ]] \ && resolv="${resolv}"$'\n'"domain ${DNSDOMAIN}" \ || resolv="domain ${DNSDOMAIN}"$'\n'"${resolv}" echo "${resolv}" > /etc/resolv.conf retval2=$? - eend ${retval2} "Failed to set the DNS domainname" + eend ${retval2} $"Failed to set the DNS domainname" fi return $((retval + retval2)) diff --git a/init.d/hostname b/init.d/hostname index 47c200a..0037aab 100755 --- a/init.d/hostname +++ b/init.d/hostname @@ -16,16 +16,16 @@ start() { fi if [[ -f /etc/hostname ]] ; then - ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname" + ewarn $"You should stop using /etc/hostname and use /etc/conf.d/hostname" myhost=$(</etc/hostname) else myhost=${HOSTNAME} fi - ebegin "Setting hostname to ${myhost}" + ebegin $"Setting hostname to" ${myhost} hostname "${myhost}" retval=$? - eend ${retval} "Failed to set the hostname" + eend ${retval} $"Failed to set the hostname" if [[ ${retval} -eq 0 ]] ; then # setup $HOSTNAME, ignore errors in case /etc is readonly. diff --git a/init.d/local b/init.d/local index b729e9d..550c0f0 100755 --- a/init.d/local +++ b/init.d/local @@ -7,7 +7,7 @@ depend() { } start() { - ebegin "Starting local" + ebegin $"Starting local" # Add any misc programs that should be started # to /etc/conf.d/local.start @@ -15,11 +15,11 @@ start() { source /etc/conf.d/local.start fi - eend $? "Failed to start local" + eend $? $"Failed to start local" } stop() { - ebegin "Stopping local" + ebegin $"Stopping local" # Add any misc programs that should be stopped # to /etc/conf.d/local.stop @@ -27,7 +27,7 @@ stop() { source /etc/conf.d/local.stop fi - eend $? "Failed to stop local" + eend $? $"Failed to stop local" } diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..7a07f4d --- /dev/null +++ b/po/Makefile @@ -0,0 +1,36 @@ +initd_IN := $(wildcard ../init.d/*) +sbin_IN := $(filter-out %.patch,$(wildcard ../sbin/*)) +ALL_IN := $(initd_IN) $(sbin_IN) + +localedir := $(shell eval `grep '^svclib' ../sbin/functions.sh`; echo "$${svclib}/locale") +LINGUAS_ALL := $(patsubst %.po,%,$(wildcard *.po)) +LINGUAS ?= $(LINGUAS_ALL) +LINGUAS := $(filter $(LINGUAS_ALL),$(LINGUAS)) + +all: $(LINGUAS:%=%.mo) + +%.mo : %.po + msgfmt --statistics -o $@ $< + +%.po : rc-scripts.pot + msgmerge --update $@ $^ + +rc-scripts.pot: $(ALL_IN) + rm -f rc-scripts.pot; touch rc-scripts.pot + for file in $+ ; do \ + bash --dump-po-strings $$file \ + | msguniq \ + | msgcat --force-po -F - rc-scripts.pot -o rc-scripts.pot; \ + done + +clean: + rm -f *.mo *~ + +install: all + for lang in $(LINGUAS); do \ + install -d $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES ; \ + install -m 644 $$lang.mo \ + $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/rc-scripts.mo ; \ + done + +.PHONY: install clean all diff --git a/sbin/functions.sh b/sbin/functions.sh index ab39a45..e635de1 100755 --- a/sbin/functions.sh +++ b/sbin/functions.sh @@ -46,6 +46,10 @@ RC_DEFAULT_INDENT=2 #RC_DOT_PATTERN=' .' RC_DOT_PATTERN='' +# Setup i18n variables +TEXTDOMAINDIR="${svclib}/locale" +TEXTDOMAIN="rc-scripts" + # void import_addon(char *addon) # # Import code from the specified addon if it exists diff --git a/sbin/runscript.sh b/sbin/runscript.sh index 6e7404c..67626ed 100755 --- a/sbin/runscript.sh +++ b/sbin/runscript.sh @@ -39,6 +39,11 @@ else NETSERVICE= fi +# Check if the textdomain is non-default +search_lang=${LC_ALL:-${LC_MESSAGES:-${LANG}}} +[[ -f ${TEXTDOMAINDIR}/${search_lang%.*}/LC_MESSAGES/${myservice}.mo ]] \ + && TEXTDOMAIN=${myservice} + # Source configuration files. # (1) Source /etc/conf.d/${myservice} to get initscript-specific # configuration (if it exists). |