[PC-BSD Commits] r16603 - pcbsd/current/src-sh/pbreg

svn at pcbsd.org svn at pcbsd.org
Mon Apr 30 13:36:55 PDT 2012


Author: kris
Date: 2012-04-30 20:36:55 +0000 (Mon, 30 Apr 2012)
New Revision: 16603

Modified:
   pcbsd/current/src-sh/pbreg/pbreg
Log:

When running as user make sure to fallback to global registry



Modified: pcbsd/current/src-sh/pbreg/pbreg
===================================================================
--- pcbsd/current/src-sh/pbreg/pbreg	2012-04-30 18:42:16 UTC (rev 16602)
+++ pcbsd/current/src-sh/pbreg/pbreg	2012-04-30 20:36:55 UTC (rev 16603)
@@ -1,6 +1,8 @@
 #!/bin/sh
 # pbreg utility, allows us to set key / values via the CLI
 
+GLOBREGFILE="/var/db/pbreg/registry"
+
 # Set the pbreg settings dir
 if [ "`id -u`" = "0" ] ; then
    REGDIR="/var/db/pbreg" 
@@ -43,6 +45,16 @@
       echo -e "$VAR\c"
       exit 0
    fi
+
+   # If running as user check global reg
+   if [ "`id -u`" != "0" ] ; then
+     VAR=`grep "^${KEYVAL}=" $GLOBREGFILE | uniq | head -n 1 |cut -d '=' -f 2-100`
+     if [ -n "$VAR" ]; then
+        echo -e "$VAR\c"
+        exit 0
+     fi
+   fi
+
    exit 1
 }
 



More information about the Commits mailing list