Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/src/svc/svc-pkg-depot
          +++ new/src/svc/svc-pkg-depot
↓ open down ↓ 47 lines elided ↑ open up ↑
  48   48          # via a long option flag which takes an argument.
  49   49          long_option_props="cfg_file content_root debug log_access log_errors \
  50   50              proxy_base ssl_cert_file ssl_dialog ssl_key_file writable_root"
  51   51          set -A long_option_cmd_line "cfg-file" "content-root" "debug" \
  52   52              "log-access" "log-errors" "proxy-base" "ssl-cert-file" \
  53   53              "ssl-dialog" "ssl-key-file" "writable-root"
  54   54  
  55   55          bool_ops=""
  56   56          option_props=""
  57   57  
       58 +        # retrieve the pkg_env property. If the variable is left empty
       59 +        # pkg_env is /
       60 +        pkg_env=$(svcprop -p pkg/pkg_env $SMF_FMRI)
       61 +        if [[ $? -ne 0 ]]; then
       62 +                echo "service property pkg/pkg_env not defined for" \
       63 +                    "service: $SMF_FMRI"
       64 +                exit $SMF_EXIT_ERR_CONFIG
       65 +        fi
       66 +        
       67 +        # adjust the PYTHONPATH to point to the current environment     
       68 +        PYTHONPATH=${pkg_env}/usr/lib/python2.4/vendor-packages/:$PYTHONPATH
       69 +        export PYTHONPATH
       70 +
  58   71          # Go through each property in boolean_props and, if its value is set
  59   72          # to true in SMF, add the appropriate command line flag to the string.
  60   73          cnt=0
  61   74          for b in $boolean_props; do
  62   75                  val=$(svcprop -p pkg/$b $SMF_FMRI)
  63   76                  if [[ $? -ne 0 ]]; then
  64   77                          echo "service property pkg/$b not defined for" \
  65   78                              "service: $SMF_FMRI"
  66   79                          exit $SMF_EXIT_ERR_CONFIG
  67   80                  fi
↓ open down ↓ 82 lines elided ↑ open up ↑
 150  163                  echo "Dropping net_privaddr privilege."
 151  164                  privaddr=",net_privaddr"
 152  165          fi
 153  166          #
 154  167          # We build up the privileges available starting with "basic".
 155  168          # This provides some protection even when the depot runs as root.
 156  169          #
 157  170          wrapper="ppriv -s A=basic,-file_link_any,-proc_info,-proc_session$privaddr$forkexec -e"
 158  171  
 159  172          # Build the command to start pkg.depotd with the specified options.
 160      -        cmd="$wrapper /usr/lib/pkg.depotd $bool_ops $option_ops"
      173 +        cmd="$wrapper ${pkg_env}/usr/lib/pkg.depotd $bool_ops $option_ops"
 161  174          # Echo the command so that the log contains the command used to start
 162  175          # the depot.
 163  176          echo $cmd
 164  177  
 165  178          exec $cmd
 166  179  
 167  180          ;;
 168  181  
 169  182  'stop')
 170  183          #
↓ open down ↓ 49 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX