Monday, January 18, 2010

Dynamic DNS Update on N900

I've created a maemo package to do Dynamic DNS updates each time the N900 connects to the Internet.

Install file here.

I am not sure if automatic install works yet - but do check it out (It does not work right now - need to change section from net to user/net - I will do that tonight).

It does however work by adding the repository and to and "apt-get install ipcheck".

Configuration needs to be created in a terminal (yes - I should do a gui config - but I can't be bothered - any volunteers?).

$ cat /etc/ipcheckrc >.ipcheckrc
$ vi .ipcheckrc

Fill in data for DYNDNS_HOSTNAME, DYNDNS_USER and DYNDNS_PASSWORD.

That's about it.

4 comments:

  1. So - anybody want to help creating a small gui that can edit those 3 values? Can it be done with a small python script?

    ReplyDelete
  2. #!/usr/bin/env python

    import pygtk
    pygtk.require("2.0")
    import gtk
    import ConfigParser
    import xdg
    import xdg.BaseDirectory
    import os
    import errno

    config_name = os.path.join(xdg.BaseDirectory.save_config_path("ipcheck"), "config")

    size_group = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)

    def add_entry(title, box):
    h = gtk.HBox(spacing = 7)
    label = gtk.Label(title)
    size_group.add_widget(label)
    h.pack_start(label, False)
    entry = gtk.Entry()
    h.pack_start(entry, True, True)
    h.show_all()
    box.pack_start(h, False)
    return entry

    dialog = gtk.Dialog()
    vbox = gtk.VBox(spacing = 7)
    vbox.show()
    dialog.vbox.pack_start(vbox, False, False)
    hostname_entry = add_entry("My Hostname (FQDN):", vbox)
    import socket
    hostname_entry.set_text(socket.gethostname())
    username_entry = add_entry("My DynDNS username:", vbox)
    password_entry = add_entry("My DynDNS password:", vbox)
    password_entry.set_visibility(False)
    password_entry.set_activates_default(True)

    dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
    dialog.add_button("Set Up", gtk.RESPONSE_OK)
    dialog.set_default_response(gtk.RESPONSE_OK)

    # load

    config = ConfigParser.ConfigParser()
    def get_config(name, fallback):
    return config.get("DynDNS", name) if config.has_option("DynDNS", name) else fallback

    config.read(config_name)
    if not config.has_section("DynDNS"):
    config.add_section("DynDNS")

    hostname_entry.set_text(get_config("host", hostname_entry.get_text()))
    username_entry.set_text(get_config("user", ""))
    password_entry.set_text(get_config("password", ""))

    if dialog.run() == gtk.RESPONSE_OK:
    config.set("DynDNS", "host", hostname_entry.get_text())
    config.set("DynDNS", "user", username_entry.get_text())
    config.set("DynDNS", "password", password_entry.get_text())
    output_name = "%s.new" % config_name
    output_file = open(output_name, "w")
    try:
    config.write(output_file)
    finally:
    output_file.close()
    os.rename(output_name, config_name)

    ReplyDelete
  3. (unfortunately your blogging software destroyed the comment. So I uploaded the file to
    )

    ReplyDelete
  4. <http://www.scratchpost.org/software/patch/set_up_ipcheck.py>

    ReplyDelete