ProFTPd

From DD-WRT Wiki

Revision as of 16:25, 10 July 2007 by ZuiYxt (Talk | contribs)
Jump to: navigation, search

by mcpat

Requirements

First be sure that you have enough memory free. Because of this I describe the installation on SD-cards (/mmc). Additionally this procedure will show how to install even the needed ipkg packages on the SD-card.

It is also possible to replace every occurances of (/mmc) with (/jffs) if you have it enabled.

Preparation

Install first optware!

Then install xinetd

Then install proftpd

Installing optware

Installing optware

Make folder 'opt' in mmc:

mkdir /mmc/opt

Mounten von '/mmc/opt' with '/opt':

mount -o bind /mmc/opt /opt

Save script 'optware-pre-install.sh' to /opt, change rights to 755

Starting Script:

/opt/optware-pre-install.sh

optware-pre-install.sh:

#!/bin/sh
# Optware pre-installation script, Leon Kos 2006
 
REPOSITORY=http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable
TMP=/tmp
 
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin
unset LD_PRELOAD
unset LD_LIBRARY_PATH
 
_check_config()
{
    echo "Checking system config ..."
    GATEWAY=$(netstat -rn |
        sed -n 's/^0.0.0.0[ \t]\{1,\}\([0-9.]\{8,\}\).*/\1/p' )
    if [ -n "${GATEWAY}" ]; then
        echo "Using ${GATEWAY} as default gateway."
    else
        echo "Error: No default gateway set!"
        exit 2
    fi
    if [ -s /etc/resolv.conf ]; then
        echo "Using the following nameserver(s):"
        if grep nameserver /etc/resolv.conf ; then
            GATEWAY_SUBNET=$(echo "${GATEWAY}" |
                sed 's/\.[0-9]\{1,3\}\.[0-9]\{1,3\}$//')
            if [ "${GATEWAY_SUBNET}" = "192.168" ]; then
                if grep -q ${GATEWAY} /etc/resolv.conf ; then
                    echo "Gateway ${GATEWAY} is also nameserver."
                else
                    echo "Warning: local nameserver is different than gateway!"
                    echo "Check config or enter:"
                    if test -L /etc/resolv.conf ; then 
                      echo "  sed -i s/192.168.*/${GATEWAY}/ /tmp/resolv.conf"
                    else
                      echo "  sed -i s/192.168.*/${GATEWAY}/ /etc/resolv.conf"
                    fi
                    echo "to correct this."
                fi
            fi
        else
            echo "Error: No nameserver specified in /etc/resolv.conf"
            exit 5
        fi
    else
        echo "Error: Empty or nonexistent /etc/resolv.conf"
        exit 3
    fi
 
    if mount | grep -q /opt ; then
        [ -d /opt/etc ]