Author: blogic
Date: 2014-10-15 19:55:13 +0200 (Wed, 15 Oct 2014)
New Revision: 42926
Modified:
trunk/package/base-files/files/lib/functions.sh
Log:
default_postinst() fix wrong call of group_add
[base-files] default_postinst() fix wrong call of group_add
after 12bae65d07d29854204715cebc1ef1eae237fd9b group_add is
always called. shell scripting can be tricky...
wrong call:
[ -n "$gid" ] && group_exists $name || group_add $name $gid
this leads to a call of 'group_add' when $gid is emtpy, proof:
root@box:~ functionA() { echo A; }
root@box:~ functionB() { echo B; }
root@box:~ VAR=
root@box:~ [ -n "$VAR" ] && functionA || functionB
B
root@box:~ # functionB was called, but VAR is not filled
root@box:~ VAR=filled
root@box:~ [ -n "$VAR" ] && functionA || functionB
A
Signed-off-by: Bastian Bittorf <[email protected]>
Modified: trunk/package/base-files/files/lib/functions.sh
===================================================================
--- trunk/package/base-files/files/lib/functions.sh 2014-10-15 07:14:13 UTC
(rev 42925)
+++ trunk/package/base-files/files/lib/functions.sh 2014-10-15 17:55:13 UTC
(rev 42926)
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2006-2013 OpenWrt.org
+# Copyright (C) 2006-2014 OpenWrt.org
# Copyright (C) 2006 Fokus Fraunhofer <[email protected]>
# Copyright (C) 2010 Vertical Communications
@@ -193,7 +193,10 @@
}
gid=$id
- [ -n "$gid" ] && group_exists $name ||
group_add $name $gid
+ [ -n "$gid" ] && {
+ group_exists $name || group_add $name
$gid
+ }
+
[ -z "$gid" ] && {
group_add_next $name
gid=$?
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits