summarylogtreecommitdiffstats
diff options
context:
space:
mode:
author@RubenKelevra2020-06-13 08:06:06 +0200
committer@RubenKelevra2020-06-13 08:06:06 +0200
commit96e6253e6c7b1b87189bc0b275bb8171031fe5c7 (patch)
tree2feb805fed833c5cd80e6917311d7697a70b1d70
parent7530fe20f1827d4df58c82f472788a9474276b76 (diff)
downloadaur-96e6253e6c7b1b87189bc0b275bb8171031fe5c7.tar.gz
move ipfs folder, move init process to install file, build without fuse support
-rw-r--r--.SRCINFO1
-rw-r--r--PKGBUILD23
-rw-r--r--go-ipfs-git.install32
3 files changed, 50 insertions, 6 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6652a2adb8a4..bf5d1309953c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -3,6 +3,7 @@ pkgbase = go-ipfs-git
pkgver = 0.6.0rc6.r56.g10623a702
pkgrel = 1
url = https://github.com/ipfs/go-ipfs
+ install = go-ipfs-git.install
arch = i686
arch = x86_64
arch = armv7h
diff --git a/PKGBUILD b/PKGBUILD
index d1af7e91c4c6..893c58c1fec8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -17,6 +17,7 @@ optdepends=('fuse2: for mounting/advanced use'
'bash-completion: bash completion support')
provides=("$_pkgname")
conflicts=("$_pkgname")
+install="$pkgname.install"
source=("git+${url}.git")
b2sums=('SKIP')
@@ -31,7 +32,6 @@ prepare() {
go get -d -v ./...
}
-
pkgver() {
cd "$srcdir/$_pkgname"
#VERSION=$(grep -E "^const CurrentVersionNumber = " version.go | awk '{ print $4 }' | sed 's/"//g')
@@ -50,7 +50,7 @@ build() {
export CGO_CFLAGS="${CFLAGS}"
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
- make GOFLAGS="-buildmode=pie -trimpath -modcacherw" build
+ make GOFLAGS="-buildmode=pie -trimpath -modcacherw" nofuse
}
package() {
@@ -58,16 +58,27 @@ package() {
install -Dm 755 cmd/ipfs/ipfs "$pkgdir/usr/bin/ipfs"
install -Dm 644 misc/systemd/ipfs-api.socket "$pkgdir/usr/lib/systemd/system/ipfs-api.socket"
install -Dm 644 misc/systemd/ipfs-gateway.socket "$pkgdir/usr/lib/systemd/system/ipfs-gateway.socket"
+ # use the hardened service file
install -Dm 644 misc/systemd/ipfs-hardened.service "$pkgdir/usr/lib/systemd/system/ipfs.service"
- #avoid migrations on bootup (see #7269) and enable gc and pubsub by default (sane defaults)
- sed -i 's/--migrate/--enable-gc --enable-pubsub-experiment --enable-namesys-pubsub/g' "$pkgdir/usr/lib/systemd/system/ipfs.service"
- #increase timeouts (see #7283)
+
+ ### Patch service file ###
+
+ # set IPFS_PATH if not set by upstream already
+ sed -i '/StateDirectory=ipfs/,/ExecStart=\/usr\/bin\/ipfs daemon --init --migrate/c StateDirectory=ipfs\nEnvironment=IPFS_PATH=\~\nExecStart=\/usr\/bin\/ipfs daemon --init --migrate' "$pkgdir/usr/lib/systemd/system/ipfs.service"
+ # remove --init (handled by install file) and avoid migrations on bootup (see #7269)
+ sed -i 's/ExecStart=\/usr\/bin\/ipfs daemon --init --migrate/ExecStart=\/usr\/bin\/ipfs daemon/g' "$pkgdir/usr/lib/systemd/system/ipfs.service"
+ # enable gc and pubsub by default (sane defaults)
+ sed -i 's/ExecStart=\/usr\/bin\/ipfs daemon/ExecStart=\/usr\/bin\/ipfs daemon --enable-gc --enable-pubsub-experiment --enable-namesys-pubsub/g' "$pkgdir/usr/lib/systemd/system/ipfs.service"
+ # increase timeouts (see #7283)
sed -i 's/MemorySwapMax=0/MemorySwapMax=0\n\nTimeoutStartSec=15min\nTimeoutStopSec=15min\nTimeoutAbortSec=15min/' "$pkgdir/usr/lib/systemd/system/ipfs.service"
- # systemd-sysusers
+
+
+
install -Dm 644 "misc/systemd/ipfs-sysusers.conf" "${pkgdir}/usr/lib/sysusers.d/ipfs.conf"
install -Dm 644 misc/completion/ipfs-completion.bash "$pkgdir/usr/share/bash-completion/completions/ipfs"
install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/MIT" LICENSE-MIT
install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/APACHE" LICENSE-APACHE
install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
+ # make sure the gopath is writeable
chmod u+w -R "$GOPATH"
}
diff --git a/go-ipfs-git.install b/go-ipfs-git.install
new file mode 100644
index 000000000000..6ab20aef092c
--- /dev/null
+++ b/go-ipfs-git.install
@@ -0,0 +1,32 @@
+post_upgrade() {
+
+ ## search for old location of ipfs data and move data
+
+ if [ -f '/var/lib/ipfs/.ipfs/config' ]; then
+ echo ":: ipfs upgrade: stopping ipfs.service if running..."
+ systemctl stop ipfs >/dev/null 2>&1 || true
+ echo ":: ipfs upgrade: moving existing ipfs data from '/var/lib/ipfs/.ipfs' to '/var/lib/ipfs/'..."
+ mv /var/lib/ipfs/.ipfs/* /var/lib/ipfs/ >/dev/null 2>&1 || true
+ rmdir /var/lib/ipfs/.ipfs/ >/dev/null 2>&1 || true
+ fi
+
+ # in case the daemon was never started, generate a configuration
+
+ if [ ! -f /var/lib/ipfs/config ]; then
+ systemctl restart systemd-sysusers.service
+
+ mkdir -p /var/lib/ipfs/
+
+ chown ipfs: -R /var/lib/ipfs/
+
+ su ipfs -s /bin/bash -c "export IPFS_PATH='/var/lib/ipfs/'; ipfs init"
+
+ fi
+}
+
+post_install() {
+
+ # do every check an upgrade would do
+
+ post_upgrade
+}