#!/usr/bin/env bash
#
# Copyright (C) 2003 VA Linux Systems Japan, K.K. All rights reserved.
#
# LICENSE NOTICE
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU 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.
#

eval `ultrapossum-config init`
trap "eval `ultrapossum-config term`" 0

configou=config

cat <<EOF
dn: ou=$configou,$SUFFIX
objectClass: organizationalUnit
ou: $configou

EOF

ultrapossum-config get `ultrapossum-config variable -l | egrep "^p " | cut -d' ' -f2` | while read l
  do
    t="`echo $l | cut -d= -f1`"
  cat <<EOF
dn: cn=$t,ou=$configou,$SUFFIX
objectClass: device
cn: $t
EOF

  if test "${!t}" != ""; then
    echo "description: ${!t}"
  fi

  echo
done


