summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Chen2019-05-11 19:12:39 +0800
committerShane Chen2019-05-11 19:12:39 +0800
commitcf889ae3f6d7dd3832006731254cc37df43be69e (patch)
treef17e4f8b13336b5a81b716d0afda352a91cf9d3e
parentd9562347413c90f776fab53c327be3759d408ab7 (diff)
downloadaur-cf889ae3f6d7dd3832006731254cc37df43be69e.tar.gz
add config files into backup and generate passwords in post_install
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD13
-rw-r--r--domjudge-domserver.install6
-rw-r--r--domjudge-judgehost.install3
4 files changed, 42 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 70dff563eab..86f8792e293 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = domjudge
pkgdesc = an automated judge system to run programming contests
pkgver = 7.0.1
- pkgrel = 1
+ pkgrel = 2
url = http://www.domjudge.org/
arch = x86_64
license = GPL
@@ -38,12 +38,25 @@ pkgname = domjudge-domserver
depends = unzip
depends = zip
depends = apache
+ backup = etc/domserver/apache.conf
+ backup = etc/domserver/common-config.php
+ backup = etc/domserver/dbpasswords.secret
+ backup = etc/domserver/domjudge-fpm.conf
+ backup = etc/domserver/domserver-config.php
+ backup = etc/domserver/domserver-static.php
+ backup = etc/domserver/import-forwardfeed.yaml
+ backup = etc/domserver/initial_admin_password.secret
+ backup = etc/domserver/nginx-conf
+ backup = etc/domserver/nginx-conf-inner
+ backup = etc/domserver/restapi.secret
+ backup = etc/domserver/verdicts.php
pkgname = domjudge-docs
arch = any
depends = php
pkgname = domjudge-judgehost
+ install = domjudge-judgehost.install
arch = x86_64
depends = libcgroup
depends = curl
@@ -51,6 +64,13 @@ pkgname = domjudge-judgehost
depends = unzip
depends = zip
depends = lsof
+ backup = etc/judgehost/common-config.php
+ backup = etc/judgehost/judgehost-config.php
+ backup = etc/judgehost/judgehost-static.php
+ backup = etc/judgehost/restapi.secret
+ backup = etc/judgehost/sudoers-domjudge
+ backup = etc/judgehost/verdicts.php
+ backup = usr/lib/judgehost/judge/chroot-startstop.sh
pkgname = domjudge-submit
arch = x86_64
diff --git a/PKGBUILD b/PKGBUILD
index d808b376413..c529ac0c54e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
pkgbase=domjudge
pkgname=('domjudge-domserver' 'domjudge-docs' 'domjudge-judgehost' 'domjudge-submit')
pkgver=7.0.1
-pkgrel=1
+pkgrel=2
pkgdesc="an automated judge system to run programming contests"
arch=("$CARCH")
url="http://www.domjudge.org/"
@@ -74,9 +74,14 @@ package_domjudge-submit() {
package_domjudge-domserver() {
arch=('any')
depends=('curl' 'php' 'php-gd' 'php-intl' 'unzip' 'zip' 'apache')
+ backup=('etc/domserver/apache.conf' 'etc/domserver/common-config.php' 'etc/domserver/dbpasswords.secret' 'etc/domserver/domjudge-fpm.conf' 'etc/domserver/domserver-config.php' 'etc/domserver/domserver-static.php' 'etc/domserver/import-forwardfeed.yaml' 'etc/domserver/initial_admin_password.secret' 'etc/domserver/nginx-conf' 'etc/domserver/nginx-conf-inner' 'etc/domserver/restapi.secret' 'etc/domserver/verdicts.php')
install=domjudge-domserver.install
cd "$srcdir/domjudge-$pkgver"
make install-domserver DESTDIR="$pkgdir"/
+ # clear the password, we will run genadminpassword, genrestapicredentials, gendbpasswords when post_install
+ echo "" > "$pkgdir/etc/domserver/initial_admin_password.secret"
+ echo "" > "$pkgdir/etc/domserver/restapi.secret"
+ echo "" > "$pkgdir/etc/domserver/dbpasswords.secret"
install -Dm 644 "$srcdir/domjudge-domserver.conf" "$pkgdir/usr/lib/sysusers.d/domjudge-domserver.conf"
}
@@ -90,13 +95,19 @@ package_domjudge-docs() {
package_domjudge-judgehost() {
arch=("$CARCH")
depends=('libcgroup' 'curl' 'php' 'unzip' 'zip' 'lsof')
+ backup=('etc/judgehost/common-config.php' 'etc/judgehost/judgehost-config.php' 'etc/judgehost/judgehost-static.php' 'etc/judgehost/restapi.secret' 'etc/judgehost/sudoers-domjudge' 'etc/judgehost/verdicts.php' 'usr/lib/judgehost/judge/chroot-startstop.sh')
+ install=domjudge-judgehost.install
cd "$srcdir/domjudge-$pkgver"
make install-judgehost DESTDIR="$pkgdir"/
+ # clear the password, we will run genrestapicredentials when post_install
+ echo "" > "$pkgdir/etc/judgehost/restapi.secret"
+ install -Dm 755 "$srcdir/domjudge-$pkgver/etc/genrestapicredentials" "$pkgdir/etc/judgehost/genrestapicredentials"
install -Dm 644 "$srcdir/domjudge-judgehostd.service" "$pkgdir/usr/lib/systemd/system/domjudge-judgehostd.service"
install -Dm 644 "$srcdir/domjudge-judgehostd@.service" "$pkgdir/usr/lib/systemd/system/domjudge-judgehostd@.service"
install -Dm 644 "$srcdir/domjudge-cgroup.service" "$pkgdir/usr/lib/systemd/system/domjudge-cgroup.service"
install -Dm 644 "$srcdir/domjudge-judgehost.conf" "$pkgdir/usr/lib/sysusers.d/domjudge-judgehost.conf"
sed -i 's/512/domjudge/g' "$pkgdir/etc/judgehost/sudoers-domjudge"
mkdir -p "$pkgdir/etc/sudoers.d"
+ chmod 750 "$pkgdir/etc/sudoers.d"
ln -s "/etc/judgehost/sudoers-domjudge" "$pkgdir/etc/sudoers.d/domjudge"
}
diff --git a/domjudge-domserver.install b/domjudge-domserver.install
index d923ae5107a..1d65c7a2bcf 100644
--- a/domjudge-domserver.install
+++ b/domjudge-domserver.install
@@ -2,6 +2,12 @@ clear_cache(){
rm -rf /var/lib/domjudge/webapp/var/cache/*
}
+post_install(){
+ /etc/domserver/genadminpassword > /etc/domserver/initial_admin_password.secret
+ /etc/domserver/genrestapicredentials > /etc/domserver/restapi.secret
+ /etc/domserver/gendbpasswords > /etc/domserver/dbpasswords.secret
+}
+
pre_remove(){
clear_cache
}
diff --git a/domjudge-judgehost.install b/domjudge-judgehost.install
new file mode 100644
index 00000000000..63c3bdbd195
--- /dev/null
+++ b/domjudge-judgehost.install
@@ -0,0 +1,3 @@
+post_install(){
+ /etc/judgehost/genrestapicredentials > /etc/judgehost/restapi.secret
+}