Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should be able to run pkg(1) from a backup boot environment without editing it #506

Open
jclulow opened this issue Dec 17, 2024 · 2 comments

Comments

@jclulow
Copy link
Contributor

jclulow commented Dec 17, 2024

While working around omniosorg/omnios-build#3770, I mounted the backup boot environment created as part of pkg update -v pkg so that I could get the previous copy of the libraries there. In order to convince it to work, I ended up having to copy the pkg entrypoint script itself into /tmp and edit it:

  • I had to comment out the call to pkg.site_paths.init()
  • I had to remove the -E argument in the interpreter line

Once I did that, I was able to set PYTHONPATH in the environment and use the program:

gerrit0 # PYTHONPATH=/tmp/tmp.FjayTS/usr/lib/pkg/python3.11:/tmp/tmp.FjayTS/usr/lib/python3.11:/tmp/tmp.FjayTS/usr/lib/python3.11/lib-dynload /tmp/pkg list -v expat
FMRI                                                                         IFO
pkg://omnios/library/[email protected]:20230428T103651Z                   i--

It seems like it would be relatively easy to augment the site_paths module to be able to recognise when it's running inside a boot environment and enable the operator to use it without modification?

@citrus-it
Copy link
Member

citrus-it commented Dec 17, 2024

Generally I use this, which works, but we should be able to make this easier - perhaps even having a flag in pkg that helps.

BEROOT=/tmp/tmp.FjayTS
LD_LIBRARY_PATH=$BEROOT/usr/lib/amd64 \
    PYTHONPATH=$BEROOT/usr/lib/pkg/python3.11:$BEROOT/usr/lib/python3.11/vendor-packages \
    $BEROOT/usr/bin/python3.11 $BEROOT/usr/bin/pkg list -u

@jclulow
Copy link
Contributor Author

jclulow commented Dec 17, 2024

Ah, that's clever (using python3.11 directly)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants