Skip to content

Commit

Permalink
snapcraft: set PATH/PYTHON/PYTHONPATH _ORIG
Browse files Browse the repository at this point in the history
Ensure subiquity-server and ubuntu-desktop-bootstrap apps have
PATH_ORIG, PYTHON_ORIG, and PYTHONPATH_ORIG environment variables.
Lacking these causes usage of subiquity's system_scripts to fail to find
the python outside of the snap. This will result in blocking installs
since suiquity relies on cloud-init scripts to validate user data.

A special note on PATH_ORIG: For some unknown reason - potentially a
snapcraft bug - when setting environment variables in the subiquity-server
environment, the PATH variable has already been modified to include
paths with a SNAP prefix. This means we can't set PATH_ORIG to PATH
like we do in subiquity. Instead we use the documented default of PATH
for classic confinement snaps in [0] as the value for PATH_ORIG to ensure
we get only paths to outside of the snap.

[0] https://snapcraft.io/docs/environment-variables#heading--path
  • Loading branch information
Chris-Peterson444 committed Sep 28, 2024
1 parent 173328d commit d8427dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ apps:
environment:
APPORT_DATA_DIR_ORIG: $APPORT_DATA_DIR
APPORT_DATA_DIR: $SNAP/usr/share/apport
PATH_ORIG: $PATH
PATH_ORIG: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PYTHON_ORIG: $PYTHON
PYTHONPATH_ORIG: $PYTHONPATH

subiquity-loadkeys:
Expand All @@ -34,7 +35,10 @@ apps:
environment:
APPORT_DATA_DIR_ORIG: $APPORT_DATA_DIR
APPORT_DATA_DIR: $SNAP/usr/share/apport
PATH_ORIG: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
PATH: $SNAP/usr/bin:$SNAP/bin:$PATH
PYTHON_ORIG: $PYTHON
PYTHONPATH_ORIG: $PYTHONPATH
LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/dri
GIO_MODULE_DIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/gio/modules
LIVE_RUN: 1
Expand Down

0 comments on commit d8427dd

Please sign in to comment.