SHA256
1
0
forked from pool/atftp

Accepting request 50528 from home:computersalat:branches:network

OBS-URL: https://build.opensuse.org/request/show/50528
OBS-URL: https://build.opensuse.org/package/show/network/atftp?expand=0&rev=5
This commit is contained in:
Philipp Thomas 2010-10-20 08:52:22 +00:00 committed by Git OBS Bridge
parent 2478e16dc9
commit cd92f7e967
5 changed files with 190 additions and 52 deletions

View File

@ -1,7 +1,23 @@
-------------------------------------------------------------------
Wed Oct 13 21:28:56 UTC 2010 - chris@computersalat.de
- modified init/sysconfig file
o set defaults in init file
- added default group/user tftp:tftp (bnc#472282)
- added /srv/tftpboot as default ATFTPD_DIRECTORY (bnc#248008,507011)
- added logrotate script
o --logfile /var/log/atftpd/atftp.log
- added missing README.MCAST, README.PCRE
- some rpmlint stuff
o fixed missing-dependency-to-logrotate
o fixed init non-remote_fs-dependency
o fixed init no-reload-entry
o fixed non-conffile-in-etc
-------------------------------------------------------------------
Wed Sep 22 06:39:40 UTC 2010 - cristian.rodriguez@opensuse.org
- add missing pcre-devel to build Requires
- add missing pcre-devel to build Requires (bnc#537425)
-------------------------------------------------------------------
Fri Sep 12 16:27:04 CEST 2008 - mrueckert@suse.de

View File

@ -17,21 +17,19 @@
# norootforbuild
%define pkg_version 0.7
Name: atftp
%define pkg_version 0.7
Summary: Advanced TFTP Server and Client
Version: 0.7.0
Release: 139
Release: 140
License: GPLv2+
Group: System/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: pcre-devel readline-devel tcpd-devel
PreReq: %insserv_prereq %fillup_prereq
Conflicts: tftp
Url: ftp://ftp.mamalinux.com/pub/atftp/
Source: %{name}-%{pkg_version}.tar.bz2
Source1: atftpd.init.d
Source2: atftpd.sysconfig
Source3: atftpd.logrotate
Patch1: atftp-0.7.dif
Patch2: atftp-CLK_TCK.diff
Patch3: atftp-0.7_compiler_warnings.patch
@ -40,8 +38,12 @@ Patch5: atftp-0.7_sol_ip.patch
Patch6: atftp-0.7_bug-213384_OPT_NUMBER.patch
Patch7: atftpd-0.7_unprotected_assignments_crash.patch
Patch8: atftpd-0.7_circumvent_tftp_size_restrictions.patch
#
Summary: Advanced TFTP Server and Client
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq %fillup_prereq
BuildRequires: pwdutils
BuildRequires: pcre-devel readline-devel tcpd-devel
Conflicts: tftp
Recommends: logrotate
%description
atftp stands for Advanced Trivial File Transfer Protocol. It is called
@ -81,33 +83,55 @@ autoreconf -fi
%{__install} -D -m 0755 %{S:1} %{buildroot}/etc/init.d/atftpd
%{__ln_s} -f ../../etc/init.d/atftpd %{buildroot}%{_sbindir}/rcatftpd
%{__install} -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.atftpd
%{__install} -Dd -m 0750 %{buildroot}/var/run/atftpd/
%{__install} -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
%{__install} -Dd -m 0750 $RPM_BUILD_ROOT/var/log/atftpd
%clean
%{__rm} -rf %{buildroot}
%pre
# This group/user is shared with tftp, so please
# keep this in sync with tftp.spec
if [ -z "$(%{_bindir}/getent group tftp 2>/dev/null)" ]; then
%{_sbindir}/groupadd -r tftp 2>/dev/null
fi
if [ -z "$(%{_bindir}/getent passwd tftp 2>/dev/null)" ]; then
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
-r -s /bin/false tftp 2>/dev/null
fi
if [ -f /etc/sysconfig/atftpd ]; then
%{__sed} -i -e "s@^\(ATFTPD_OPTIONS=\"--daemon \"\)@#\1@" /etc/sysconfig/atftpd
%{__sed} -i -e "s@^\(ATFTPD_DIRECTORY=\"/tftpboot\"\)@#\1@" /etc/sysconfig/atftpd
fi
%preun
%stop_on_removal atftpd
%post
# /srv/tftpboot is used by tftp as well
# hence added via post :)
if [ ! -d /srv/tftpboot ]; then
%{__install} -d -m0750 -o root -g tftp /srv/tftpboot
fi
%{fillup_only -n atftpd}
%postun
%restart_on_update atftpd
%{insserv_cleanup}
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc BUGS FAQ LICENSE README TODO
%doc BUGS FAQ LICENSE README README.MCAST README.PCRE TODO
%{_bindir}/atftp
%{_sbindir}/atftpd
%{_sbindir}/in.tftpd
%{_sbindir}/rcatftpd
/etc/init.d/atftpd
%config /etc/logrotate.d/%{name}
/var/adm/fillup-templates/sysconfig.atftpd
%{_mandir}/man1/atftp.1.gz
%{_mandir}/man8/atftpd.8.gz
%{_mandir}/man8/in.tftpd.8.gz
%dir %attr(-,nobody,nogroup) /var/run/atftpd/
%dir %attr(-,tftp,root) /var/log/atftpd/
%changelog

View File

@ -10,12 +10,13 @@
#
### BEGIN INIT INFO
# Provides: atftpd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: launch atftpd server
# Provides: atftpd
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: launch atftpd server
# Description: launch Advanced TFTP Server
### END INIT INFO
# Shell functions sourced from /etc/rc.status:
@ -47,46 +48,75 @@ rc_reset
# with force-reload (in case signalling is not supported) are
# considered a success.
ATFTPD_BIN="/usr/sbin/atftpd"
if [ ! -x $ATFTPD_BIN ]; then
echo -n "Advanced Trivial FTP server, $ATFTPD_BIN is not installed."
ATFTP_BIN="/usr/sbin/atftpd"
if [ ! -x $ATFTP_BIN ]; then
echo -n "Advanced Trivial FTP server, $ATFTP_BIN is not installed."
# Tell the user this has skipped
rc_status -s
exit 5
fi
# Set default in case of missing sysconfig file
ATFTPD_USE_INETD=yes
ATFTPD_OPTIONS=""
if [ -f /etc/sysconfig/atftpd ]; then
. /etc/sysconfig/atftpd
fi
ATFTP_LOG_FILE="/var/log/atftpd/atftp.log"
ATFTP_LOG_DIR="$(dirname ${ATFTP_LOG_FILE})"
ATFTP_PID_DIR="/var/run/atftpd"
if [ "$ATFTPD_USE_INETD" = "yes" ]; then
exit 0;
# check for sysconfig file
[ -f /etc/sysconfig/atftpd ] && . /etc/sysconfig/atftpd
# Set default in case of missing sysconfig file
ATFTP_USR=${ATFTPD_USER:="tftp"}
ATFTP_GRP=${ATFTPD_GROUP:="tftp"}
ATFTP_OPTS=${ATFTPD_OPTIONS:=""}
ATFTP_USE_INETD=${ATFTPD_USE_INETD:="no"}
ATFTP_DIR=${ATFTPD_DIRECTORY:="/srv/tftpboot"}
ATFTP_BIND=${ATFTP_BIND_ADDRESSES:=""}
# start as daemon with some default opts
ATFTP_DEF_OPTS="--daemon --user $ATFTP_USR --group $ATFTP_GRP --logfile $ATFTP_LOG_FILE"
# set correct perm on log_dir/pid_dir
# IN: $ATFTP_USR
set_perm(){
[ ! -f "$ATFTP_LOG_FILE" ] && touch "$ATFTP_LOG_FILE";
chown -R ${1}:root "$ATFTP_LOG_DIR"
[ ! -d "$ATFTP_PID_DIR" ] && /usr/bin/install -d "$ATFTP_PID_DIR";
chown -R ${1}:root "$ATFTP_PID_DIR"
}
if [ "$ATFTP_USE_INETD" = "yes" ]; then
echo "ATFTP is set to start via inetd"
exit 0;
fi
case "$1" in
start)
if [ -n "$ATFTPD_BIND_ADDRESSES" ]; then
for IP in $ATFTPD_BIND_ADDRESSES; do
echo -n "Starting Advanced Trivial FTP server on $IP"
startproc -p "/var/run/atftpd/$IP.pid" -f $ATFTPD_BIN --pidfile "/var/run/atftpd/$IP.pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY --bind-address $IP
rc_status -v
done
set_perm "${ATFTP_USR}"
if [ -n "$ATFTP_BIND" ]; then
for IP in $ATFTP_BIND; do
echo -n "Starting Advanced Trivial FTP server on $IP: "
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc -p "${ATFTP_PID_DIR}/$IP.pid" -f $ATFTP_BIN --pidfile "${ATFTP_PID_DIR}/$IP.pid" $ATFTP_DEF_OPTS $ATFTP_OPTS $ATFTP_DIR --bind-address $IP
# Remember status and be verbose
rc_status -v
done
else
echo -n "Starting Advanced Trivial FTP server"
startproc $ATFTPD_BIN --pidfile "/var/run/atftpd/pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY
echo -n "Starting Advanced Trivial FTP server: "
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
startproc $ATFTP_BIN --pidfile "${ATFTP_PID_DIR}/pid" $ATFTP_DEF_OPTS $ATFTP_OPTS $ATFTP_DIR
# Remember status and be verbose
rc_status -v
fi
;;
stop)
echo -n "Stopping Advanced Trivial FTP server"
killproc -TERM $ATFTPD_BIN
rc_status -v
echo -n "Stopping Advanced Trivial FTP server: "
killproc -TERM $ATFTP_BIN
# Remember status and be verbose
# rc_status -v
rc_status -v
;;
try-restart)
## Do a restart only if the service was active before.
@ -105,8 +135,39 @@ case "$1" in
# Remember status and be quiet
rc_status
;;
force-reload)
#echo -n "Reloading Advanced Trivial FTP server: "
## if it supports it:
#/sbin/killproc -HUP $ATFTP_BIN
#touch /var/run/FOO.pid
# Remember status and be verbose
#rc_status -v
## Otherwise:
$0 try-restart
#rc_status
;;
reload)
echo -n "Reloading Advanced Trivial FTP server: "
## Like force-reload, but if daemon does not support
## signaling, do nothing (!)
# If it supports signaling:
#/sbin/killproc -HUP $ATFTP_BIN
#touch /var/run/FOO.pid
# Remember status and be verbose
#rc_status -v
## Otherwise if it does not support reload:
rc_failed 5
# Remember status and be verbose
rc_status -v
;;
status)
echo -n "Checking for service atftp:"
echo -n "Checking for Advanced Trivial FTP server: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
@ -117,11 +178,13 @@ case "$1" in
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $ATFTPD_BIN
checkproc $ATFTP_BIN
# Remember status and be verbose
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart}"
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac

