aboutsummaryrefslogtreecommitdiff
path: root/package/tftpd
diff options
context:
space:
mode:
authorGravatar Eric Andersen <andersen@codepoet.org>2005-02-16 21:17:18 +0000
committerGravatar Eric Andersen <andersen@codepoet.org>2005-02-16 21:17:18 +0000
commitcbe260d167497f9b586cee592f024d5299e8e6b3 (patch)
treebfd66e995c2af86c297a3981e4e663fb3757df3f /package/tftpd
parent298bf4d52d269ef8e90f9b9d7ed0edce67dea4f2 (diff)
downloadbuildroot-cbe260d167497f9b586cee592f024d5299e8e6b3.tar.gz
buildroot-cbe260d167497f9b586cee592f024d5299e8e6b3.tar.bz2
HPA's Trivial File Transfer Protocol (tftp) server.
Diffstat (limited to 'package/tftpd')
-rw-r--r--package/tftpd/Config.in6
-rw-r--r--package/tftpd/default-tftpd3
-rwxr-xr-xpackage/tftpd/init-tftpd93
-rw-r--r--package/tftpd/tftpd.mk78
4 files changed, 180 insertions, 0 deletions
diff --git a/package/tftpd/Config.in b/package/tftpd/Config.in
new file mode 100644
index 0000000000..65b17b28d5
--- /dev/null
+++ b/package/tftpd/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_TFTPD
+ bool "tftpd"
+ default n
+ help
+ HPA's Trivial File Transfer Protocol (tftp) server.
+
diff --git a/package/tftpd/default-tftpd b/package/tftpd/default-tftpd
new file mode 100644
index 0000000000..1dce7fdfeb
--- /dev/null
+++ b/package/tftpd/default-tftpd
@@ -0,0 +1,3 @@
+#Defaults for tftpd-hpa
+RUN_DAEMON="yes"
+OPTIONS="-l -s /var/lib/tftpboot"
diff --git a/package/tftpd/init-tftpd b/package/tftpd/init-tftpd
new file mode 100755
index 0000000000..e273c11961
--- /dev/null
+++ b/package/tftpd/init-tftpd
@@ -0,0 +1,93 @@
+#! /bin/sh
+#
+# Author: Jaakko Niemi <liiwi@iki.fi>
+# Modified from skeleton file in sarge
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="HPA's tftpd"
+NAME=in.tftpd
+DAEMON=/usr/sbin/$NAME
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/tftpd-hpa
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+# Read config file if it is present.
+if [ -r /etc/default/tftpd-hpa ]
+then
+ . /etc/default/tftpd-hpa
+fi
+
+if [ "$RUN_DAEMON" = "yes" ] ; then
+ echo "tftpd-hpa disabled in /etc/default/tftpd-hpa"
+ exit 0
+fi
+
+#
+# Function that starts the daemon/service.
+#
+d_start() {
+ start-stop-daemon --start --quiet --exec $DAEMON -- $OPTIONS
+}
+
+#
+# Function that stops the daemon/service.
+#
+d_stop() {
+ start-stop-daemon --stop --quiet --name $NAME
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service.
+#
+d_reload() {
+ start-stop-daemon --stop --quiet --name $NAME --signal 1
+}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ d_stop
+ echo "."
+ ;;
+ #reload)
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ # If the daemon responds to changes in its config file
+ # directly anyway, make this an "exit 0".
+ #
+ # echo -n "Reloading $DESC configuration..."
+ # d_reload
+ # echo "done."
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented, move the "force-reload"
+ # option to the "reload" entry above. If not, "force-reload" is
+ # just the same as "restart".
+ #
+ echo -n "Restarting $DESC: $NAME"
+ d_stop
+ sleep 1
+ d_start
+ echo "."
+ ;;
+ *)
+ # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/package/tftpd/tftpd.mk b/package/tftpd/tftpd.mk
new file mode 100644
index 0000000000..f9a2c9447b
--- /dev/null
+++ b/package/tftpd/tftpd.mk
@@ -0,0 +1,78 @@
+#############################################################
+#
+# tftpd
+#
+#############################################################
+TFTP_HPA_VER:=0.40
+TFTP_HPA_SOURCE:=tftp-hpa-$(TFTP_HPA_VER).tar.bz2
+TFTP_HPA_SITE:=http://www.kernel.org/pub/software/network/tftp/
+TFTP_HPA_DIR:=$(BUILD_DIR)/tftp-hpa-$(TFTP_HPA_VER)
+TFTP_HPA_CAT:=bzcat
+TFTP_HPA_BINARY:=tftpd/tftpd
+TFTP_HPA_TARGET_BINARY:=usr/sbin/in.tftpd
+
+$(DL_DIR)/$(TFTP_HPA_SOURCE):
+ $(WGET) -P $(DL_DIR) $(TFTP_HPA_SITE)/$(TFTP_HPA_SOURCE)
+
+tftpd-source: $(DL_DIR)/$(TFTP_HPA_SOURCE)
+
+$(TFTP_HPA_DIR)/.unpacked: $(DL_DIR)/$(TFTP_HPA_SOURCE)
+ $(TFTP_HPA_CAT) $(DL_DIR)/$(TFTP_HPA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ toolchain/patch-kernel.sh $(TFTP_HPA_DIR) package/tftpd/ tftpd*.patch
+ touch $(TFTP_HPA_DIR)/.unpacked
+
+$(TFTP_HPA_DIR)/.configured: $(TFTP_HPA_DIR)/.unpacked
+ (cd $(TFTP_HPA_DIR); rm -rf config.cache; \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ ./configure \
+ --target=$(GNU_TARGET_NAME) \
+ --host=$(GNU_TARGET_NAME) \
+ --build=$(GNU_HOST_NAME) \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib \
+ --sysconfdir=/etc \
+ --datadir=/usr/share \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ $(DISABLE_LARGEFILE) \
+ --without-tcpwrappers \
+ );
+ touch $(TFTP_HPA_DIR)/.configured
+
+$(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY): $(TFTP_HPA_DIR)/.configured
+ $(MAKE) -C $(TFTP_HPA_DIR)
+
+# This stuff is needed to work around GNU make deficiencies
+$(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY): $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY)
+ @if [ -L $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY) ] ; then \
+ rm -f $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); fi;
+ @if [ ! -f $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) -o $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY) \
+ -ot $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) ] ; then \
+ set -x; \
+ rm -f $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); \
+ cp -a $(TFTP_HPA_DIR)/$(TFTP_HPA_BINARY) $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY); fi ;
+ $(INSTALL) -D -m 0755 package/tftpd/init-tftpd $(TARGET_DIR)/etc/init.d/S80tftpd-hpa
+ $(INSTALL) -D -m 0644 package/tftpd/default-tftpd $(TARGET_DIR)/etc/default/tftpd-hpa
+
+tftpd: uclibc $(TARGET_DIR)/$(TFTP_HPA_TARGET_BINARY)
+
+tftpd-clean:
+ $(MAKE) DESTDIR=$(TARGET_DIR) -C $(TFTP_HPA_DIR) uninstall
+ -$(MAKE) -C $(TFTP_HPA_DIR) clean
+
+tftpd-dirclean:
+ rm -rf $(TFTP_HPA_DIR)
+
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_TFTPD)),y)
+TARGETS+=tftpd
+endif