initial import
This commit is contained in:
82
chrony/PKGBUILD
Normal file
82
chrony/PKGBUILD
Normal file
@@ -0,0 +1,82 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=chrony
|
||||
pkgver=4.0
|
||||
_debver=$pkgver
|
||||
_debrel=8
|
||||
pkgrel=3
|
||||
pkgdesc="Lightweight NTP client and server"
|
||||
url='https://chrony.tuxfamily.org/'
|
||||
arch=('i686' 'x86_64')
|
||||
license=('GPL-2')
|
||||
depends=('libcap' 'libedit' 'libseccomp' 'nettle' 'gnutls')
|
||||
makedepends=('asciidoctor' 'quilt')
|
||||
options=('!emptydirs')
|
||||
backup=('etc/chrony.conf')
|
||||
source=(https://download.tuxfamily.org/chrony/${pkgname}-${pkgver}.tar.gz
|
||||
https://deb.debian.org/debian/pool/main/${pkgname::1}/${pkgname}/${pkgname}_${_debver}-${_debrel}+deb11u2.debian.tar.xz
|
||||
chronyd.confd
|
||||
chronyd.initd
|
||||
chronyd.run)
|
||||
install=${pkgname}.install
|
||||
sha512sums=('a1c11a386c43f495910f7f2e9b5fbb1652c3631471d182b9b8203dfef98611d11535ad547a879856551263aed0ae2e30e4135b8ed89553684706166bc1c725c9'
|
||||
'717cbd7a6fffc1bed6105008275c2de292b2998c78eb311d4eda4ac5f3e3c3b99012b4e3c7f38faa3177d231f5bc8894ac51c0514cc05173233a66506aa3bcd9'
|
||||
'5b83208aeb9a3ff2f21ac786a25f83b7804540b1930397396f5b15a2aba11f36a9bc4de06a88b58280cbc44f5c272bb41b6803463f4ea1c6724d7a9404c88d7f'
|
||||
'b75b69e1469f0087a8146154da0a0a3e81a179c186f8bec92aed223b627b4d400b7f0c6b7d02018d0889c6f7bc921df95d1e22ef2577ec670229f003789296cc'
|
||||
'5844456d316b6b4c6a7154f0f5d3f519d8d492beb673d330f76407e35a726fd4ed09223d846951def6d810626cbcfc1aca8a6e6818ac36aa62a289a8c7265e59')
|
||||
|
||||
prepare() {
|
||||
cd ${pkgname}-${pkgver}
|
||||
|
||||
if [ ${pkgver%.*} = ${_debver%.*} ]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
build() {
|
||||
cd ${pkgname}-${pkgver}
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--enable-scfilter \
|
||||
--enable-ntp-signd \
|
||||
--with-user=chrony \
|
||||
--with-sendmail=/usr/bin/sendmail \
|
||||
--with-hwclockfile=/etc/adjtime \
|
||||
--with-pidfile=/run/chrony/chronyd.pid \
|
||||
--chronyrundir=/run/chrony
|
||||
make V=1
|
||||
}
|
||||
|
||||
package() {
|
||||
cd ${pkgname}-${pkgver}
|
||||
make DESTDIR="${pkgdir}" install install-docs
|
||||
|
||||
install -Dm 755 ${srcdir}/chronyd.initd "${pkgdir}/etc/init.d/chronyd"
|
||||
install -Dm 644 ${srcdir}/chronyd.confd "${pkgdir}/etc/conf.d/chronyd"
|
||||
install -Dm 755 ${srcdir}/chronyd.run "${pkgdir}/etc/sv/chronyd/run"
|
||||
if [ $(uname -o) = GNU/Linux ]; then
|
||||
sed -i 's|ARGS=""|ARGS="-m -u chrony"|' "${pkgdir}/etc/conf.d/chronyd"
|
||||
fi
|
||||
|
||||
install -Dm 644 examples/chrony.logrotate "${pkgdir}/etc/logrotate.d/chrony"
|
||||
install -Dm 644 README NEWS FAQ -t "${pkgdir}/usr/share/doc/${pkgname}"
|
||||
install -Dm 644 examples/* -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
|
||||
|
||||
install -Dm 644 examples/chrony.conf.example3 "${pkgdir}/etc/chrony.conf"
|
||||
sed -i \
|
||||
-e '/^! pool /s/^! //' \
|
||||
-e '/^! leapsectz right\/UTC/s/^! //' \
|
||||
-e '/^! makestep 1.0 3/s/^! //' \
|
||||
-e '/^! rtcsync/s/^! //' \
|
||||
"${pkgdir}/etc/chrony.conf"
|
||||
|
||||
install -Dm644 COPYING -t "$pkgdir/usr/share/licenses/$pkgname"
|
||||
}
|
||||
22
chrony/chrony.install
Normal file
22
chrony/chrony.install
Normal file
@@ -0,0 +1,22 @@
|
||||
post_install() {
|
||||
getent group chrony 2> /dev/null || groupadd -g 183 chrony > /dev/null
|
||||
getent passwd chrony 2> /dev/null \
|
||||
|| useradd -u 183 -g chrony -d /var/lib/chrony \
|
||||
-c 'Network Time Protocol' -s /bin/false chrony > /dev/null
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
if [ $(vercmp $2 1.29.1-2) -le 0 ]; then
|
||||
getent group chrony 2> /dev/null || groupadd -r -g 183 chrony > /dev/null
|
||||
getent passwd chrony 2> /dev/null \
|
||||
|| useradd -r -u 183 -g chrony -d /var/lib/chrony \
|
||||
-c 'Network Time Protocol' -s /bin/false chrony > /dev/null
|
||||
chown -R 183:183 /var/lib/chrony
|
||||
fi
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
getent passwd chrony 2> /dev/null && userdel chrony > /dev/null
|
||||
getent group chrony 2> /dev/null && groupdel chrony > /dev/null
|
||||
true
|
||||
}
|
||||
20
chrony/chronyd.confd
Normal file
20
chrony/chronyd.confd
Normal file
@@ -0,0 +1,20 @@
|
||||
# /etc/conf.d/chronyd
|
||||
|
||||
CFGFILE="/etc/chrony.conf"
|
||||
|
||||
# chronyd takes some time to perform a second fork, by enabling this
|
||||
# option chronyd is deamonized through start-stop-daemon(1) thereby
|
||||
# significantly reducing the startup time.
|
||||
FAST_STARTUP=yes
|
||||
|
||||
# Configuration dependant options :
|
||||
# -s - Set system time from RTC if rtcfile directive present
|
||||
# -r - Reload sample histories if dumponexit directive present
|
||||
#
|
||||
# The combination of "-s -r" allows chronyd to perform long term averaging of
|
||||
# the gain or loss rate across system reboots and shutdowns.
|
||||
|
||||
ARGS=""
|
||||
|
||||
# vrf e.g 'vrf-mgmt'
|
||||
#vrf=""
|
||||
32
chrony/chronyd.initd
Normal file
32
chrony/chronyd.initd
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
command="/usr/sbin/chronyd"
|
||||
description="chronyd - the lightweight network time protocol daemon"
|
||||
pidfile="/run/chronyd.pid"
|
||||
required_files="$CFGFILE"
|
||||
command_args="-f $CFGFILE $ARGS"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after firewall
|
||||
provide ntp-client ntp-server
|
||||
use dns
|
||||
}
|
||||
|
||||
start() {
|
||||
if [ -c /dev/rtc ]; then
|
||||
grep -q '^rtcfile' "${CFGFILE}" && command_args="$command_args -s"
|
||||
fi
|
||||
grep -q '^dumponexit$' "${CFGFILE}" && command_args="$command_args -r"
|
||||
if yesno "$FAST_STARTUP"; then
|
||||
# this option makes it stay in foreground and let openrc do the tracking,
|
||||
# so we have to set pidfile to a dir that exists earlier.
|
||||
# the reason this is not the default is because there is no 'readiness',
|
||||
# self-backgrounding chrony waits for time to sync before continuing,
|
||||
# and this form does not.
|
||||
command_args="$command_args -n"
|
||||
command_background=true
|
||||
pidfile=/run/chronyd.pid
|
||||
fi
|
||||
default_start
|
||||
}
|
||||
3
chrony/chronyd.run
Normal file
3
chrony/chronyd.run
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
install -d -m750 -o chrony -g chrony /var/run/chrony
|
||||
exec chronyd -n -u chrony
|
||||
Reference in New Issue
Block a user