Obsolete Releases > SME 8.x Contribs

ThinClient & TFTP Server remap - feature needed

(1/1)

beckynet:
In order to boot WinPE with PXE a remaping is necessary


--- Quote ---~]# nano /tftpboot/tftpd.remap

rg \\   /
r \Boot\BCD     /Boot/BCD
r \Boot\Fonts\wgl4_boot.ttf     /Boot/Fonts/wgl4_boot.ttf
r \Boot\boot.sdi        /Boot/boot.sdi

--- End quote ---

Unfortunately the smeserver-tftp-server has no remaping entry.


--- Quote ---~]# config show tftpd
tftpd=service
    UDPPort=69
    access=private
    directory=/tftpboot
    log=normal
    privilege=r
    status=disabled
    timeout=normal
    user=root

--- End quote ---

As a workaround I add a reference in the db.


--- Quote ---~]# config setprop tftpd remap /tftpboot/tftpd.remap
~]# config show tftpd
tftpd=service
    UDPPort=69
    access=private
    directory=/tftpboot
    log=normal
    privilege=r
    remap=/tftpboot/tftpd.remap
    status=disabled
    timeout=normal
    user=root

--- End quote ---

This is not the cleanest method, but I edit the file /service/tftpd/run


--- Quote ---~]# nano /service/tftpd/run

#!/bin/bash

#db configuration show tftpd
#Database: configuration
#Key: tftpd
#PROP: status   VALUES: enabled/disabled
#PROP: access   VALUES: private/public/localhost
#PROP: log      VALUES: normal/verbose/disabled
#PROP: user     VALUES: root/nobody                     (or any other valid user)
#PROP: privelege VALUES: ro/rw
#PROP: timeout:         VALUES: default/300                     (secounds, 900 is the default)
#PROP: UDPPort: VALUES: 69
#PROP: directory VALUES: /tftpboot                      (or any other directory)

TFTPD_STATUS=$(/sbin/e-smith/db configuration getprop tftpd status);
if [ $TFTPD_STATUS == "enabled" ]; then
    TFTPD_ACCESS=$(/sbin/e-smith/db configuration getprop tftpd access);
    TFTPD_LOG=$(/sbin/e-smith/db configuration getprop tftpd log);
    TFTPD_USER=$(/sbin/e-smith/db configuration getprop tftpd user);
    TFTPD_PRIVILEGE=$(/sbin/e-smith/db configuration getprop tftpd privilege);
    TFTPD_TIMEOUT=$(/sbin/e-smith/db configuration getprop tftpd timeout);
    TFTPD_UDPPORT=$(/sbin/e-smith/db configuration getprop tftpd UDPPort);
    TFTPD_DIRECTORY=$(/sbin/e-smith/db configuration getprop tftpd directory);
    TFTPD_REMAP=$(/sbin/e-smith/db configuration getprop tftpd remap);

    if [ $TFTPD_ACCESS == "public" ]; then
        TFTPD_ACCESS_SETTING='0.0.0.0';
    elif [ $TFTPD_ACCESS == "private" ]; then
        TFTPD_ACCESS_SETTING=$(/sbin/e-smith/db configuration get LocalIP);
    else
        TFTPD_ACCESS_SETTING='127.0.0.1';
    fi

    if [ $TFTPD_LOG == "verbose" ]; then
        TFTPD_LOG_SETTING='-vv';
    elif [ $TFTPD_LOG == "normal" ]; then
        TFTPD_LOG_SETTING='-v';
    fi

    if [ $TFTPD_PRIVILEGE == "rw" ]; then
        TFTPD_PRIVILEGE_SETTING='-c';
    fi

    if [ $TFTPD_TIMEOUT != "default" ]; then
        TFTPD_TIMEOUT_SETTING="-t $TFTPD_TIMEOUT";
    fi

    cd /
    exec 2>&1
    exec    udpsvd      -h $TFTPD_LOG_SETTING -u$TFTPD_USER \
                        $TFTPD_ACCESS_SETTING $TFTPD_UDPPORT \
            in.tftpd    $TFTPD_LOG_SETTING $TFTPD_PRIVILEGE_SETTING \
                        -u $TFTPD_USER $TFTPD_TIMEOUT_SETTING -s $TFTPD_DIRECTORY -m $TFTPD_REMAP
else
    /usr/bin/runsvctrl down .
fi

--- End quote ---

Now you must restart tftpd


--- Quote ---~]# /etc/init.d/supervise/tftpd restart

--- End quote ---

The problem is that this change does not support the upgrade.

If anyone has a solution to make this a permanent feature. Or maybe add it in the new feature of smeserver-tftp-server

beckynet

ReetP:

