#!/bin/sh
#  Copyright 2007, One Laptop per Child
#  Author: Nelson Elhage
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# create_registration
# This script creates a new database for the registration server
#
sqlite3 /home/idmgr/identity.db "CREATE TABLE laptops ( serial VARCHAR(20) NOT NULL, nickname VARCHAR(200) NOT NULL, full_name VARCHAR(100) NOT NULL, pubkey TEXT NOT NULL, uuid VARCHAR(100), lastmodified TEXT DEFAULT '1970-11-12 12:34:56', PRIMARY KEY (serial) )"

[ -x /home/idmgr/storage_format_version ] || echo 2 > /home/idmgr/storage_format_version