/**
 * startClient - start pppoe client
 */
var fs=require("fs");
var Promise=require('bluebird');
var execAsync=Promise.promisify(require('child_process').exec);

String.prototype.trim = function() {
    return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

module.exports={
    verifyFun:function(userName,passWord){
        return execAsync("ifconfig").then(function (result) {
            if(result.indexOf("ppp0") > 0)
            {
                console.log("PPPoE session up.");
                return true;
            }
            else
            {
                var data =
                  "noipdefault\n" +
                  "usepeerdns\n" +
                  "defaultroute\n" +
                  "replacedefaultroute\n" +
                  "hide-password\n" +
                  "lcp-echo-interval 20\n" +
                  "lcp-echo-failure 3\n" +
                  "noauth\n" +
                  "persist\n" +
                  "mtu 1442\n" +
                  "noaccomp\n" +
                  "default-asyncmap\n" +
                  "pty \"pppoe -I eth2 -T 80\"\n" +
                  "user \"" + userName + "\"\n";

                var secretData = "\"" + userName + "\"" + " * " + "\"" + passWord + "\"";
                console.log("data:"+data+",secretData:"+secretData);
          
                fs.writeFile('/etc/ppp/peers/provider',data, function(err){
                    if(err) throw err;
                    console.log("write provider.");
                });

                fs.writeFile('/etc/ppp/chap-secrets',secretData,function(err){
                    if(err) throw err;
                    console.log("write chap-secrets.");
                });

                return execAsync('ps -ef|grep pppd').then(function (result) {
                    if (result.indexOf("call provider") > 0)
                    {
                        execAsync("poff -a").then(function (result) {
                        execAsync('pon');
                        console.log("restart");
                        }, function (err) {
                            console.log(err);
                        });
                    }
                    else
                    {
                        execAsync('pon');
                        console.log("start");
                    }
                    return true;
                }, function (err) {
                    console.log(err);
                    return false;
                });
            }
        });    
    }
}
