Web inteface: nicer system error page, and introduced a bug (OK, a photo of a bug :-)
[openxpki.git] / trunk / package / freebsd / build-dist-and-update-checksums.sh
blobe378c825a354c0354de25758eab87ce9ea244bad
1 #!/bin/sh
2 ##
3 ## Written 2006 by Julia Dubenskaya and Sergei Vyshenski
4 ## for the OpenXPKI project
5 ## (C) Copyright 2006 by The OpenXPKI Project
7 MAJOR_VERSION="0.9"
9 MAIN_DIR=`cd ../../../.. && pwd`
10 MAIN_PORTS_DIR="/usr/ports"
11 PORTS_DIR="${MAIN_DIR}/openxpki/trunk/package/freebsd/${MAIN_PORTS_DIR}"
12 TARBALLS_DIR="${PORTS_DIR}/distfiles/openxpki"
13 MAKE=gmake
14 MV="mv -f"
15 BSD_FILES="bsd.openssl.mk bsd.port.mk bsd.sites.mk"
17 make-clean () {
18 if test -f Makefile; then ${MAKE} clean
20 if test -f Makefile.old; then rm -f *.old
24 if [ -e ${PORTS_DIR}/Mk ]; then
25 if [ -d ${PORTS_DIR}/Mk -o -h ${PORTS_DIR}/Mk ]; then
26 echo "Link or directory ${PORTS_DIR}/Mk already exists";
27 for BSD_FILE in ${BSD_FILES}; do
28 if [ ! -f ${PORTS_DIR}/Mk/${BSD_FILE} ]; then
29 echo "File ${BSD_FILE} is absent from ${PORTS_DIR}/Mk"
30 exit 1
32 done
33 echo "All needed files are present in ${PORTS_DIR}/Mk";
34 else
35 echo "${PORTS_DIR}/Mk exists"
36 echo "but it is not a symbolic link or directory"
37 exit 1
39 else
40 echo "Link directory ${PORTS_DIR}/Mk does not exist";
41 if [ ! -d ${MAIN_PORTS_DIR} ]; then
42 echo "Directory ${MAIN_PORTS_DIR}/Mk does not exist too";
43 echo "Please provide directory ${PORTS_DIR}/Mk with files:"
44 for BSD_FILE in ${BSD_FILES}; do
45 echo "${BSD_FILE}"
46 done
47 exit 1
48 else
49 echo "Soft link ${PORTS_DIR}/Mk will be created"
50 ln -s ${MAIN_PORTS_DIR}/Mk ${PORTS_DIR}/Mk
54 rm -rf ${TARBALLS_DIR}/*
55 rm -rf ${MAIN_DIR}/*.tar.gz
56 rm -rf ${MAIN_DIR}/*.tgz
58 #---------------- SERVER ----------------------
60 SERVER_DIR="openxpki/trunk/perl-modules/core/trunk"
61 TAR_SERVER_DIR="perl_modules"
63 if ! test -d ${MAIN_DIR}/${SERVER_DIR}; then
64 echo "Error: directory ${MAIN_DIR}/${SERVER_DIR} does not exist"
65 exit 1;
68 cd ${MAIN_DIR}/${SERVER_DIR}
70 make-clean
72 perl Makefile.PL && \
73 ${MAKE} dist
75 ${MV} *.gz ${TARBALLS_DIR}/
77 make-clean
79 #---------------- CLIENTS ----------------------
81 CLIENTS_COMMON_DIR="openxpki/trunk/clients/perl"
82 CLIENTS="OpenXPKI-Client \
83 OpenXPKI-Client-HTML-Mason \
84 OpenXPKI-Client-SCEP"
86 for CLIENT_NAME in ${CLIENTS}
88 CLIENT_DIR=${MAIN_DIR}/${CLIENTS_COMMON_DIR}/${CLIENT_NAME}
89 if test -d ${CLIENT_DIR}; then
90 echo =================================================================
91 echo fixing directory: ${CLIENT_DIR}
92 echo =================================================================
93 cd ${CLIENT_DIR}
94 make-clean
95 perl Makefile.PL
96 ${MAKE} dist
97 ${MV} *.gz ${TARBALLS_DIR}/
98 make-clean
100 done
102 #---------------- DEPLOYMENT----------------------
104 COMMON_DIR="openxpki/trunk"
105 OTHER_DIRS="deployment"
107 for DIR in ${OTHER_DIRS}
109 cd ${MAIN_DIR}/${COMMON_DIR}/${DIR}
110 make-clean
111 ./configure --distonly
112 ${MAKE} dist
113 ${MV} *.gz ${TARBALLS_DIR}/
114 make clean
115 done
117 #---------------- i18n ----------------------
119 COMMON_DIR="openxpki/trunk"
120 OTHER_DIRS="i18n"
122 for DIR in ${OTHER_DIRS}
124 cd ${MAIN_DIR}/${COMMON_DIR}/${DIR}
125 make-clean
126 ${MAKE} dist
127 ${MV} *.gz ${TARBALLS_DIR}/
128 make clean
129 done
131 #---------------- Makefile for port ----------------------
133 PORTS_PREFIX="p5-"
134 PORTS="openxpki openxpki-client openxpki-client-html-mason openxpki-client-scep openxpki-i18n openxpki-deployment"
136 cd ${PORTS_DIR}
137 MODIFIED_PORTS=0
139 for PORT in ${PORTS}; do
140 cd ${TARBALLS_DIR}
141 TARBALL_NAME=`find . -iname ${PORT}-${MAJOR_VERSION}.*.gz | sed -e "s/\.\///"`
142 PORT_NAME=`echo ${TARBALL_NAME} | sed -e "s/\(^.*\)-${MAJOR_VERSION}\..*\.tar\.gz/\1/"`
143 NEW_MINOR_VERSION=`echo ${TARBALL_NAME} | sed -e "s/${PORT_NAME}-${MAJOR_VERSION}\.\(.*\)\.tar\.gz/\1/"`
144 PORT_MAKEFILE="${PORTS_DIR}/security/${PORTS_PREFIX}${PORT}/Makefile"
145 PREV_MINOR_VERSION=`grep "PORTVERSION=" ${PORT_MAKEFILE} | sed -e "s/PORTVERSION= ${MAJOR_VERSION}\.\(.*$\)/\1/"`
146 if [ ${NEW_MINOR_VERSION} != ${PREV_MINOR_VERSION} ]; then
147 MODIFIED_PORTS=`expr ${MODIFIED_PORTS} + 1`
148 echo "${MODIFIED_PORTS}.Updating port ${PORTS_PREFIX}${PORT}: previous version = ${PREV_MINOR_VERSION}, new version = ${NEW_MINOR_VERSION}."
149 sed \
150 -e "s/\(PORTVERSION= ${MAJOR_VERSION}\.\).*$/\1${NEW_MINOR_VERSION}/" \
151 -e "s/${PORT_NAME}-${MAJOR_VERSION}\..*\.gz/${TARBALL_NAME}/" -i .bak ${PORT_MAKEFILE}
153 cd ${PORTS_DIR}/security/${PORTS_PREFIX}${PORT}/
154 make makesum PORTSDIR=${PORTS_DIR}
155 else
156 rm -rf ${TARBALLS_DIR}/${TARBALL_NAME}
158 done
160 echo Your TARBALLS have gone into directory ${TARBALLS_DIR}
161 echo "Makefile and distinfo files modified in ${MODIFIED_PORTS} ports in directory ${PORTS_DIR}/security/"
163 exit