diff options
author | Zygmunt Krynicki | 2016-06-14 11:11:21 +0200 |
---|---|---|
committer | Zygmunt Krynicki | 2016-06-14 11:11:21 +0200 |
commit | d2f5486adf290dd67977b9f2443fa898bf405525 (patch) | |
tree | e710241885900547a74df0c37f6624d4a015955b | |
download | aur-d2f5486adf290dd67977b9f2443fa898bf405525.tar.gz |
Initial import
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 85 | ||||
-rw-r--r-- | snapd.install | 58 | ||||
-rw-r--r-- | snapd.sh | 10 |
5 files changed, 179 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..45246159ccdd --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,25 @@ +pkgbase = snapd + pkgdesc = Service and tools for management of snap packages. + pkgver = 2.0.8 + pkgrel = 1 + url = git://github.com/snapcore/snapd + install = snapd.install + arch = i686 + arch = x86_64 + license = GPL3 + makedepends = git + makedepends = go + makedepends = go-tools + makedepends = bzr + depends = glibc + depends = snap-confine + depends = squashfs-tools + options = !strip + options = !emptydirs + source = https://github.com/snapcore/snapd/archive/2.0.8.tar.gz + source = snapd.sh + md5sums = SKIP + md5sums = 1d841a1d09ba86945551dfc5c5658b2e + +pkgname = snapd + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..72e8ffc0db8a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +* diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..10e0cfca8454 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,85 @@ +# Maintainer: Zygmunt Krynicki <me at zygoon dot pl> +pkgname=snapd +pkgver=2.0.8 +pkgrel=1 +pkgdesc="Service and tools for management of snap packages." +arch=('i686' 'x86_64') +url="git://github.com/snapcore/snapd" +license=('GPL3') +groups=() +depends=('glibc' 'snap-confine' 'squashfs-tools') +makedepends=('git' 'go' 'go-tools' 'bzr') +provides=() +conflicts=() +replaces=() +backup=() +options=('!strip' '!emptydirs') +install=snapd.install +source=("https://github.com/snapcore/$pkgname/archive/$pkgver.tar.gz" + 'snapd.sh') +noextract=() +md5sums=('SKIP' + '1d841a1d09ba86945551dfc5c5658b2e') + +_gourl=github.com/snapcore/snapd + +prepare() { + # Use $srcdir/go as our GOPATH + export GOPATH="$srcdir/go" + mkdir -p "$GOPATH" + # Have snapd checkout appear in a place suitable for subsequent GOPATH This + # way we don't have to go get it again and it is exactly what the tag/hash + # above describes. + mkdir -p "$(dirname "$GOPATH/src/${_gourl}")" + ln --no-target-directory -fs "$srcdir/$pkgname-$pkgver" "$GOPATH/src/${_gourl}" +} + +build() { + export GOPATH="$srcdir/go" + # Use get-deps.sh provided by upstream to fetch go dependencies using the + # godeps tool and dependencies.tsv (maintained upstream). + ( cd "$GOPATH/src/${_gourl}" && ./get-deps.sh ) + # Build/install snap and snapd + go install "${_gourl}/cmd/snap" + go install "${_gourl}/cmd/snapd" + cd "$pkgname-$pkgver" +} + +check() { + export GOPATH="$srcdir/go" + cd "$GOPATH/src/${_gourl}" + # FIXME: re-enable this after upstream behaves correctly in absence of .git + # ./run-checks --unit + # FIXME: this seems to break on C.UTF-8 locale + # ./run-checks --static +} + +package() { + export GOPATH="$srcdir/go" + # Ensure that we have /var/lib/snapd/{hostfs,lib/gl}/ as they are required by snap-confine + # for constructing some bind mounts around. + install -d -m 755 "$pkgdir/var/lib/snapd/hostfs/" + touch "$pkgdir/var/lib/snapd/hostfs/.keep" + install -d -m 755 "$pkgdir/var/lib/snapd/lib/gl/" + touch "$pkgdir/var/lib/snapd/lib/gl/.keep" + # Install the refresh timer and service for updating snaps + install -d -m 755 "$pkgdir/usr/lib/systemd/system/" + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.refresh.service" "$pkgdir/usr/lib/systemd/system" + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.refresh.timer" "$pkgdir/usr/lib/systemd/system" + # Install the snapd socket and service for the main daemon + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.service" "$pkgdir/usr/lib/systemd/system" + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.socket" "$pkgdir/usr/lib/systemd/system" + # Install legacy "frameworks" units + # TODO: drop those when they go away upstream + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.frameworks-pre.target" "$pkgdir/usr/lib/systemd/system" + install -m 644 "$GOPATH/src/${_gourl}/debian/snapd.frameworks.target" "$pkgdir/usr/lib/systemd/system" + # Install snap and snapd executables + install -d -m 755 "$pkgdir/usr/bin/" + install -m 755 "$GOPATH/bin/snap" "$pkgdir/usr/bin/" + install -d -m 755 "$pkgdir/usr/lib/snapd" + install -m 755 "$GOPATH/bin/snapd" "$pkgdir/usr/lib/snapd/" + # Install the license + install -Dm 755 "$GOPATH/src/${_gourl}/COPYING" "$pkgdir/usr/share/licenses/${pkgname%-git}/COPYING" + # Install script to export binaries paths of snaps + install -Dm 755 "$srcdir/snapd.sh" "$pkgdir/etc/profile.d/apps-bin-path.sh" +} diff --git a/snapd.install b/snapd.install new file mode 100644 index 000000000000..13b2b2b87bda --- /dev/null +++ b/snapd.install @@ -0,0 +1,58 @@ +## arg 1: the new package version +pre_install() { + : +} + +## arg 1: the new package version +post_install() { + # We start and enable snapd.socket so it immediately is usable and the + # service is started on-demand on future boots. The timer is started so + # that snaps are automatically refreshed (updated) as new versions are + # published in the store. + systemctl enable snapd.refresh.timer + systemctl enable snapd.socket + systemctl start snapd.refresh.timer + systemctl start snapd.socket +} + +## arg 1: the new package version +## arg 2: the old package version +pre_upgrade() { + : +} + +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + : +} + +## arg 1: the old package version +pre_remove() { + # We stop the socket and disable it to remove the symlink that would start + # it at boot. + systemctl stop snapd.socket + systemctl disable snapd.socket + systemctl stop snapd.refresh.timer + systemctl disable snapd.refresh.timer +} + +## arg 1: the old package version +post_remove() { + # We clean up all the snap mounts created by snappy + find /etc/systemd/system -name "snap-*.mount" -delete + find /etc/systemd/system -name "snap*.service" -delete + + # As well as their symlinks from the multi-user target + find /etc/systemd/system/multi-user.target.wants -name "snap-*.mount" -delete + find /etc/systemd/system/multi-user.target.wants -name "snap*.service" -delete + + # We unmount all currently mounted snaps + if [ -n "$(mount | grep snap | awk '{print $3}')" ]; then + umount $(mount | grep snap | awk '{print $3}') + fi + + # We remove the /snap directory as well as state of snappy and its snap cache + rm -rf /snap + rm -rf /var/lib/snapd +} diff --git a/snapd.sh b/snapd.sh new file mode 100644 index 000000000000..76580b6c56ba --- /dev/null +++ b/snapd.sh @@ -0,0 +1,10 @@ +# Expand the $PATH to include /snaps/bin which is what snappy applications +# use +PATH=$PATH:/snap/bin + +if [ -z "$XDG_DATA_DIRS" ]; then + XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/var/lib/snapd/desktop +else + XDG_DATA_DIRS="$XDG_DATA_DIRS":/var/lib/snapd/desktop +fi +export XDG_DATA_DIRS |