diff mbox

[ovs-dev,rhel,--user,v2,1/7] ovs-ctl: Remove hard coded root user and group

Message ID 1448019200-87207-1-git-send-email-azhou@ovn.org
State Changes Requested
Headers show

Commit Message

Andy Zhou Nov. 20, 2015, 11:33 a.m. UTC
Replace hard coded root user and group with OVS_USER and OVS_GROUP.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ansis Atteka <aatteka@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
---
 utilities/ovs-ctl.in | 3 +++
 utilities/ovs-lib.in | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Flavio Leitner Nov. 26, 2015, 11:03 p.m. UTC | #1
On Fri, Nov 20, 2015 at 03:33:14AM -0800, Andy Zhou wrote:
> Replace hard coded root user and group with OVS_USER and OVS_GROUP.
> 
> Signed-off-by: Andy Zhou <azhou@ovn.org>
> Acked-by: Ansis Atteka <aatteka@ovn.org>
> Acked-by: Ben Pfaff <blp@ovn.org>
> ---
>  utilities/ovs-ctl.in | 3 +++
>  utilities/ovs-lib.in | 6 +++---
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> index 0082bed..c9d75df 100755
> --- a/utilities/ovs-ctl.in
> +++ b/utilities/ovs-ctl.in
> @@ -13,6 +13,9 @@
>  # See the License for the specific language governing permissions and
>  # limitations under the License.
>  
> +OVS_USER=root         # Default user.
> +OVS_GROUP=root        # Default group.
> +
>  case $0 in
>      */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
>      *) dir0=./ ;;
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index dd8a1e9..34e2041 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -140,16 +140,16 @@ start_daemon () {
>      strace=""
>  
>      # drop core files in a sensible place
> -    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
> +    test -d "$DAEMON_CWD" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$DAEMON_CWD"
>      set "$@" --no-chdir
>      cd "$DAEMON_CWD"
>  
>      # log file
> -    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
> +    test -d "$logdir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$logdir"
>      set "$@" --log-file="$logdir/$daemon.log"
>  
>      # pidfile and monitoring
> -    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
> +    test -d "$rundir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$rundir"
>      set "$@" --pidfile="$rundir/$daemon.pid"
>      set "$@" --detach --monitor

What about upgrade_db()? 

fbl
Flavio Leitner Nov. 26, 2015, 11:46 p.m. UTC | #2
On Thu, Nov 26, 2015 at 09:03:16PM -0200, Flavio Leitner wrote:
> On Fri, Nov 20, 2015 at 03:33:14AM -0800, Andy Zhou wrote:
> > Replace hard coded root user and group with OVS_USER and OVS_GROUP.
> > 
> > Signed-off-by: Andy Zhou <azhou@ovn.org>
> > Acked-by: Ansis Atteka <aatteka@ovn.org>
> > Acked-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  utilities/ovs-ctl.in | 3 +++
> >  utilities/ovs-lib.in | 6 +++---
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> > index 0082bed..c9d75df 100755
> > --- a/utilities/ovs-ctl.in
> > +++ b/utilities/ovs-ctl.in
> > @@ -13,6 +13,9 @@
> >  # See the License for the specific language governing permissions and
> >  # limitations under the License.
> >  
> > +OVS_USER=root         # Default user.
> > +OVS_GROUP=root        # Default group.
> > +
> >  case $0 in
> >      */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
> >      *) dir0=./ ;;
> > diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> > index dd8a1e9..34e2041 100644
> > --- a/utilities/ovs-lib.in
> > +++ b/utilities/ovs-lib.in
> > @@ -140,16 +140,16 @@ start_daemon () {
> >      strace=""
> >  
> >      # drop core files in a sensible place
> > -    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
> > +    test -d "$DAEMON_CWD" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$DAEMON_CWD"
> >      set "$@" --no-chdir
> >      cd "$DAEMON_CWD"
> >  
> >      # log file
> > -    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
> > +    test -d "$logdir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$logdir"
> >      set "$@" --log-file="$logdir/$daemon.log"
> >  
> >      # pidfile and monitoring
> > -    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
> > +    test -d "$rundir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$rundir"
> >      set "$@" --pidfile="$rundir/$daemon.pid"
> >      set "$@" --detach --monitor
> 
> What about upgrade_db()? 

I saw in the patch 6 fixing the ownership.

Acked-by: Flavio Leitner <fbl@sysclose.org>


> 
> fbl
> 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 0082bed..c9d75df 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -13,6 +13,9 @@ 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+OVS_USER=root         # Default user.
+OVS_GROUP=root        # Default group.
+
 case $0 in
     */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
     *) dir0=./ ;;
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index dd8a1e9..34e2041 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -140,16 +140,16 @@  start_daemon () {
     strace=""
 
     # drop core files in a sensible place
-    test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD"
+    test -d "$DAEMON_CWD" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$DAEMON_CWD"
     set "$@" --no-chdir
     cd "$DAEMON_CWD"
 
     # log file
-    test -d "$logdir" || install -d -m 755 -o root -g root "$logdir"
+    test -d "$logdir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$logdir"
     set "$@" --log-file="$logdir/$daemon.log"
 
     # pidfile and monitoring
-    test -d "$rundir" || install -d -m 755 -o root -g root "$rundir"
+    test -d "$rundir" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$rundir"
     set "$@" --pidfile="$rundir/$daemon.pid"
     set "$@" --detach --monitor