コード例 #1
0
  private void showIfcfg(String aHost, String aInterfaceName) {
    THost host = dao.getHostByName(aHost);
    TInterface iface = findInterface(host, aInterfaceName);

    Printer.out("# %s", aHost + " " + aInterfaceName);

    ShellFilePrinter printer = new ShellFilePrinter("/etc/network/interfaces.d/" + aInterfaceName);
    printer.out("auto %s", aInterfaceName);
    printer.out("iface %s inet static", aInterfaceName);
    printer.out("address %s", findIpAddress(host, aInterfaceName));
    printer.out("netmask %s", iface.getLongNetmask());
    printer.out("gateway %s", host.gw);
    printer.close();
  }
コード例 #2
0
 private void createHostname(String aHost) {
   Printer.out("hostname " + aHost);
   ShellFilePrinter printer = new ShellFilePrinter("/etc/hostname");
   printer.out(aHost);
   printer.close();
 }