xref: /netbsd-src/external/bsd/openldap/openldap2netbsd (revision 956cbeb4ba655195f7400c7c492f37f32b78ff8d)
12b844459Slukem#! /bin/sh
22b844459Slukem#
3*956cbeb4Schristos#	$NetBSD: openldap2netbsd,v 1.4 2020/08/11 13:15:33 christos Exp $
42b844459Slukem#
52b844459Slukem# Copyright (c) 1998, 1999, 2010 The NetBSD Foundation, Inc.
62b844459Slukem# All rights reserved.
72b844459Slukem#
82b844459Slukem# Redistribution and use in source and binary forms, with or without
92b844459Slukem# modification, are permitted provided that the following conditions
102b844459Slukem# are met:
112b844459Slukem# 1. Redistributions of source code must retain the above copyright
122b844459Slukem#    notice, this list of conditions and the following disclaimer.
132b844459Slukem# 2. Redistributions in binary form must reproduce the above copyright
142b844459Slukem#    notice, this list of conditions and the following disclaimer in the
152b844459Slukem#    documentation and/or other materials provided with the distribution.
162b844459Slukem#
172b844459Slukem# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
182b844459Slukem# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
192b844459Slukem# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
202b844459Slukem# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
212b844459Slukem# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
222b844459Slukem# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
232b844459Slukem# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
242b844459Slukem# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
252b844459Slukem# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
262b844459Slukem# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
272b844459Slukem# POSSIBILITY OF SUCH DAMAGE.
282b844459Slukem#
292b844459Slukem# openldap2netbsd:  convert an openldap source tree into a
302b844459Slukem# netbsd openldap source tree, under src/external/bsd/openldap/dist.
312b844459Slukem#
32*956cbeb4Schristos# cd openldap-X-Y-Z
33*956cbeb4Schristos# cvs -d cvs.netbsd.org:/cvsroot import src/external/bsd/openldap/dist OPENLDAP OPENLDAPX_Y_Z
34*956cbeb4Schristos# configure
35*956cbeb4Schristos# make
36*956cbeb4Schristos# merge config.h with ../include/config.h
37*956cbeb4Schristos# cd ..
38*956cbeb4Schristos# make configure
39*956cbeb4Schristos# make update-include
40*956cbeb4Schristos# make update-man
412b844459Slukem
42915bea73Schristosif [ -z "$1" ]
43915bea73Schristosthen
44915bea73Schristos	echo "Usage: $0 <dir>" 1>&2
45915bea73Schristos	exit 1
46915bea73Schristosfi
47915bea73Schristos
48915bea73Schristosd="$1"
492b844459Slukem
502b844459Slukem### Remove the $'s around RCS tags
51915bea73Schristoscleantags "$d"
522b844459Slukem### Add our NetBSD RCS Id
53915bea73Schristosfind "$d" -name '*.[chly]' -print | while read c; do
54915bea73Schristos	sed 1q < "$c" | grep -q '\$NetBSD' || (
55915bea73Schristossed -i -e '1i \
56*956cbeb4Schristos/*	$NetBSD: openldap2netbsd,v 1.4 2020/08/11 13:15:33 christos Exp $	*/\
57915bea73Schristos
58915bea73Schristos' -e '/#include "portable.h"/i \
59915bea73Schristos#include <sys/cdefs.h>\
60*956cbeb4Schristos__RCSID("$NetBSD: openldap2netbsd,v 1.4 2020/08/11 13:15:33 christos Exp $");\
61915bea73Schristos
62915bea73Schristos' "$c"
632b844459Slukem	)
642b844459Slukemdone
652b844459Slukem
662b844459Slukemecho done
672b844459Slukem
682b844459Slukem### Fixing file and directory permissions.
692b844459Slukemecho "Fixing file/directory permissions."
702b844459Slukem(
712b844459Slukem	cd $d
722b844459Slukem	find . -type f -print | xargs chmod u+rw,go+r
732b844459Slukem	find . -type d -print | xargs chmod u+rwx,go+rx
742b844459Slukem)
752b844459Slukemecho done
762b844459Slukem
772b844459Slukemexit 0
78