summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Zhong2018-04-19 18:03:21 +0800
committerAllen Zhong2018-04-19 18:03:21 +0800
commit61472bd98940695fd1965e09b26b0fcc43a91714 (patch)
treeedf7478b76a5a74301f1f22ddbed8e7dcbac5e5d
parentb1ab51207da83cda6408fc9c92a0e0f764926e10 (diff)
downloadaur-61472bd98940695fd1965e09b26b0fcc43a91714.tar.gz
update scripts & scplit to multiple sub-packages
-rw-r--r--.SRCINFO14
-rw-r--r--PKGBUILD53
-rw-r--r--tidb.install14
-rw-r--r--tidb.sysusers1
-rw-r--r--tidb.tmpfiles4
5 files changed, 72 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7448af899ed5..b99f8f26592b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,27 @@
# Generated by mksrcinfo v8
-# Thu Apr 19 09:08:31 UTC 2018
+# Thu Apr 19 09:54:45 UTC 2018
pkgbase = tidb-bin
pkgdesc = A distributed NewSQL database compatible with MySQL protocol
pkgver = 2.0.0.rc6
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/pingcap/tidb
+ install = tidb.install
arch = x86_64
license = APACHE
depends = gcc-libs
+ optdepends = go-tools: provides goyacc
+ provides = tidb=2.0.0
+ conflicts = tidb-bin-nightly
options = strip
options = debug
source = https://download.pingcap.org/tidb-v2.0.0-rc.6-linux-amd64.tar.gz
+ source = tidb.sysusers
+ source = tidb.tmpfiles
sha256sums = 3ef3ebd6cfd9a4ae471fef37819b7ca1be3576b6041eddc190622ccaa6b61b8c
+ sha256sums = 6fb6ae67a53c6cd054643542e76da6f16e000b029a98b34172972fcb505fc299
+ sha256sums = 15f285782938b3ebbb8be60cc962a2cbf5ca349527c39d3a1138be1bf976feb9
pkgname = tidb-bin
+pkgname = tidb-bin-utils
+
diff --git a/PKGBUILD b/PKGBUILD
index 7fdf5df75130..0c28302ef819 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,25 +1,54 @@
# Maintainer: Allen Zhong <moeallenz@gmail.com>
# Contributor: Liqueur Librazy <im@librazy.org>
# Contributor: Jian Zeng <anonymousknight96@gmail.com>
-pkgname=tidb-bin
+pkgbase=tidb-bin
_basever=2.0.0
_rcver=6
pkgver=$_basever.rc$_rcver
-pkgrel=1
-
+pkgrel=2
+pkgname=("${pkgbase}" "${pkgbase}-utils")
pkgdesc="A distributed NewSQL database compatible with MySQL protocol"
arch=('x86_64')
url="https://github.com/pingcap/tidb"
license=('APACHE')
depends=('gcc-libs')
-conflict=('tidb-bin-nightly')
-options=(strip debug)
-source=("https://download.pingcap.org/tidb-v$_basever-rc.$_rcver-linux-amd64.tar.gz")
-sha256sums=('3ef3ebd6cfd9a4ae471fef37819b7ca1be3576b6041eddc190622ccaa6b61b8c')
+optdepends=('go-tools: provides goyacc')
+provides=("tidb=$_basever")
+conflicts=('tidb-bin-nightly')
+install='tidb.install'
+options=('strip' 'debug')
+source=("https://download.pingcap.org/tidb-v$_basever-rc.$_rcver-linux-amd64.tar.gz"
+ "tidb.sysusers"
+ "tidb.tmpfiles"
+ )
+sha256sums=('3ef3ebd6cfd9a4ae471fef37819b7ca1be3576b6041eddc190622ccaa6b61b8c'
+ '6fb6ae67a53c6cd054643542e76da6f16e000b029a98b34172972fcb505fc299'
+ '15f285782938b3ebbb8be60cc962a2cbf5ca349527c39d3a1138be1bf976feb9')
+
+_package() {
+ cd "$srcdir"
+ install -Dm644 tidb.sysusers "$pkgdir"/usr/lib/sysusers.d/tidb.conf
+ install -Dm644 tidb.tmpfiles "$pkgdir"/usr/lib/tmpfiles.d/tidb.conf
+
+ cd "tidb-v$_basever-rc.$_rcver-linux-amd64/bin"
+ install -dm755 "$pkgdir"/{etc/tidb,usr/bin}
+ install -Dm755 *-server "$pkgdir"/usr/bin
+}
-package() {
- cd "tidb-v$_basever-rc.$_rcver-linux-amd64/bin" || exit 1
- for i in ti* pd-*; do
- install -Dm755 "$i" "$pkgdir/usr/bin/$i"
- done
+_package-utils() {
+ cd "tidb-v$_basever-rc.$_rcver-linux-amd64/bin"
+ install -dm755 "$pkgdir"/usr/bin
+ install -Dm755 *-ctl "$pkgdir"/usr/bin
+ install -Dm755 pd-recover "$pkgdir"/usr/bin
+ install -Dm755 pd-tso-bench "$pkgdir"/usr/bin
+ install -Dm755 tikv-fail "$pkgdir"/usr/bin
+ install -Dm755 tikv-importer "$pkgdir"/usr/bin
}
+
+for _p in ${pkgname[@]}; do
+ eval "package_${_p}() {
+ $(declare -f "_package${_p#${pkgbase}}")
+ _package${_p#${pkgbase}}
+ }"
+done
+
diff --git a/tidb.install b/tidb.install
new file mode 100644
index 000000000000..34f216e8e6d1
--- /dev/null
+++ b/tidb.install
@@ -0,0 +1,14 @@
+#/bin/sh
+
+post_install() {
+ systemd-sysusers /usr/lib/sysusers.d/tidb.conf
+ systemd-tmpfiles --create /usr/lib/tmpfiles.d/tidb.conf
+ #systemctl daemon-reload
+}
+
+post_upgrade() {
+ # TODO: Add systemd services
+ #systemctl daemon-reload
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/tidb.sysusers b/tidb.sysusers
new file mode 100644
index 000000000000..22f3fd22083b
--- /dev/null
+++ b/tidb.sysusers
@@ -0,0 +1 @@
+u tidb - - /var/lib/tidb
diff --git a/tidb.tmpfiles b/tidb.tmpfiles
new file mode 100644
index 000000000000..312bcc1a6602
--- /dev/null
+++ b/tidb.tmpfiles
@@ -0,0 +1,4 @@
+d /var/lib/tidb 0755 tidb tidb
+d /etc/tidb 0755 tidb tidb
+x /var/lib/tidb/*
+x /etc/tidb/*