3 # OpenXPKI Configuration Script
5 # Written by Martin Bartosch for the OpenXPKI project 2006
6 # Copyright (c) 2006 by The OpenXPKI Project
9 CFG
="bin/openxpki-metaconf"
12 TEMPLATEDIR
="$CONFDIR/templates"
20 Usage: configure [OPTIONS]
22 Prepare OpenXPKI for installation.
25 --help display this help text and exit
26 --prefix set installation prefix (Default: $PREFIX)
27 --distonly Use before 'make dist'. Creates specially reduced Makefile.
28 -- all options following -- are passed to openxpki-metaconf
30 This script prepares the OpenXPKI deployment environment for installation
33 Example 1 - regular install from distribution:
35 ./configure --prefix /usr/local
39 Example 2 - prepare distribution tarball:
40 ./configure --distonly
49 # check infrastructure
51 # TODO: we should check non-standard modules used in the openxpki[adm|ctl]
53 echo "Checking required OpenXPKI Perl modules..."
54 for module
in OpenXPKI OpenXPKI
::Client
; do
56 if perl
-e "use $module;" >/dev
/null
2>&1 ; then
64 if [ "$ERRORS" != "0" ] ; then
65 echo "Pre-installation check found errors."
66 echo "Please install the missing Perl modules before proceeding."
72 if [ "$UNAME" == "SunOS" ]; then
73 # Solaris does not support id -nu/-ng, extract usernames manually
74 USER
=`id|perl -n -e 's/.*uid=[0-9]+\(([a-z0-9]+)\).*/$1/; print $_'`;
75 GROUP
=`id|perl -n -e 's/.*gid=[0-9]+\(([a-z0-9]+)\).*/$1/; print $_'`;
77 # we are on a "sane" system :-)
84 if [ "$USER" != "root" ] ; then
85 echo "Preparing for non-root installation (user: $USER, group: $GROUP)"
91 [ -n "$RUNUSER" ] && METACONF_OPTS
="$METACONF_OPTS --setcfg server.runuser=$RUNUSER"
92 [ -n "$RUNGROUP" ] && METACONF_OPTS
="$METACONF_OPTS --setcfg server.rungroup=$RUNGROUP"
93 METACONF_OPTS
="$METACONF_OPTS --setcfg server.admuser=$ADMUSER"
94 METACONF_OPTS
="$METACONF_OPTS --setcfg server.admgroup=$ADMGROUP"
96 while [ -n "$1" ] ; do
113 METACONF_OPTS
="$METACONF_OPTS $*"
114 echo "Additional options to openxpki-metaconf: '$*'"
118 echo "Unrecognized option $1"
124 BASH_SHELL
=`which bash`
126 if [ "${DIST_ONLY}" != "0" ] ; then
127 # Use "," as delimeter symbol when calling sed
128 # change "[% shell.bash %]" line into actual path to bash
129 # Keep initial file under the name Makefile.in
130 sed -e "s,\[\% shell.bash \%\],$BASH_SHELL,g" < Makefile.
in > Makefile
132 echo "Specially reduced Makefile created. You may now prepare distribution tarball by running command:"
137 echo "Configuring for installation in $PREFIX..."
138 # create initial configuration with new prefix
139 for TEMPLATE
in $TEMPLATEDIR/* ; do
140 echo "Creating template set configuration in $TEMPLATE"
141 if [ -d $TEMPLATE ] ; then
142 $CFG --config $TEMPLATE/openxpki.conf.
in \
143 --writecfg $TEMPLATE/openxpki.conf \
145 --setcfg dir.prefix
="$PREFIX" \
150 echo "Creating Makefile..."
151 $CFG --config $TEMPLATEDIR/default
/openxpki.conf \
152 --setcfg shell.bash
="$BASH_SHELL" \
153 --file Makefile.
in >Makefile
156 echo "Initial configuration complete. You may now run"
159 echo "(g)make install"
161 echo "in order to build and install the OpenXPKI administrative environment."