I'm trying to create a local repository and the process seems fairly 
straight-forward, but I'm missing something in the process. What I'm trying to 
do is download packages (with pkgrecv) and then add the files into a local 
repository. The http://localhost:10000 page works fine, but errors are reported 
when installing the packges. 

Here's a script I wrote:

#!/bin/bash
############################################
#  Setup repository and install the repository packages
############################################

# Just trying one iSCSI package for now
pkgs="sunwis...@0.5.11,5.11-0.111:20090508T161040Z"

rm -rf repository
mkdir repository
cd repository
for pkg in $(echo $pkgs); do
  pkgrecv -s http://pkg.opensolaris.org/release -k pkg:/$pkg
done
cd ..

rep=/tmp/repository
rm -rf $rep

# Create the repository
pkgsend -s file:$rep create-repository

# Configure repository
svccfg -s pkg/server setprop pkg/port = 10000
svccfg -s pkg/server setprop pkg/inst_root = $rep
svccfg -s pkg/server setprop pkg/readonly=false

# Check server properties
# svcprop pkg/server

# Enable the services
svcadm refresh pkg/server
svcadm restart pkg/server
svcadm enable pkg/server

# Set the publisher as preferred (-P) and enable (-e)
pkg set-publisher -Pe -O http://localhost:10000 localhost

# Disable opensolaris.org as a publisher
pkg set-publisher -d opensolaris.org

# Add to local repository
for pkg in $(echo $pkgs); do
  name=$(echo $pkg | awk -F\@ '{print $1}')
  eval $(pkgsend open $pkg)
  for file in $(find ./repository/$name); do
    if [ -d "$file" ]; then
      pkgsend add dir mode=0755 owner=root group=bin path=$(echo 
"${rep}/${name}")
    else
      pkgsend add file "$file" owner=root group=bin path=$(echo 
"${rep}/${name}")
    fi
  done
  pkgsend close
done

pkg refresh

# Install the packages
for pkg in $(echo $pkgs); do
  name=$(echo $pkg | awk -F\@ '{print $1}')
  pkg install $name
done


####### end of script ############

Here's the output:

PUBLISHED
pkg:/sunwis...@0.5.11,5.11-0.111:20100714T195237Z
Creating Plan \Traceback (most recent call last):
  File "/usr/bin/pkg", line 2598, in ?
    __ret = main_func()
  File "/usr/bin/pkg", line 2541, in main_func
    return install(mydir, pargs)
  File "/usr/bin/pkg", line 710, in install
    update_index=update_index)
  File "/usr/lib/python2.4/vendor-packages/pkg/client/api.py", line 178, in 
plan_install
    filters=filters, verbose=verbose)
  File "/usr/lib/python2.4/vendor-packages/pkg/client/image.py", line 2980, in 
make_install_plan
    ip.evaluate()
  File "/usr/lib/python2.4/vendor-packages/pkg/client/imageplan.py", line 438, 
in evaluate
    self.add_pkg_plan(f)
  File "/usr/lib/python2.4/vendor-packages/pkg/client/imageplan.py", line 358, 
in add_pkg_plan
    pp.evaluate(self.old_excludes, self.new_excludes)
  File "/usr/lib/python2.4/vendor-packages/pkg/client/pkgplan.py", line 142, in 
evaluate
    raise RuntimeError, ["Duplicate actions", ddups]
RuntimeError: ['Duplicate actions', [(('file', 'tmp/repository/SUNWiscsi'), 
set([<pkg.actions.file.FileAction object at 0x87e122c>, 
<pkg.actions.file.FileAction object at 0x87e1a6c>, <pkg.actions.file.FileAction 
object at 0x87e16ac>, <pkg.actions.file.FileAction object at 0x87e12ec>, 
<pkg.actions.file.FileAction object at 0x87e192c>, <pkg.actions.file.FileAction 
object at 0x87e1bac>, <pkg.actions.file.FileAction object at 0x87e142c>, 
<pkg.actions.file.FileAction object at 0x87e17ec>, <pkg.actions.file.FileAction 
object at 0x87e1cec>, <pkg.actions.file.FileAction object at 0x87e156c>, 
<pkg.actions.file.FileAction object at 0x87e1e2c>]))]]


pkg: This is an internal error.  Please let the developers know about this
problem by filing a bug at http://defect.opensolaris.org and including the
above traceback and this message.  The version of pkg(5) is '26c3e2407c53'.

###############

Don't know what I'm doing wrong. All the files seem to be in place in the 
repository.
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-help mailing list
opensolaris-help@opensolaris.org

Reply via email to