[arch-commits] Commit in filesystem/trunk (filesystem.install)

Dave Reisner dreisner at archlinux.org
Mon Feb 20 20:48:02 UTC 2012


    Date: Monday, February 20, 2012 @ 15:48:02
  Author: dreisner
Revision: 150700

- use getent where possible, rather than grep

Modified:
  filesystem/trunk/filesystem.install

--------------------+
 filesystem.install |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Modified: filesystem.install
===================================================================
--- filesystem.install	2012-02-20 20:46:45 UTC (rev 150699)
+++ filesystem.install	2012-02-20 20:48:02 UTC (rev 150700)
@@ -10,15 +10,15 @@
 
 # args: <group> [options]
 _addgroup() {
-	if ! grep -q "^$1:" etc/group; then
-		groupadd ${@} >/dev/null
+	if ! getent group "$1"; then
+		groupadd "$@" >/dev/null
 	fi
 }
 
 # args: <group> [options]
 _adduser() {
-	if ! grep -q "^$1:" etc/passwd; then
-		useradd ${@} >/dev/null
+	if ! getent passwd "$1"; then
+		useradd "$@" >/dev/null
 	fi
 }
 




More information about the arch-commits mailing list