#! /bin/sh # $NetBSD: heimdal2netbsd,v 1.12 2008/03/22 13:08:21 mlelstv Exp $ if [ \! -f kuser/kinit.c ]; then echo "`basename $0`: should be run in top src directory" 1>&2 exit 1 fi if ! type perl > /dev/null 2>&1 ; then echo "`basename $0`: you need perl to run this" 1>&2 exit 1 fi echo 'Removing saved orig files.' find . -name '*~' | xargs rm -f echo 'Removing preformatted man pages.' find . -name '*.cat[1358]' | xargs rm -f rm doc/heimdal.info doc/hx509.info echo 'Fixing .Os in man pages.' update_man() { echo " fixing $1 leaving old file in $1~" mv $1 $1~ < $1~ > $1 \ sed -e 's,\.Os HEIMDAL,.Os,' \ -e 's,\.Pa krb5.h,.Pa krb5/krb5.h,' \ -e 's,\.In krb5.h,.In krb5/krb5.h,' \ -e 's,\.Pa gssapi.h,.Pa gssapi/gssapi.h,' \ -e 's,\.In gssapi.h,.In gssapi/gssapi.h,' \ -e 's,#include <krb5.h>,#include <krb5/krb5.h>,' } for f in `find . -name '*.[1358]'`; do update_man $f done echo 'Changing CVS Id tags to Heimdal tags.' perl -i~ -p -e ' s,RCSID *\("\$Id([^\$]*)\$"\),__RCSID("\$Heimdal\1\$"\n "\$NetBSD\$"),; s,/\* \$Id([^\$]*)\$ \*/,/* \$Heimdal\1\$\n \$NetBSD\$ */,; s,# \$Id([^\$]*)\$,# \$Heimdal\1\$\n# \$NetBSD\$,; s,\.\\" \$Id([^\$]*)\$,.\\" \$Heimdal\1\$\n.\\" \$NetBSD\$,; s,dnl \$Id([^\$]*)\$,dnl \$Heimdal\1\$\ndnl \$NetBSD\$,; ' `find . -type f` echo 'Inlining <krb5-types.h>' perl -i~ -p -e ' s{#include <krb5-types.h>} {#ifndef __krb5_types_h__ #define __krb5_types_h__ #include <sys/types.h> #include <inttypes.h> #include <sys/socket.h> typedef socklen_t krb5_socklen_t; typedef ssize_t krb5_ssize_t; #endif} ' lib/gssapi/gssapi/gssapi.h \ lib/krb5/krb5.h \ lib/krb5/krb5_ccapi.h echo 'Fixing up include paths:' update_inc() { echo " fixing $1 leaving old file in $1~" mv $1 $1~ < $1~ > $1 \ sed -e 's,#include <asn1_err.h>,#include <krb5/asn1_err.h>,' \ -e 's,#include <krb5_err.h>,#include <krb5/krb5_err.h>,' \ -e 's,#include <heim_err.h>,#include <krb5/heim_err.h>,' \ -e 's,#include <k524_err.h>,#include <krb5/k524_err.h>,' \ -e 's,#include <krb5_asn1.h>,#include <krb5/krb5_asn1.h>,' \ -e 's,#include <hdb-protos.h>,#include <krb5/hdb-protos.h>,' \ -e 's,#include <krb5-protos.h>,#include <krb5/krb5-protos.h>,' \ -e 's,#include <com_right.h>,#include <krb5/com_right.h>,' \ -e 's,#include <gssapi.h>,#include <gssapi/gssapi.h>,' \ -e 's,#include <sl.h>,#include <krb5/sl.h>,' } update_inc lib/krb5/krb5.h update_inc lib/hdb/hdb.h update_inc lib/com_err/com_err.h update_inc lib/sl/ss.h update_inc lib/gssapi/gssapi/gssapi_spnego.h echo 'Fixup toupper usage' perl -i~ -p -e ' s,toupper\(,toupper((unsigned char), ' lib/hcrypto/imath/imath.c echo 'Fixup PACKAGE_BUGREPORT' perl -i~ -p -e ' s,.*PACKAGE_BUGREPORT.*,#ifdef PACKAGE_BUGREPORT\n$&\n#endif, ' lib/vers/print_version.c echo 'commands to run:' echo ' ( cd admin; slc ktutil-commands.in )' echo ' ( cd kadmin; slc kadmin-commands.in )' echo ' ( cd kuser; slc kdigest-commands.in )' echo ' ( cd lib/gssapi; slc gss-commands.in )' echo ' ( cd lib/hx509; slc hxtool-commands.in )' echo ' ( cd lib/kadm5; slc iprop-commands.in )' echo 'Remember to update files in src/include/heimdal/.' exit 0