]> git.lyx.org Git - features.git/commitdiff
Use getent instead of grepping /etc/passwd.
authorEnrico Forestieri <forenr@lyx.org>
Sun, 13 Jul 2014 12:39:05 +0000 (14:39 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Sun, 13 Jul 2014 12:39:05 +0000 (14:39 +0200)
Forthcoming versions of cygwin will use a different mechanism for
obtaining passwd/group information based on /etc/nsswitch.conf.
Thus, it will not be guaranteed that the files /etc/passwd and
/etc/group even exist. The recommended way for obtaining those
info is by using the getent command, which already works in
current versions.

development/cygwin/lyxprofile

index f51bd556f1c41b25fe831a51d12b2073834e21e0..afa21beb41825f1d32d9080a1cc2c1ebe302d370 100644 (file)
@@ -1,7 +1,7 @@
 # Set up the home directory if not already set in the system environment.
 if [ -z "${HOME}" ]; then
   USER=`id -un`
-  HOME=`grep "^${USER}:" /etc/passwd | cut -d: -f6`
+  HOME=`getent passwd "${USER}" | cut -d: -f6`
   if [ -z "${HOME}" -o ! -d "${HOME}" ]; then
     HOME="/home/${USER}"
     test -d "${HOME}" || HOME=/tmp