1

Topic: [atftp] Fixed package with OpenRC

Hello together,

after the rework to throw out "systemd" is for now stopped and I needed atftp I did a rework of the package available in the stable repositories on my own. Perhaps others can make use of it?

File: atftp-0.7-cflags.patch

--- atftp-0.7/configure.ac
+++ atftp-0.7/configure.ac
@@ -66,29 +66,6 @@
 dnl Check for AIX
 AC_AIX
 
-CFLAGS="-g -Wall -D_REENTRANT"
-
-if test x$debug = xtrue; then
-   CFLAGS="$CFLAGS -O0 -DDEBUG"
-else
-  if test -n "$auto_cflags"; then
-    if test -n "$GCC"; then
-      CFLAGS="$CFLAGS -g -O2 -Wall -Wno-implicit"
-    else
-      case "$host_os" in
-        *hpux*)  CFLAGS="$CFLAGS +O3"
-      ;;
-        *ultrix* | *osf*) CFLAGS="$CFLAGS -O -Olimit 2000"
-      ;;
-        *)       CFLAGS="$CFLAGS -O2"
-      ;;
-      esac
-    fi
-  else
-    CFLAGS="$CFLAGS -O2"
-  fi
-fi
-
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL

File: atftpd.confd

# Parameters to be passed to ATFTPD
ATFTPD_ARGS="--no-multicast --maxthread 20 --verbose=6 --group nobody /srv/atftp"

File: atftpd.initd

#!/sbin/openrc-run
# Copyright 2017 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2

description="Advanced TFTP Daemon"

command="/usr/bin/atftpd"
command_args="--daemon --no-fork $ATFTPD_ARGS"
command_background="yes"
pidfile="/var/run/atftpd.pid"

depend() {
    after net
}

File: PKGBUILD

# Maintainer: Benjamin Bukowski <benjamin.bukowski@gmail.com>
# Contributor: Johannes Löthberg <demizide@gmail.com>

pkgname=atftp
pkgver=0.7.1
pkgrel=2.hyperbola0
pkgdesc='Client/server implementation of the TFTP protocol that implements RFCs 1350, 2090, 2347, 2348, and 2349, with OpenRC support'
arch=(i686 x86_64)
url='http://sourceforge.net/projects/atftp/'
license=(GPL)
depends=(pcre readline)
backup=(etc/conf.d/atftpd)
source=(http://downloads.sf.net/sourceforge/atftp/atftp-$pkgver.tar.gz
        atftp-0.7-cflags.patch
        atftpd.initd
        atftpd.confd)
sha512sums=('af04e5bbbade0f4db1082d8d68fa1119db1d700891b3f109f3da3b22f89beb75521716e1e7abd91b4cb0e57ca1fff0f9ca0fa09588897da049ae266e3e539beb'
            '9227354689ea504f0500c244335a83d8a77dcb74c876ada1065c955f414e1f51e06dafcdb5d99f1fbb22036a074f9e46cada7378824d70f677ff6db931a35289'
            '6a2d2b3f9337b8db6ed65422c6836b93d42637da05cbde67b1b5e137e956021a74d07c7d2fa808b5254b54b31d12cf51bb15ad8f0cf4ec8cb7e6230f43fdeed1'
            '7379a9d3d48b1cb24befeec8291c074c32ed86369c72b226deda958a097ab280086a7926c7526bb0cfb5972a3a80156a7ce8e04946eac790d95731c833b4cf19')

prepare() {
  cd atftp-$pkgver
  # Respect our CFLAGS; needed below for building with -std=gnu89
  patch -Np1 -i ../atftp-0.7-cflags.patch
  autoreconf -vi
}

build() {
  cd atftp-$pkgver
  CFLAGS+=' -std=gnu89'
  ./configure --prefix=/usr --mandir=/usr/share/man --sbindir=/usr/bin \
              --enable-libreadline --disable-libwrap
  make
}

package() {
  cd atftp-$pkgver
  make DESTDIR="$pkgdir" install

  install -Dm755 ../atftpd.initd "$pkgdir"/etc/init.d/atftpd
  install -Dm644 ../atftpd.confd "$pkgdir"/etc/conf.d/atftpd
  install -dm775 --group=nobody "$pkgdir"/srv/atftp 

  # remove in.tftpd link as it conflicts with extra/tftp-hpa
  rm "${pkgdir}/usr/share/man/man8/in.tftpd.8"
  rm "${pkgdir}/usr/bin/in.tftpd"
}

Have fun with it. smile

Human being in favor with clear principles and so also for freedom in soft- and hardware!

Certainly anyone who has the power to make you believe absurdities has the power to make you commit injustices: For a life of every being full with peace and kindness, including diversity and freedom. Capitalism is destroying our minds, the planet itself and the universe in the end!