diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 84 | ||||
-rw-r--r-- | gingarage-0.0.1.tar.gz | bin | 0 -> 2349 bytes | |||
-rw-r--r-- | gingarage.install | 41 |
4 files changed, 141 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..4c3006e925a1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = gingarage + pkgdesc = Gin server to manage garage door + pkgver = 0.0.1 + pkgrel = 4 + url = https://github.com/Chipsterjulien/gingarage + install = gingarage.install + arch = any + license = WTFPL + makedepends = go + options = !strip + backup = etc/gincamalarm/gingarage.toml + source = gingarage-0.0.1.tar.gz + sha512sums = 4e219b7094d436ae63499f401a666205b73719f1c8504c10eacbe4cc487a43cbf4c49dbafda8274a5265b2f7d74a4cf5241ea83d1804b23f64cf2b89c92c5256 + +pkgname = gingarage + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..eaefce0abd5e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,84 @@ +# Maintainer: Chipster Julien <julien dot chipster @ archlinux dot fr> + +pkgname=gingarage +pkgver=0.0.1 +pkgrel=4 +pkgdesc="Gin server to manage garage door" +arch=('any') +url="https://github.com/Chipsterjulien/gingarage" +license=('WTFPL') +makedepends=('go') +options=('!strip') +backup=('etc/gincamalarm/gingarage.toml') +source=("$pkgname-$pkgver.tar.gz") +install=gingarage.install + +_builddir="$pkgname-$pkgver" + +build() { + echo "Build dependencies" + GOPATH_exist=1 + if [ -z $GOPATH ]; then + # path don't exit + GOPATH_exist=0 + + # create gopath directory + mkdir -p .gopath/{bin,src} + # export var + export GOPATH=~/.gopath + + # Getting some libs + echo "Install go-logging" + go get github.com/op/go-logging + echo "Install gin" + go get github.com/gin-gonic/gin + echo "Install viper" + go get github.com/spf13/viper + echo "Install gin-cors" + go get github.com/itsjamie/gin-cors + + else + + # Getting some libs + echo "Update go-logging" + go get github.com/op/go-logging + echo "Update gin" + go get github.com/gin-gonic/gin + echo "Update viper" + go get github.com/spf13/viper + echo "Update gin-cors" + go get github.com/itsjamie/gin-cors + + fi + echo "End of dependencies" + + cd "$_builddir" + + go build || return 1 + + if [ $GOPATH_exist == 0 ]; then + rm -rf ~/.gopath + export GOPATH= + fi +} + +package() { + cd "$_builddir" + + # gingarage.toml + install -Dm644 cfg/"$pkgname"_sample.toml \ + "$pkgdir"/etc/$pkgname/"$pkgname"_sample.toml || return 1 + + # Create log directory + install -dm755 "$pkgdir"/var/log/$pkgname || return 1 + + # gingarage.service + install -Dm644 systemd/"$pkgname".service \ + "$pkgdir"/usr/lib/systemd/system/"$pkgname".service || return 1 + + # gingarage binary + install -m755 -o root -g root -D "$srcdir"/$pkgname-$pkgver/$pkgname-$pkgver \ + "$pkgdir"/usr/bin/$pkgname || return 1 +} + +sha512sums=('4e219b7094d436ae63499f401a666205b73719f1c8504c10eacbe4cc487a43cbf4c49dbafda8274a5265b2f7d74a4cf5241ea83d1804b23f64cf2b89c92c5256') diff --git a/gingarage-0.0.1.tar.gz b/gingarage-0.0.1.tar.gz Binary files differnew file mode 100644 index 000000000000..86e13c91de93 --- /dev/null +++ b/gingarage-0.0.1.tar.gz diff --git a/gingarage.install b/gingarage.install new file mode 100644 index 000000000000..557590f22f57 --- /dev/null +++ b/gingarage.install @@ -0,0 +1,41 @@ +post_install() { + pkgname=gingarage + + # Fixing membership + chown root: /var/log/$pkgname + chown -R root: /etc/$pkgname + + # Reload systemctl + systemctl daemon-reload + + echo "Adding gincamalarm in systemctl:" + echo " systemctl enable gingarage" + echo " systemctl start gingarage" + + echo "Adding this rule in iptables:" + echo " iptables -t filter -A INPUT -p tcp --dport 8091 -j ACCEPT" + + true +} + +post_upgrade() { + # Reload systemctl + systemctl daemon-reload + + echo "You should restart gingarage" + echo " systemctl restart gingarage" + + true +} + +pre_remove() { + pkgname=gingarage + # Remove symlink in systemd + systemctl disable $pkgname + # Stop server + systemctl stop $pkgname + # Reload systemctl + systemctl daemon-reload + + true +}
\ No newline at end of file |