diff --git a/README.md b/README.md index e86c2c2d..0e27cd7d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- Project + Project
[Project]

@@ -15,12 +15,12 @@ distributions.

## Install - sudo snap install my-snap-name + sudo snap install --channel=edge --devmode my-snap-name ([Don't have snapd installed?](https://snapcraft.io/docs/core/install))

Published for with :gift_heart: by Snapcrafters

diff --git a/snap/README.markdown b/snap/README.markdown new file mode 100644 index 00000000..de553508 --- /dev/null +++ b/snap/README.markdown @@ -0,0 +1,5 @@ +# /snap + +[Snaps are universal Linux packages](https://snapcraft.io/). Snaps are containerised software packages that are simple to create and install on all major Linux systems without modification. + +Here are the files used for snap packaging, refer [snaps and snapcraft documentation](https://docs.snapcraft.io/) for more info. \ No newline at end of file diff --git a/snap/gui/README.markdown b/snap/gui/README.markdown new file mode 100644 index 00000000..58fd2287 --- /dev/null +++ b/snap/gui/README.markdown @@ -0,0 +1,5 @@ + # /snap/gui + +Copy the snapped application's icon here and specify it in snapcraft.yaml file using the `icon` keyword. This folder is not necessary if the icon is already existed in the source tree. + +NOTE: The Snap Store requires SVG scalable image or PNG image with at least 256x256px in size. \ No newline at end of file diff --git a/snap/gui/icon.png b/snap/gui/icon.png new file mode 100644 index 00000000..8eb1e57b Binary files /dev/null and b/snap/gui/icon.png differ diff --git a/snap/patches/README.markdown b/snap/patches/README.markdown new file mode 100644 index 00000000..dd6dbd46 --- /dev/null +++ b/snap/patches/README.markdown @@ -0,0 +1,3 @@ +# /snap/patches + +Here are the patches that are required to build a snap package that functions correctly. \ No newline at end of file diff --git a/snap/patches/patch-desktop-entries.sed b/snap/patches/patch-desktop-entries.sed new file mode 100644 index 00000000..bc28ead5 --- /dev/null +++ b/snap/patches/patch-desktop-entries.sed @@ -0,0 +1,28 @@ +# This sed script patches the desktop entries of the snapped +# application. +# +# Documentation: +# +# * GNU Sed Manual +# https://www.gnu.org/software/sed/manual +# * `sed` script overview - `sed` scripts +# * `sed` commands summary - `sed` scripts +# * The `s` Command - `sed` scripts +# * Overview of basic regular expression syntax - Regular +# Expressions: selecting text +# * Back-references and Subexpressions - Regular Expressions: +# selecting text + +## Append '(Snappy Edition)' to the application name to make it +## distinguishable with the other same application using different +## software distribution technologies +## +## FIXME: The appended string is not localizable, the proper way to +## implement this is to probably use a new X-Snappy-Name keys +## with localestring format to let the translators fill in +## additional localized string and use these values to replace +## the Name keys here. +s/^\(Name\(\[.\+\]\)\?=.*\)$/\1 (Snappy Edition)/g + +## Fix-up application icon lookup +s|^Icon=.*|Icon=\${SNAP}/meta/gui/icon.svg| diff --git a/snap/screenshots/README.markdown b/snap/screenshots/README.markdown new file mode 100644 index 00000000..92ab2fcf --- /dev/null +++ b/snap/screenshots/README.markdown @@ -0,0 +1,3 @@ +# Screenshots + +The screenshots of the snapped application. This is not currently synced to the product page on the Snap Store and should be uploaded by yourself. \ No newline at end of file diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 0527b799..5c744a0a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -8,8 +8,63 @@ description: | store. confinement: devmode # use 'strict' once you have the right plugs and slots +grade: devel +icon: snap/gui/icon.png + +apps: + my-app: + command: my-app + desktop: share/applications/my-app.desktop + #plugs: + #- desktop + #- desktop-legacy + #- x11 + #- unity7 + + #slots: parts: - my-part: + # Patches to fix other parts + patches: + source: snap/patches + source-type: local + plugin: dump + + # DISABLED: Bug #1775582 “`organize:{ /: another-dir/ }` causes the items under host root directory to be copied in another-dir” : Bugs : Snapcraft + # https://forum.snapcraft.io/t/organize-another-dir-causes-the-items-under-host-root-directory-to-be-copied-in-another-dir/5806 + #organize: + #/: patches/ + override-build: | + set -eu + + snapcraftctl build + + mkdir \ + --parents \ + "$SNAPCRAFT_PART_INSTALL"/patches + mv \ + "$SNAPCRAFT_PART_INSTALL"/*.diff \ + "$SNAPCRAFT_PART_INSTALL"/*.patch \ + "$SNAPCRAFT_PART_INSTALL"/*.sed \ + "$SNAPCRAFT_PART_INSTALL"/patches \ + || true # Empty patches folder is allowed + stage: + - patches/* + override-prime: 'true' + + my-app: + after: + - patches + # See 'snapcraft plugins' plugin: nil + + override-stage: | + set -eu + + snapcraftctl stage + + sed \ + --file "${SNAPCRAFT_STAGE}"/patches/patch-desktop-entries.sed \ + --in-place \ + "${SNAPCRAFT_STAGE}"/share/applications/*.desktop