From: Michael Prokop Date: Tue, 12 Nov 2013 12:39:15 +0000 (+0100) Subject: Improve error handling for update-locale X-Git-Tag: v0.59~1 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=2ef61aac8e83be7d8a53cf6914ce3c29004c2143;hp=6e7a2c86d3a42f6477756a59f1a3de744cc091a3;ds=sidebyside Improve error handling for update-locale Set absolute path to /usr/sbin/update-locale to make sure the binary can be accessed no matter what's inside $PATH and if it's not present inform user about it, but do not fail because the locales-all package might be installed and it doesn't provide the /usr/sbin/update-locale binary. --- diff --git a/chroot-script b/chroot-script index 6d01a89..28684dd 100755 --- a/chroot-script +++ b/chroot-script @@ -431,7 +431,13 @@ EOF # set default locales {{{ default_locales() { if [ -n "$DEFAULT_LOCALES" ] ; then - update-locale LANG="$DEFAULT_LOCALES" + if ! [ -x /usr/sbin/update-locale ] ; then + echo "Warning: update-locale executable not available (no locales package installed?)" + echo "Ignoring request to run update-locale for $DEFAULT_LOCALES therefore" + return 0 + fi + + /usr/sbin/update-locale LANG="$DEFAULT_LOCALES" fi } # }}}