From e6dd21be6e016461ed691af1da14d3a76229c23a Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Fri, 4 Oct 2019 00:51:56 +0100 Subject: [PATCH] Move PATH setup from agetty service into subiquity itself This way `sudo snap run subiquity` will have the correct PATH for probert/utils/curtin, as needed when running subiquity from ssh session. --- bin/subiquity-service | 1 - subiquity/cmd/tui.py | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/subiquity-service b/bin/subiquity-service index 12182fca..d3cb3827 100755 --- a/bin/subiquity-service +++ b/bin/subiquity-service @@ -4,7 +4,6 @@ if [ -n "$1" ]; then port=$1 fi /bin/dmesg -n 1 -export PATH=$SNAP/bin:$SNAP/usr/bin:$PATH if [ "$port" = "tty1" ]; then $SNAP/usr/bin/subiquity-loadkeys setfont $SNAP/subiquity.psf diff --git a/subiquity/cmd/tui.py b/subiquity/cmd/tui.py index 661665db..01675f05 100755 --- a/subiquity/cmd/tui.py +++ b/subiquity/cmd/tui.py @@ -84,6 +84,14 @@ AUTO_ANSWERS_FILE = "/subiquity_config/answers.yaml" def main(): + # Preffer utils from $SNAP, over system-wide + snap = os.environ.get('SNAP') + if snap: + os.environ['PATH'] = os.pathsep.join([ + os.path.join(snap, 'bin'), + os.path.join(snap, 'usr', 'bin'), + os.environ['PATH'], + ]) opts = parse_options(sys.argv[1:]) global LOGDIR if opts.dry_run: