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 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 Fri Sep 12 16:27:04 CEST 2008 - mrueckert@suse.de

View File

@ -17,21 +17,19 @@
# norootforbuild # norootforbuild
%define pkg_version 0.7
Name: atftp Name: atftp
%define pkg_version 0.7 Summary: Advanced TFTP Server and Client
Version: 0.7.0 Version: 0.7.0
Release: 139 Release: 140
License: GPLv2+ License: GPLv2+
Group: System/Daemons 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/ Url: ftp://ftp.mamalinux.com/pub/atftp/
Source: %{name}-%{pkg_version}.tar.bz2 Source: %{name}-%{pkg_version}.tar.bz2
Source1: atftpd.init.d Source1: atftpd.init.d
Source2: atftpd.sysconfig Source2: atftpd.sysconfig
Source3: atftpd.logrotate
Patch1: atftp-0.7.dif Patch1: atftp-0.7.dif
Patch2: atftp-CLK_TCK.diff Patch2: atftp-CLK_TCK.diff
Patch3: atftp-0.7_compiler_warnings.patch 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 Patch6: atftp-0.7_bug-213384_OPT_NUMBER.patch
Patch7: atftpd-0.7_unprotected_assignments_crash.patch Patch7: atftpd-0.7_unprotected_assignments_crash.patch
Patch8: atftpd-0.7_circumvent_tftp_size_restrictions.patch Patch8: atftpd-0.7_circumvent_tftp_size_restrictions.patch
# BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Advanced TFTP Server and Client PreReq: %insserv_prereq %fillup_prereq
BuildRequires: pwdutils
BuildRequires: pcre-devel readline-devel tcpd-devel
Conflicts: tftp
Recommends: logrotate
%description %description
atftp stands for Advanced Trivial File Transfer Protocol. It is called 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 %{__install} -D -m 0755 %{S:1} %{buildroot}/etc/init.d/atftpd
%{__ln_s} -f ../../etc/init.d/atftpd %{buildroot}%{_sbindir}/rcatftpd %{__ln_s} -f ../../etc/init.d/atftpd %{buildroot}%{_sbindir}/rcatftpd
%{__install} -D -m 0644 %{S:2} %{buildroot}/var/adm/fillup-templates/sysconfig.atftpd %{__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 %pre
%{__rm} -rf %{buildroot} # 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 %preun
%stop_on_removal atftpd %stop_on_removal atftpd
%post %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} %{fillup_only -n atftpd}
%postun %postun
%restart_on_update atftpd %restart_on_update atftpd
%{insserv_cleanup} %{insserv_cleanup}
%clean
%{__rm} -rf %{buildroot}
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc BUGS FAQ LICENSE README TODO %doc BUGS FAQ LICENSE README README.MCAST README.PCRE TODO
%{_bindir}/atftp %{_bindir}/atftp
%{_sbindir}/atftpd %{_sbindir}/atftpd
%{_sbindir}/in.tftpd %{_sbindir}/in.tftpd
%{_sbindir}/rcatftpd %{_sbindir}/rcatftpd
/etc/init.d/atftpd /etc/init.d/atftpd
%config /etc/logrotate.d/%{name}
/var/adm/fillup-templates/sysconfig.atftpd /var/adm/fillup-templates/sysconfig.atftpd
%{_mandir}/man1/atftp.1.gz %{_mandir}/man1/atftp.1.gz
%{_mandir}/man8/atftpd.8.gz %{_mandir}/man8/atftpd.8.gz
%{_mandir}/man8/in.tftpd.8.gz %{_mandir}/man8/in.tftpd.8.gz
%dir %attr(-,nobody,nogroup) /var/run/atftpd/ %dir %attr(-,tftp,root) /var/log/atftpd/
%changelog %changelog

View File

@ -10,12 +10,13 @@
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: atftpd # Provides: atftpd
# Required-Start: $remote_fs $syslog # Required-Start: $syslog $remote_fs
# Required-Stop: $remote_fs $syslog # Required-Stop: $syslog $remote_fs
# Default-Start: 3 5 # Default-Start: 3 5
# Default-Stop: 0 1 2 6 # Default-Stop: 0 1 2 6
# Description: launch atftpd server # Short-Description: launch atftpd server
# Description: launch Advanced TFTP Server
### END INIT INFO ### END INIT INFO
# Shell functions sourced from /etc/rc.status: # Shell functions sourced from /etc/rc.status:
@ -47,46 +48,75 @@ rc_reset
# with force-reload (in case signalling is not supported) are # with force-reload (in case signalling is not supported) are
# considered a success. # considered a success.
ATFTPD_BIN="/usr/sbin/atftpd" ATFTP_BIN="/usr/sbin/atftpd"
if [ ! -x $ATFTPD_BIN ]; then if [ ! -x $ATFTP_BIN ]; then
echo -n "Advanced Trivial FTP server, $ATFTPD_BIN is not installed." echo -n "Advanced Trivial FTP server, $ATFTP_BIN is not installed."
# Tell the user this has skipped # Tell the user this has skipped
rc_status -s rc_status -s
exit 5 exit 5
fi fi
# Set default in case of missing sysconfig file ATFTP_LOG_FILE="/var/log/atftpd/atftp.log"
ATFTPD_USE_INETD=yes ATFTP_LOG_DIR="$(dirname ${ATFTP_LOG_FILE})"
ATFTPD_OPTIONS="" ATFTP_PID_DIR="/var/run/atftpd"
if [ -f /etc/sysconfig/atftpd ]; then
. /etc/sysconfig/atftpd
fi
if [ "$ATFTPD_USE_INETD" = "yes" ]; then # check for sysconfig file
exit 0; [ -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 fi
case "$1" in case "$1" in
start) start)
if [ -n "$ATFTPD_BIND_ADDRESSES" ]; then set_perm "${ATFTP_USR}"
for IP in $ATFTPD_BIND_ADDRESSES; do if [ -n "$ATFTP_BIND" ]; then
echo -n "Starting Advanced Trivial FTP server on $IP" for IP in $ATFTP_BIND; do
startproc -p "/var/run/atftpd/$IP.pid" -f $ATFTPD_BIN --pidfile "/var/run/atftpd/$IP.pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY --bind-address $IP echo -n "Starting Advanced Trivial FTP server on $IP: "
rc_status -v ## Start daemon with startproc(8). If this fails
done ## 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 else
echo -n "Starting Advanced Trivial FTP server" echo -n "Starting Advanced Trivial FTP server: "
startproc $ATFTPD_BIN --pidfile "/var/run/atftpd/pid" $ATFTPD_OPTIONS $ATFTPD_DIRECTORY ## 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 rc_status -v
fi fi
;; ;;
stop) stop)
echo -n "Stopping Advanced Trivial FTP server" echo -n "Stopping Advanced Trivial FTP server: "
killproc -TERM $ATFTPD_BIN killproc -TERM $ATFTP_BIN
rc_status -v
# Remember status and be verbose # Remember status and be verbose
# rc_status -v rc_status -v
;; ;;
try-restart) try-restart)
## Do a restart only if the service was active before. ## Do a restart only if the service was active before.
@ -105,8 +135,39 @@ case "$1" in
# Remember status and be quiet # Remember status and be quiet
rc_status 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) status)
echo -n "Checking for service atftp:" echo -n "Checking for Advanced Trivial FTP server: "
## Check status with checkproc(8), if process is running ## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0. ## checkproc will return with exit status 0.
@ -117,11 +178,13 @@ case "$1" in
# 3 - service not running # 3 - service not running
# NOTE: checkproc returns LSB compliant status values. # NOTE: checkproc returns LSB compliant status values.
checkproc $ATFTPD_BIN checkproc $ATFTP_BIN
# Remember status and be verbose
rc_status -v 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 exit 1
;; ;;
esac 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 ## Path: Network/FTP/Atftpd
## Description: ATFTP Configuration ## Description: ATFTP Configuration
## Type: string ## 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
# #
ATFTPD_OPTIONS="--daemon " ATFTPD_OPTIONS=""
## Type: yesno ## Type: yesno
## Default: no ## Default: no
# #
# Use inetd instead of daemon # Use inetd instead of daemon
# #
ATFTPD_USE_INETD="no" ATFTPD_USE_INETD=""
## Type: string ## 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. # 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 ## Type: string
## Default: "" ## Default: ""