Add scripts and configuration for building snap package (#25064)
Release Notes: - N/A --------- Co-authored-by: Soumyadeep Ghosh <soumyadeepghosh2004@zohomail.in>
This commit is contained in:
parent
2d1a028de5
commit
ea40c1d9b3
4 changed files with 111 additions and 0 deletions
27
script/snap-build
Executable file
27
script/snap-build
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <release_version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p snap/gui
|
||||
|
||||
export DO_STARTUP_NOTIFY="true"
|
||||
export APP_NAME="Zed"
|
||||
export APP_CLI="zed"
|
||||
export APP_ICON="\${SNAP}/meta/gui/zed.png"
|
||||
export APP_ARGS="%U"
|
||||
envsubst < "crates/zed/resources/zed.desktop.in" > "snap/gui/zed.desktop"
|
||||
cp "crates/zed/resources/app-icon.png" "snap/gui/zed.png"
|
||||
|
||||
RELEASE_VERSION="$1" envsubst < crates/zed/resources/snap/snapcraft.yaml.in > snap/snapcraft.yaml
|
||||
|
||||
# Clean seems to be needed to actually check that the snapcraft.yaml
|
||||
# works. For example, when a `stage-package` is removed, it will
|
||||
# still remain on rebuild.
|
||||
snapcraft clean
|
||||
|
||||
snapcraft
|
25
script/snap-try
Executable file
25
script/snap-try
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script is intended to be run after `snap-build`.
|
||||
#
|
||||
# It expects a version to be passed as the first argument, and expects
|
||||
# the built `.snap` for that version to be in the current directory.
|
||||
#
|
||||
# This will uninstall the current `zed` snap, replacing it with a snap
|
||||
# that directly uses the `snap/unpacked` directory.
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <release_version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Rerun as root
|
||||
[ "$UID" -eq 0 ] || exec sudo bash -e "$0" "$@"
|
||||
|
||||
snap remove zed || true
|
||||
mkdir -p snap
|
||||
rm -rf snap/unpacked
|
||||
unsquashfs -dest snap/unpacked "zed_$1_amd64.snap"
|
||||
snap try --classic snap/unpacked
|
Loading…
Add table
Add a link
Reference in a new issue