--- Quote from: beckynet on July 14, 2013, 03:01:49 PM ---In order to boot WinPE with PXE a remaping is necessary

Unfortunately the smeserver-tftp-server has no remaping entry.

--- End quote ---

Hi,

please add it to the bug tracker here and you may find it gets implemented, or you could supply a patch yourself that might get included. The more you do, the more likely it will happen !!!! :-)

Go here and add your bug under sme-tftp-server

http://bugs.contribs.org/enter_bug.cgi?product=SME%20Contribs

I think the rpm needs the following :

new db default :
/etc/e-smith/db/configuration/defaults/tftpd/remap

containing :
/tftpboot/tftpd.remap


Your mod gives a diff something like this :

[root@home tmp]# diff -rupN run run.new
--- run   2006-01-21 13:56:00.000000000 +0100
+++ run.new   2013-08-02 13:28:22.000000000 +0200
@@ -21,6 +21,7 @@ if [ $TFTPD_STATUS == "enabled" ]; then
     TFTPD_TIMEOUT=$(/sbin/e-smith/db configuration getprop tftpd timeout);
     TFTPD_UDPPORT=$(/sbin/e-smith/db configuration getprop tftpd UDPPort);
     TFTPD_DIRECTORY=$(/sbin/e-smith/db configuration getprop tftpd directory);
+    TFTPD_REMAP=$(/sbin/e-smith/db configuration getprop tftpd remap);
     
     if [ $TFTPD_ACCESS == "public" ]; then
    TFTPD_ACCESS_SETTING='0.0.0.0';
@@ -49,7 +50,7 @@ if [ $TFTPD_STATUS == "enabled" ]; then
     exec    udpsvd   -h $TFTPD_LOG_SETTING -u$TFTPD_USER \
          $TFTPD_ACCESS_SETTING $TFTPD_UDPPORT \
            in.tftpd    $TFTPD_LOG_SETTING $TFTPD_PRIVILEGE_SETTING \
-         -u $TFTPD_USER $TFTPD_TIMEOUT_SETTING -s $TFTPD_DIRECTORY
+         -u $TFTPD_USER $TFTPD_TIMEOUT_SETTING -s $TFTPD_DIRECTORY -m $TFTPD_REMAP
 else
     /usr/bin/runsvctrl down .
 fi


HOWEVER, it MAY need to check for the presence of the remap as a db entry (I am not sure what happens if there is no entry and guess it would fail so you might need something like this) :

[root@home tmp]# diff -rupN run run.new
--- run   2006-01-21 13:56:00.000000000 +0100
+++ run.new   2013-08-02 13:32:45.000000000 +0200
@@ -21,6 +21,7 @@ if [ $TFTPD_STATUS == "enabled" ]; then
     TFTPD_TIMEOUT=$(/sbin/e-smith/db configuration getprop tftpd timeout);
     TFTPD_UDPPORT=$(/sbin/e-smith/db configuration getprop tftpd UDPPort);
     TFTPD_DIRECTORY=$(/sbin/e-smith/db configuration getprop tftpd directory);
+    TFTPD_REMAP=$(/sbin/e-smith/db configuration getprop tftpd remap);
     
     if [ $TFTPD_ACCESS == "public" ]; then
    TFTPD_ACCESS_SETTING='0.0.0.0';
@@ -46,10 +47,17 @@ if [ $TFTPD_STATUS == "enabled" ]; then
 
     cd /
     exec 2>&1
-    exec    udpsvd   -h $TFTPD_LOG_SETTING -u$TFTPD_USER \
+   
+    if [ $TFTPD_REMAP == "" ]; then
+        exec    udpsvd   -h $TFTPD_LOG_SETTING -u$TFTPD_USER \
          $TFTPD_ACCESS_SETTING $TFTPD_UDPPORT \
            in.tftpd    $TFTPD_LOG_SETTING $TFTPD_PRIVILEGE_SETTING \
          -u $TFTPD_USER $TFTPD_TIMEOUT_SETTING -s $TFTPD_DIRECTORY
+    else
+       exec    udpsvd   -h $TFTPD_LOG_SETTING -u$TFTPD_USER \
+         $TFTPD_ACCESS_SETTING $TFTPD_UDPPORT \
+           in.tftpd    $TFTPD_LOG_SETTING $TFTPD_PRIVILEGE_SETTING \
+         -u $TFTPD_USER $TFTPD_TIMEOUT_SETTING -s $TFTPD_DIRECTORY -m $TFTPD_REMAP
 else
     /usr/bin/runsvctrl down .
 fi



Note that my coding skills are extremely limited so the above needs comprehensively checking and testing !!!!! I am sure that the package maintainer will help you on the bug tracker.

B. Rgds
John

Navigation

[0] Message Index

Go to full version