summaryrefslogtreecommitdiffstats
path: root/snap/snapcraft.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'snap/snapcraft.yaml')
-rw-r--r--snap/snapcraft.yaml105
1 files changed, 27 insertions, 78 deletions
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index b4441805bc..b60d720370 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -6,93 +6,55 @@ description: |
an independent binary distribution across ALL platforms that Go supports,
including Linux, Mac OS X, Windows and ARM.
-type: app
icon: public/img/gitea-lg.png
confinement: strict
-grade: stable
+base: core18
+adopt-info: gitea
-version: 'git'
+environment:
+ GITEA_CUSTOM: "$SNAP_COMMON"
+ GITEA_WORK_DIR: "$SNAP_DATA"
apps:
gitea:
- command: bin/gitea
+ command: gitea
plugs: [network, network-bind]
web:
- command: bin/gitea web
+ command: gitea web
daemon: simple
plugs: [network, network-bind]
- serv:
- command: bin/gitea serv
- plugs: [network, network-bind]
- admin:
- command: bin/gitea admin
- plugs: [network, network-bind]
- cert:
- command: bin/gitea cert
- hook:
- command: bin/gitea hook
- plugs: [network, network-bind]
dump:
- command: bin/gitea dump
+ command: gitea dump
plugs: [home]
- help:
- command: bin/gitea --help
version:
- command: bin/gitea --version
+ command: gitea --version
sqlite:
command: usr/bin/sqlite3
parts:
- go:
- source-tag: go1.8.3
- prime:
- - -*
gitea:
- plugin: nil
+ plugin: make
source: .
- source-type: git
- after: [ go ]
stage-packages: [ git, sqlite3, openssh-client ]
- build-packages: [ libpam0g-dev, libsqlite3-dev]
- prepare: |
- export PATH=$SNAPCRAFT_PART_INSTALL/../../go/install/bin:$PATH
- export GOPATH=$SNAPCRAFT_PART_INSTALL/../go
- export bld=$SNAPCRAFT_PART_INSTALL/../build
- export src=$SNAPCRAFT_PART_INSTALL/../src
- mkdir -p $GOPATH/src/code.gitea.io/gitea
- cp -r $src/* $GOPATH/src/code.gitea.io/gitea
- build: |
- export PATH=$SNAPCRAFT_PART_INSTALL/../go/bin/:$SNAPCRAFT_PART_INSTALL/../../go/install/bin:$PATH
- export GOPATH=$SNAPCRAFT_PART_INSTALL/../go
- cd $GOPATH/src/code.gitea.io/gitea
+ build-packages: [ git, libpam0g-dev, libsqlite3-dev]
+ build-snaps: [ go, node/14/stable ]
+ build-environment:
+ - LDFLAGS: ""
+ override-pull: |
+ snapcraftctl pull
+
+ version="$(git describe --always | sed -e 's/-/+git/;y/-/./')"
+ [ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
+ snapcraftctl set-version "$version"
+ snapcraftctl set-grade "$grade"
+
+ override-build: |
+ set -x
TAGS="bindata sqlite sqlite_unlock_notify pam cert" make build
- install: |
- # Set Convenience Variables
- src=$SNAPCRAFT_PART_INSTALL/../go/src/code.gitea.io/gitea
- giteaBase=$SNAPCRAFT_PART_INSTALL/gitea
- scurrent=/var/snap/$SNAPCRAFT_PROJECT_NAME/current
- scommon=/var/snap/$SNAPCRAFT_PROJECT_NAME/common
- # Copy build artifact and necessary files
- mkdir -p $giteaBase/conf
- # Workaround for gitea ignoring APP_DATA_PATH in app.ini after snap update.
- ln -s $scurrent/custom $giteaBase/custom
- ln -s $scommon/data $giteaBase/data
- # Workaround for cmd/certs not knowing how to put files somewhere else
- ln -s $scurrent/cert.pem $giteaBase/cert.pem
- ln -s $scurrent/key.pem $giteaBase/key.pem
- # Copy static content
- mkdir -p $SNAPCRAFT_PART_INSTALL/static
- cp $src/gitea $giteaBase/
- cp -r $src/LICENSE \
- $src/templates \
- $src/public \
- $src/scripts \
- $SNAPCRAFT_PART_INSTALL/static/
- cp -r $src/README.md \
- $src/LICENSE \
- $src/custom \
- $SNAPCRAFT_PART_INSTALL/
+ install -D gitea "${SNAPCRAFT_PART_INSTALL}/gitea"
+ cp -r options "${SNAPCRAFT_PART_INSTALL}/"
+
prime:
- -etc
- -usr/lib/systemd
@@ -101,20 +63,7 @@ parts:
- -usr/lib/x86_64-linux-gnu/krb5
- -usr/share/apport
- -usr/share/bash-completion
- - -usr/share/doc
- -usr/share/git-core/contrib
- -usr/share/man
- -usr/share/upstart
- -var
-
- helpers:
- plugin: dump
- source: snap/helpers
- organize:
- simple_launcher.sh: bin/gitea
- app.ini: gitea/snapApp.ini
- configuration.sh: bin/gconfig
- prime:
- - bin/gitea
- - bin/gconfig
- - gitea/snapApp.ini