Skip to content

Instantly share code, notes, and snippets.

View popey's full-sized avatar
🏠
Working from home

Alan Pope popey

🏠
Working from home
View GitHub Profile
### Keybase proof
I hereby claim:
* I am popey on github.
* I am popey (https://keybase.io/popey) on keybase.
* I have a public key whose fingerprint is 66E8 F9EB B1A7 A510 0BC0 27F4 1E38 DD62 57A4 363C
To claim this, I am signing this object:
@popey
popey / Google Code-In 2018 Package Electron - sample PR text.md
Last active January 8, 2018 15:00
Package an Electron application as a snap - sample PR text

I've put together this pull request to add a snap package. I've tested it on Ubuntu 16.04, but it should work just as well on Ubuntu 14.04, Linux Mint, Manjaro, Debian, OpenSUSE, Solus, etc.

If you merge and npm COMMAND on an Ubuntu 16.04 VM with an appropriate version of node installed it will create dist/NAME_VERSION_amd64.snap.

Copy this to a Linux system, enable snap support, then run: sudo snap install --dangerous NAME_VERSION_amd64.snap. Execute it with NAME from the terminal or find it in the desktop launcher.

If you create a developer account and push this to the Snap Store, it can be discovered and installed through GNOME Software and https://snapcraft.io/discover. To create the developer account, sign up here, then register the "NAME" name.

You'll need the snapcraft comm

@popey
popey / lddtostage
Created December 14, 2017 18:45
Turn the output of ldd into something you can put in a snapcraft.yaml stage-packages section
#!/bin/bash
#
# lddtostage
#
# usage:
# lddtostage somebinary
#
# This will run through each linked library and figure out which deb
# it came from and print the list for pasting into a snapcraft.yaml
# in a 'stage-packages' section.
@popey
popey / build-snap.sh
Created October 30, 2018 14:01
Script to automate cleanup and build of snap
#!/bin/bash
# Script to clean up and rebuild a snap locally
# Name of the snap as seen in the store
export snapname="SNAPNAME"
# If the command we run is namespaced, optionally add it here
#export commandname=".COMMANDNAME"
# If there are interfaces defined to connect, optionally list them here
@popey
popey / build_electron_snap.sh
Last active November 2, 2018 13:57
Script to build an electron based app in lxd
#!/bin/bash
# Override that with the tag
# build-snap v1.16.2 # build specific tag
# Override with latest
# build-snap master # build git master
# Override with most recent release
# build-snap release # build latest stable release
# Set these variables
# Lower case name as it would appear in the store
@popey
popey / do_snapcraft_notes.md
Created January 7, 2019 16:05
Setup Digitial Ocean droplets for class
@popey
popey / snapcraft.yaml
Created February 6, 2019 21:55
GeekBench snapcraft.yaml used during Snapcraft Live stream on 6th Feb 2019
name: geekbench
base: core18 # the base snap is the execution environment for this snap
version: '4.3.3' # just for humans, typically '1.2+git' or '1.3.2'
summary: GeekBench
description: |
Geekbench 4 measures your system's power and tells you whether your computer
is ready to roar.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
@popey
popey / rebuildsnaps.sh
Created July 25, 2019 11:01
Script to rebuild a bunch of snaps using lxd or multipass
#!/bin/bash -x
DATESTAMP="$(date +%Y%m%d)-$(date +%H%M%S)"
SNAPCRAFT_CHANNEL="--candidate"
GHUSER=snapcrafters
LXDIMAGE="ubuntu:16.04"
TEMPDIR=$(pwd)/build-$DATESTAMP
RESULTSDIR="$TEMPDIR"/results
REPORT=$RESULTSDIR/report
mkdir -p $TEMPDIR/results
@popey
popey / lddtostage
Last active October 31, 2019 23:58
Determine libraries needed by a binary and output in format for snapcraft.yaml
#!/bin/bash
TMPDIR=$(mktemp -d)
LDD=$TMPDIR/LDD
PACKAGES=$TMPDIR/PACKAGES
ldd $1 | awk -F ' ' '{print $3}' | sed '/^$/d' | sed '/^(/d' | grep -v '^not' > $LDD
while read p; do
echo -n .
@popey
popey / test_snaps.sh
Last active October 7, 2020 08:37
Script to somewhat automate testing of snaps
#!/bin/bash
# Script to automate setup, install of snaps and running.
# Script will do the following:-
# - Make sure we're in an X11 session (wayland not supported)
# - Install snapd and scrot (for taking screenshots) using whatever package manager
# - Determine distribution being run on, for logging and screenshot naming
# - Double check snapd is installed and works, and switch to the beta channel
# - Install a configurable list of snaps
# - Take a reference screenshot (of the file manager) for theme comparison
# - Launch each snap in turn