insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "up", 0 FROM domains WHERE name = "example.com";
insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns1.example.com", "A", "120", "192.168.2.2", "ns1", 1 FROM domains WHERE name = "example.com";
insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "ns2.example.com", "A", "120", "192.168.2.3", "ns2", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 1 50ea84825288d03bf9ddda0b0b5f8964c6fbafa8", "up", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 2 bf31ef7aea46f2adca7a61fbb0629fb5c24116df0f22ec0115dbc7ebdddee04e", "up", 1 FROM domains WHERE name = "example.com";
-insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "DS", "120", "38674 8 3 6ed18dceaba6d2547f2fc82ba3801fdc919db51b0e44baa261b887c824dd9a2d", "up", 1 FROM domains WHERE name = "example.com";
insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "SOA", "120", "ns1.example.com hostmaster.example.com 2000010101 28800 7200 1209600 120", "", 1 FROM domains WHERE name = "up.example.com";
insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns1.example.com", "", 1 FROM domains WHERE name = "up.example.com";
insert into records (domain_id, name, type, ttl, content, ordername, auth) select id as domain_id, "up.example.com", "NS", "120", "ns2.example.com", "", 1 FROM domains WHERE name = "up.example.com";
--- /dev/null
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use 5.005;
+
+# usage: feed_ds.pl domain parent pdnssec sqdb
+
+my $domain = shift;
+my $parent = shift;
+my $pdnssec = shift;
+my $sqdb = shift;
+
+open IN, "-|", "$pdnssec show-zone $domain 2>&1";
+
+my $recs = [];
+
+while(<IN>) {
+ chomp;
+ if (/DS = (.*) IN DS (.*);/) {
+ # we have data
+
+ push @$recs, [ $1, $2 ]
+ }
+}
+
+for my $rec (@$recs) {
+ my ($name,$value) = @$rec;
+ my $sql = qq(INSERT INTO records (domain_id, name, type, content, ttl, auth) SELECT id, "$name", "DS", "$value", 120, 1 FROM domains WHERE name = "$parent");
+ # then feed data
+ qx(sqlite3 $sqdb '$sql')
+}