13
atftpd.logrotate Normal file
View File

@ -0,0 +1,13 @@
/var/log/atftpd/atftp.log {
compress
dateext
maxage 365
rotate 99
size=+4096k
notifempty
missingok
create 640 tftp tftp
postrotate
/etc/init.d/atftpd restart
endscript
}

View File

@ -1,26 +1,48 @@
## Path: Network/FTP/Atftpd
## Description: ATFTP Configuration
## Type: string
## Default: "--daemon "
## Default: ""
#
# daemon user (tftp)
#
ATFTPD_USER=""
## Type: string
## Default: ""
#
# daemon user (tftp)
#
ATFTPD_GROUP=""
## Type: string
## Default: ""
##
## INFO:
## "--daemon, --user, --group, --logfile" can not be removed/replaced here as
## atftp is started with them as default opts: "--daemon --user atftp --group atftp "
## and
## logging to file is set as default: "--logfile /var/log/atftpd/atftp.log "
#
# atftpd options
#
ATFTPD_OPTIONS="--daemon "
ATFTPD_OPTIONS=""
## Type: yesno
## Default: no
#
# Use inetd instead of daemon
#
ATFTPD_USE_INETD="no"
ATFTPD_USE_INETD=""
## Type: string
## Default: "/tftpboot"
## Default: "/srv/tftpboot"
## was "/tftpboot" but
## "/tftpboot" is not allowed anymore in FHS 2.2.
#
# TFTP directory must be a world readable/writable directory.
# By default /tftpboot is assumed.
# By default /srv/tftpboot is assumed.
#
ATFTPD_DIRECTORY="/tftpboot"
ATFTPD_DIRECTORY=""
## Type: string
## Default: ""