SyntaxHighlighter

2015年6月5日星期五

Enable UTF-8 support for linkstation

Add LANG=en_US.UTF-8 in /root/.bashrc

-------------------
proftpd fix

1. create /root/ftpd.sh according to /etc/init.d/ftpd.sh
add function
force_utf8()
{
        if [ -f /etc/proftpd/proftpd.conf ]; then
                cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.original
                sed -i -e 's/CP936/UTF-8/g' /etc/proftpd/proftpd.conf
        fi
        sync
        sleep 1
}

add force_utf8 call in start()

#! /bin/sh
#

KIND="FTPD"
FTPDOPTIONS=
RETVAL=0

if [ -f /etc/melco/info ]; then
        . /etc/melco/info
fi

configure()
{
        if [ -f /etc/linkstation_release ]; then
                ## configure files from Buffalo parameters.
                echo "configure ftpd"
                /usr/local/sbin/nas_configgen -c proftpd
                if [ $? -ne 0 ]; then
                        echo "$0 configure fail"
                        exit 1
                fi
        fi
        sync
        sleep 1
}

force_utf8()
{
        if [ -f /etc/proftpd/proftpd.conf ]; then
                cp /etc/proftpd/proftpd.conf /etc/proftpd/proftpd.conf.original
                sed -i -e 's/CP936/UTF-8/g' /etc/proftpd/proftpd.conf
        fi
        sync
        sleep 1
}

start()
{
        if [ "$ftp" != "on" ] ; then
                echo "ftp is OFF"
                exit 0
        fi
        configure
        force_utf8
        echo -n $"Starting $KIND services: "
        /usr/local/sbin/proftpd $FTPDOPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ftpd || \
           RETVAL=1
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $KIND services: "
        killall proftpd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ftpd
        echo ""
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading proftpd.conf file: "
        killall -HUP proftpd
        RETVAL=$?
        echo
        return $RETVAL
}

#
# Usage statement.
#

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart)
                restart
                ;;
        reload)
                reload
                ;;
        *)
                echo "usage: $0 {start|stop|restart|reload}"
                exit 1
                ;;
esac



2. create S99_fix_ftp.sh in /etc/rc.d/extensions.d
and chmod +x S99_fix_ftp.sh
root@ls-qvl:/etc/rc.d/extensions.d# cat S99_fix_ftp.sh
#! /bin/sh
#

/bin/cp /root/ftpd.sh /etc/init.d/ftpd.sh
/etc/init.d/ftpd.sh restart

没有评论:

发表评论