Skip to content

Instantly share code, notes, and snippets.

@NickZ
Last active February 29, 2020 20:33
Show Gist options
  • Save NickZ/cae264101a1e2f62356e3363699fde48 to your computer and use it in GitHub Desktop.
Save NickZ/cae264101a1e2f62356e3363699fde48 to your computer and use it in GitHub Desktop.

Requirements:

Instructions:

  1. Install the above.
  2. edit your PATH variable to include the following:
%USERPROFILE%\AppData\Local\Programs\Python\Python37
%USERPROFILE%\AppData\Local\Programs\Python\Python37\Scripts

Make sure that they are at the top of the list or it will not work with the command line (it will just prompt you to install the windows store version, which we don't want.)

  1. Clone snapcraft repository and checkout master: https://github.com/snapcraft/snapcraft
  2. run the following in the command line at the repo:
pip install -r requirements.txt
pip install -e .
  1. Launch a multipass instance with the following command:
multipass launch -d10G -m2G -c4 -nsnapcraft-subtitle-edit 18.04
  1. multipass shell snapcraft-subtitle-edit

  2. sudo su and create the following files with nano: (creates files that are present on snapcraft builder)

/root/.bashrc:

export SNAPCRAFT_BUILD_ENVIRONMENT=managed-host
export PS1="\h \$(/bin/_snapcraft_prompt)# "
export PATH=/snap/bin:$PATH

/bin/_snapcraft_prompt:

#!/bin/bash
if [[ "$PWD" =~ ^$HOME.* ]]; then
    path="${PWD/#$HOME/\ ..}"
    if [[ "$path" == " .." ]]; then
        ps1=""
    else
        ps1="$path"
    fi
else
    ps1="$PWD"
fi
echo -n $ps1

Then run chmod a+x /bin/_snapcraft_prompt Then exit out

  1. Clone my subtitle-edit-snap repository to test: https://github.com/NickZ/subtitle-edit-snap.git

9: Run snapcraft in the directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment