/usr/share/migrationtools/migrate_all_offline.sh is in migrationtools 47-8ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | #!/bin/sh
#
# $Id: migrate_all_offline.sh,v 1.15 2004/09/24 05:49:09 lukeh Exp $
#
# Copyright (c) 1997-2003 Luke Howard.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Luke Howard.
# 4. The name of the other may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE LUKE HOWARD ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL LUKE HOWARD BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#
# Migrate all entities from flat files.
#
# Make sure that you configure migrate_common.ph to suit
# your site's X.500 naming context and DNS mail domain;
# the defaults may not be correct.
#
# Luke Howard <lukeh@padl.com> April 1997
#
DB="$(mktemp -t nis.ldif.XXXXXXXXXX)" || {
echo "Can't create temporary file" >&2
exit 1
}
if [ "X$ETC_ALIASES" = "X" ]; then
ETC_ALIASES=/etc/aliases
fi
#if [ "X$ETC_FSTAB" = "X" ]; then
# ETC_FSTAB=/etc/fstab
#fi
if [ "X$ETC_HOSTS" = "X" ]; then
ETC_HOSTS=/etc/hosts
fi
if [ "X$ETC_NETWORKS" = "X" ]; then
ETC_NETWORKS=/etc/networks
fi
if [ "X$ETC_PASSWD" = "X" ]; then
ETC_PASSWD=/etc/passwd
fi
if [ "X$ETC_GROUP" = "X" ]; then
ETC_GROUP=/etc/group
fi
if [ "X$ETC_SERVICES" = "X" ]; then
ETC_SERVICES=/etc/services
fi
if [ "X$ETC_PROTOCOLS" = "X" ]; then
ETC_PROTOCOLS=/etc/protocols
fi
if [ "X$ETC_RPC" = "X" ]; then
ETC_RPC=/etc/rpc
fi
if [ "X$ETC_NETGROUP" = "X" ]; then
ETC_NETGROUP=/etc/netgroup
fi
# saves having to change #! path in each script
if [ "X$PERL" = "X" ]; then
if [ -x /usr/bin/perl ]; then
PERL="/usr/bin/perl"
elif [ -x /usr/local/bin/perl ]; then
PERL="/usr/local/bin/perl"
else
echo "Can't find Perl!"
exit 1
fi
fi
if [ "X$LDIF2LDBM" = "X" ]; then
if [ -x /usr/local/etc/ldif2ldbm ]; then
LDIF2LDBM="/usr/local/etc/ldif2ldbm"
elif [ -x /usr/local/sbin/ldif2ldbm ]; then
LDIF2LDBM="/usr/local/sbin/ldif2ldbm"
elif [ -x /usr/sbin/ldif2ldbm ]; then
LDIF2LDBM="/usr/sbin/ldif2ldbm"
elif [ -x "$NSHOME/bin/slapd/server/ns-slapd" ]; then
LDIF2LDBM="$NSHOME/bin/slapd/server/ns-slapd ldif2db -f $NSHOME/slapd-$serverID"
elif [ -x /usr/iplanet/servers/bin/slapd/server/dsimport ]; then
LDIF2LDBM="/usr/iplanet/servers/bin/slapd/server/dsimport"
fi
fi
if [ "X$SLAPADD" = "X" ]; then
if [ -x /usr/local/sbin/slapadd ]; then
SLAPADD="/usr/local/sbin/slapadd"
elif [ -x /usr/sbin/slapadd ]; then
SLAPADD="/usr/sbin/slapadd"
fi
fi
if [ "X$LDIF2LDBM" = "X" ] && [ "X$SLAPADD" = "X" ]; then
echo "Can't find ldif2ldbm or slapadd!"
exit 2
fi
echo "Creating naming context entries..."
$PERL migrate_base.pl > $DB
echo "Migrating aliases..."
$PERL migrate_aliases.pl $ETC_ALIASES >> $DB
#echo "Migrating fstab..."
#$PERL migrate_fstab.pl $ETC_FSTAB >> $DB
echo "Migrating groups..."
$PERL migrate_group.pl $ETC_GROUP >> $DB
echo "Migrating hosts..."
$PERL migrate_hosts.pl $ETC_HOSTS >> $DB
echo "Migrating networks..."
$PERL migrate_networks.pl $ETC_NETWORKS >> $DB
echo "Migrating users..."
$PERL migrate_passwd.pl $ETC_PASSWD >> $DB
echo "Migrating protocols..."
$PERL migrate_protocols.pl $ETC_PROTOCOLS >> $DB
echo "Migrating rpcs..."
$PERL migrate_rpc.pl $ETC_RPC >> $DB
echo "Migrating services..."
$PERL migrate_services.pl $ETC_SERVICES >> $DB
echo "Migrating netgroups..."
$PERL migrate_netgroup.pl $ETC_NETGROUP >> $DB
echo "Importing into LDAP..."
echo "Migrating netgroups (by user)..."
$PERL migrate_netgroup_byuser.pl $ETC_NETGROUP >> $DB
echo "Migrating netgroups (by host)..."
$PERL migrate_netgroup_byhost.pl $ETC_NETGROUP >> $DB
echo "Preparing LDAP database..."
if [ "X$SLAPADD" = "X" ]; then
$LDIF2LDBM -i $DB
else
$SLAPADD -l $DB
fi
EXITCODE=$?
if [ $EXITCODE -ne 0 ]; then
echo "Migration failed: saving failed LDIF to $DB"
else
rm -f $DB
fi
if [ "X$EXIT" != "Xno" ]; then
exit $EXITCODE
fi
echo "Done."
|