Skip to content

Commit

Permalink
script/build-app generates a snap
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiojr committed Nov 10, 2019
1 parent 388184b commit aba9788
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
8 changes: 7 additions & 1 deletion script/build-app
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ fi
export BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd )"
export OS_NAME=$(node -e "console.log(os.platform())")
export OS_ARCH=$(node -e "console.log(os.arch())")
export ELECTRON_VERSION=${ELECTRON_VERSION:-1.8.2}
export ELECTRON_VERSION=${ELECTRON_VERSION:-7.1.1}

if [ "$OS_NAME" = "linux" ] && ! which snapcraft >/dev/null; then
echo "snapcraft not available!" >&2
echo "we need snapcrat to build the snap package" >&2
exit 1
fi

if [ ! -f $BASE_PATH/script/build-app-$OS_NAME ]; then
echo "$OS_NAME is not currently supported." >&2
Expand Down
21 changes: 20 additions & 1 deletion script/build-app-linux
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ cleanup_linux() {

trap cleanup_linux EXIT

nativefier -e $ELECTRON_VERSION --name Beehive http://localhost:8181 build/app
nativefier -e $ELECTRON_VERSION --icon $BASE_PATH/assets/logo.png --name Beehive http://localhost:8181 build/app

mkdir -p build/app
cp beehive build/app
chmod +x build/app/beehive
cat > build/app/beehive-linux-x64/beehive.wrapper << "EOF"
#!/bin/bash
export BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd )"
# Start the daemon
$BASE_PATH/beehive --config $SNAP_USER_DATA/beehive.conf &
bpid=$!
finish() {
[[ -z "$bpid" ]] || kill $bpid > /dev/null 2>&1
}
trap finish EXIT
# Start the GUI shell
$BASE_PATH/beehive-linux-x64/beehive
EOF
chmod +x build/app/beehive-linux-x64/beehive.wrapper
snapcraft
10 changes: 10 additions & 0 deletions snap/gui/beehive.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Name=Beehive
Comment=Beehive
Exec=beehive
Terminal=false
Type=Application
Icon=${SNAP}/meta/gui/icon.png
StartupWMClass=beehive
X-Desktop-File-Install-Version=0.24

Binary file added snap/gui/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: beehive # you probably want to 'snapcraft register <name>'
base: core18 # the base snap is the execution environment for this snap
version: '0.4' # just for humans, typically '1.2+git' or '1.3.2'
summary: A flexible event/agent & automation system with lots of bees 馃悵
description: |
Beehive is an event and agent system, which allows you to create your own
agents that perform automated tasks triggered by events and filters.
It is modular, flexible and really easy to extend for anyone. It has
modules (we call them Hives), so it can interface with, talk to, or retrieve
information from Twitter, Tumblr, Email, IRC, Jabber, RSS, Jenkins,
Hue - to name just a few.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
beehive:
command: bin/beehive
extensions: [gnome-3-28]
parts:
beehive:
plugin: dump
source: build/app
organize:
beehive-linux-x64/beehive.wrapper: bin/beehive
stage-packages:
- libx11-6
- libxcb-xtest0
- libx11-xcb1
- libnotify4
- libappindicator1
- libxtst6
- libnss3
- libxss1
- fontconfig-config
- gconf2
- libasound2
- pulseaudio

0 comments on commit aba9788

Please sign in to comment.