initial import
This commit is contained in:
72
i2pd/PKGBUILD
Normal file
72
i2pd/PKGBUILD
Normal file
@@ -0,0 +1,72 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=i2pd
|
||||
pkgver=2.52.0
|
||||
pkgrel=1
|
||||
pkgdesc="Simplified, free and libre C++ implementation of I2P client"
|
||||
arch=('i686' 'x86_64')
|
||||
url='https://i2pd.website/'
|
||||
license=('Modified-BSD')
|
||||
depends=('boost-libs' 'miniupnpc' 'libressl' 'zlib')
|
||||
makedepends=('boost' 'cmake')
|
||||
provides=('i2p-router')
|
||||
install='i2pd.install'
|
||||
backup=("etc/${pkgname}/${pkgname}.conf"
|
||||
"etc/${pkgname}/tunnels.conf"
|
||||
"etc/conf.d/${pkgname}")
|
||||
source=("$pkgname-$pkgver.tar.gz::https://github.com/PurpleI2P/$pkgname/archive/$pkgver.tar.gz"
|
||||
"$pkgname.confd"
|
||||
"$pkgname.initd"
|
||||
"$pkgname.run")
|
||||
sha512sums=('54272b23dcb62b8b7523038a9c1fc71b87bb9042f22bd12d6ebc62cfa47da07e2df47d88d706f285e9d88f9cace0564546632c10161f83f5c57b9ea17f5bde5f'
|
||||
'083f4c860d7556bd14f2765b098743c25f996ef16de3982430ff27ac7711051738d48709654441099ea8c755b6d9a6e25b52286f7e8c928d3f39f1207a9517a9'
|
||||
'99a7e4d94840b68ce093c22141da46d89b54c63c214fbf3c0eada4bc28d128da181fc7968a0571028f8772acc91a7d58a87f9f57bb65b748dd730bd57e6c64e1'
|
||||
'42ea21e73fdc32cd16e2e29140037450258e2585f3df8f394600d15de991b353e242c874edeeebf5b7473489b923b7fbbeab875e4cfc715e7e90de5dc6aea525')
|
||||
|
||||
build() {
|
||||
cmake \
|
||||
-S $pkgname-$pkgver/build \
|
||||
-B build \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_INSTALL_BINDIR=sbin \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DWITH_UPNP=ON \
|
||||
-DWITH_LIBRARY=OFF \
|
||||
-DWITH_PCH=OFF
|
||||
make -C build
|
||||
}
|
||||
|
||||
package(){
|
||||
make DESTDIR="$pkgdir" -C build install
|
||||
|
||||
cd "$srcdir/$pkgname-$pkgver"
|
||||
install -Dm0644 contrib/$pkgname.conf $pkgdir/etc/$pkgname/$pkgname.conf
|
||||
install -Dm0644 contrib/tunnels.conf $pkgdir/etc/$pkgname/tunnels.conf
|
||||
install -Dm0644 contrib/subscriptions.txt $pkgdir/etc/$pkgname/subscriptions.txt
|
||||
|
||||
install -d -m0750 $pkgdir/var/lib/$pkgname
|
||||
ln -s ../../../etc/$pkgname/$pkgname.conf $pkgdir/var/lib/$pkgname/$pkgname.conf
|
||||
ln -s ../../../etc/$pkgname/tunnels.conf $pkgdir/var/lib/$pkgname/tunnels.conf
|
||||
ln -s ../../../etc/$pkgname/subscriptions.txt $pkgdir/var/lib/$pkgname/subscriptions.txt
|
||||
|
||||
pushd contrib
|
||||
find ./certificates -type d -exec install -d {} $pkgdir/usr/share/${pkgname}/{} \;
|
||||
find ./certificates -type f -exec install -Dm644 {} $pkgdir/usr/share/${pkgname}/{} \;
|
||||
ln -s ../../../usr/share/$pkgname/certificates $pkgdir/var/lib/$pkgname/certificates
|
||||
popd
|
||||
|
||||
# license
|
||||
install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
|
||||
|
||||
# docs
|
||||
install -Dm644 README.md $pkgdir/usr/share/doc/$pkgname/README.md
|
||||
|
||||
# openrc and runit
|
||||
install -Dm0644 "$srcdir/${pkgname}.confd" "${pkgdir}/etc/conf.d/${pkgname}"
|
||||
install -Dm0755 "$srcdir/${pkgname}.initd" "${pkgdir}/etc/init.d/${pkgname}"
|
||||
install -Dm0755 "$srcdir/${pkgname}.run" "${pkgdir}/etc/sv/${pkgname}/run"
|
||||
|
||||
# man
|
||||
install -Dm644 debian/$pkgname.1 $pkgdir/usr/share/man/man1/$pkgname.1
|
||||
chmod -R o= $pkgdir/var/lib/$pkgname
|
||||
}
|
||||
12
i2pd/i2pd.confd
Normal file
12
i2pd/i2pd.confd
Normal file
@@ -0,0 +1,12 @@
|
||||
I2PD_USER=i2pd
|
||||
I2PD_GROUP=i2pd
|
||||
I2PD_LOG=/var/log/i2pd.log
|
||||
I2PD_PID=/run/i2pd/i2pd.pid
|
||||
|
||||
# max number of open files (for floodfill)
|
||||
rc_ulimit="-n 4096"
|
||||
|
||||
# Options to i2pd
|
||||
I2PD_OPTIONS="--daemon --service --pidfile=${I2PD_PID} \
|
||||
--log=file --logfile=${I2PD_LOG} \
|
||||
--conf=/etc/i2pd/i2pd.conf --tunconf=/etc/i2pd/tunnels.conf"
|
||||
50
i2pd/i2pd.initd
Normal file
50
i2pd/i2pd.initd
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2016 Gentoo Foundation
|
||||
# Copyright 2019 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
description="C++ daemon for accessing the I2P network"
|
||||
description_graceful="Graceful shutdown, takes 10 minutes"
|
||||
|
||||
command="/usr/sbin/i2pd"
|
||||
command_args="${I2PD_OPTIONS}"
|
||||
user="${I2PD_USER}:${I2PD_GROUP}"
|
||||
start_stop_daemon_args="
|
||||
--user \"${user}\"
|
||||
--pidfile \"${I2PD_PID}\"
|
||||
--progress
|
||||
"
|
||||
retry="SIGTERM/20/SIGKILL/20"
|
||||
|
||||
I2PD_PID_DIR=$(dirname "${I2PD_PID}")
|
||||
|
||||
extra_started_commands="graceful"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
after firewall
|
||||
use dns logger netmount
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ -z "${I2PD_USER}" ] || \
|
||||
[ -z "${I2PD_GROUP}" ] || \
|
||||
[ -z "${I2PD_PID}" ] || \
|
||||
[ -z "${I2PD_LOG}" ] || \
|
||||
[ -z "${I2PD_OPTIONS}" ] ; then
|
||||
eerror "Not all variables I2PD_USER, I2PD_GROUP, I2PD_PID, I2PD_OPTIONS, I2PD_LOG are defined."
|
||||
eerror "Check your /etc/conf.d/i2pd"
|
||||
return 1
|
||||
fi
|
||||
checkpath -f -o "${user}" "${I2PD_LOG}"
|
||||
checkpath -d -m 0750 -o "${user}" "${I2PD_PID_DIR}"
|
||||
}
|
||||
|
||||
graceful() {
|
||||
# on SIGINT, i2pd stops accepting tunnels and shuts down in 600 seconds
|
||||
ebegin "Gracefully stopping i2pd, this takes 10 minutes"
|
||||
mark_service_stopping
|
||||
eval start-stop-daemon --stop ${start_stop_daemon_args} \
|
||||
--exec "${command}" --retry 'SIGINT/620/SIGTERM/20/SIGKILL/20'
|
||||
eend $? && mark_service_stopped
|
||||
}
|
||||
26
i2pd/i2pd.install
Normal file
26
i2pd/i2pd.install
Normal file
@@ -0,0 +1,26 @@
|
||||
post_install() {
|
||||
if ! getent group i2pd &>/dev/null; then
|
||||
groupadd -r i2pd >/dev/null
|
||||
fi
|
||||
if ! getent passwd i2pd &>/dev/null; then
|
||||
useradd -r -g i2pd -G adm -d /var/lib/i2pd -s /bin/nologin i2pd >/dev/null
|
||||
fi
|
||||
if ! groups i2pd | grep adm &>/dev/null; then
|
||||
gpasswd -a i2pd adm >/dev/null
|
||||
fi
|
||||
chown -R i2pd:i2pd /var/lib/i2pd
|
||||
chmod 700 /var/lib/i2pd
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
if getent passwd i2pd &>/dev/null; then
|
||||
userdel i2pd >/dev/null
|
||||
fi
|
||||
if getent group i2pd &>/dev/null; then
|
||||
groupdel i2pd >/dev/null
|
||||
fi
|
||||
}
|
||||
5
i2pd/i2pd.run
Normal file
5
i2pd/i2pd.run
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
exec chpst -U i2pd i2pd \
|
||||
--conf=/etc/i2pd/i2pd.conf \
|
||||
--tunconf=/etc/i2pd/tunnels.conf \
|
||||
--service 2>&1
|
||||
Reference in New Issue
Block a user