summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Freyermuth2016-08-01 23:00:24 +0200
committerJulien Freyermuth2016-08-01 23:00:24 +0200
commit128013b14b2e1573d02a0f6ef16c9973e77a72be (patch)
treeaffe03c2e19f6d52f5645d2fd7860b8e8e26c836
downloadaur-128013b14b2e1573d02a0f6ef16c9973e77a72be.tar.gz
First commit
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD84
-rw-r--r--pingormail-0.0.1.tar.gzbin0 -> 5172 bytes
-rw-r--r--pingormail.install38
4 files changed, 140 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..cf15c16ea715
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+# Generated by mksrcinfo v8
+# lun. août 1 21:00:12 UTC 2016
+pkgbase = pingormail
+ pkgdesc = Ping address. If no result, send mail
+ pkgver = 0.0.1
+ pkgrel = 1
+ url = https://github.com/Chipsterjulien/pingormail
+ install = pingormail.install
+ arch = any
+ license = WTFPL
+ makedepends = go
+ options = !strip
+ backup = etc/pingormail/pingormail.toml
+ source = pingormail-0.0.1.tar.gz
+ sha512sums = aa45e74ed3b851da67b55fd06e1730add8df27fc144170db17159ff75edf5d7455e39514c2566fb9919b7ece0bcdda006abd020ea3d89f641e20eaaf96cfef17
+
+pkgname = pingormail
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..74b86efcab44
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,84 @@
+# Maintainer: Chipster Julien <julien dot chipster @ archlinux dot fr>
+
+pkgname=pingormail
+pkgver=0.0.1
+pkgrel=1
+pkgdesc="Ping address. If no result, send mail"
+arch=('any')
+url="https://github.com/Chipsterjulien/pingormail"
+license=('WTFPL')
+makedepends=('go')
+options=('!strip')
+backup=('etc/pingormail/pingormail.toml')
+source=("$pkgname-$pkgver.tar.gz")
+install=pingormail.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 viper"
+ go get github.com/spf13/viper
+ echo "Install email"
+ go get github.com/jordan-wright/email
+
+ else
+ # Getting some libs
+ echo "Update go-logging"
+ go get github.com/op/go-logging
+ echo "Update viper"
+ go get github.com/spf13/viper
+ echo "Update email"
+ go get github.com/jordan-wright/email
+
+
+ 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"
+
+ # pingormail.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
+
+ # pingormail.service
+ install -Dm644 systemd/"$pkgname".service \
+ "$pkgdir"/usr/lib/systemd/system/"$pkgname".service || return 1
+
+ # pingormail.timer
+ install -Dm644 systemd/"$pkgname".timer \
+ "$pkgdir"/usr/lib/systemd/system/"$pkgname".timer || return 1
+
+ # pingormail binary
+ install -m755 -o root -g root -D "$srcdir"/$pkgname-$pkgver/$pkgname-$pkgver \
+ "$pkgdir"/usr/bin/$pkgname || return 1
+}
+
+sha512sums=('aa45e74ed3b851da67b55fd06e1730add8df27fc144170db17159ff75edf5d7455e39514c2566fb9919b7ece0bcdda006abd020ea3d89f641e20eaaf96cfef17')
diff --git a/pingormail-0.0.1.tar.gz b/pingormail-0.0.1.tar.gz
new file mode 100644
index 000000000000..142527e8812d
--- /dev/null
+++ b/pingormail-0.0.1.tar.gz
Binary files differ
diff --git a/pingormail.install b/pingormail.install
new file mode 100644
index 000000000000..e5ad089fa3f1
--- /dev/null
+++ b/pingormail.install
@@ -0,0 +1,38 @@
+post_install() {
+ pkgname=pingormail
+
+ # Fixing membership
+ chown http: /var/log/$pkgname
+ chown -R http: /etc/$pkgname
+
+ # Reload systemctl
+ systemctl daemon-reload
+
+ echo "Adding pingormail in systemctl:"
+ echo " systemctl enable pingormail.timer"
+ echo " systemctl start pingormail.timer"
+
+ true
+}
+
+post_upgrade() {
+ # Reload systemctl
+ systemctl daemon-reload
+
+ #echo "You should restart pingormail.timer"
+ #echo " systemctl restart pingormail.timer"
+
+ true
+}
+
+pre_remove() {
+ pkgname=pingormail
+ # Remove symlink in systemd
+ systemctl disable "$pkgname".timer
+ # Stop server
+ systemctl stop "$pkgname".timer
+ # Reload systemctl
+ systemctl daemon-reload
+
+ true
+} \ No newline at end of file