fix filenam typo
[java-idp.git] / build.xml
index d406824..efcc360 100755 (executable)
--- a/build.xml
+++ b/build.xml
     <target name="package" depends="compile-core" description="Creates the project library jar file.">
         <mkdir dir="${dist.dir}" />
 
-        <if>
-            <equals arg1="${jdk.target}" arg2="1.4" />
-            <then>
-                <java classname="com.rc.retroweaver.Weaver">
-                    <arg value="-source" />
-                    <arg value="${core-classes.dir}" />
-                    <classpath>
-                        <fileset dir="${thirdpaty-lib.dir}">
-                            <include name="**/*.jar" />
-                        </fileset>
-                    </classpath>
-                </java>
-
-                <echo message="**************************************************************" />
-                <echo message="    Remember, you must include the retroweaver-rt jar" />
-                <echo message="    file, located in the thirdparty-lib directory, along with the" />
-                <echo message="    ${jar.name} on your" />
-                <echo message="    classpath in order to use this with JDK 1.4" />
-                <echo message="**************************************************************" />
-
-            </then>
-        </if>
-
         <jar destfile="${dist.dir}/${jar.name}" whenempty="fail">
             <fileset dir="${classpathres.dir}" />
             <zipfileset dir="${metainf.dir}" prefix="META-INF/" />
 
     </target>
 
-    <target name="install" depends="package" description="Installs the identity provider software.">
-        <input message="Where should the Shibboleth Identity Provider software be installed? [default: ${idp.home}]"
-               addproperty="idp.home.input"
-               defaultvalue="${idp.home}" />
-        <var name="idp.home" value="${idp.home.input}" />
-
-        <input message="What is the hostname of the Shibboleth Identity Provider server?" addproperty="idp.hostname" />
-
-        <mkdir dir="${idp.home}" />
-        <mkdir dir="${idp.home}/bin" />
-        <mkdir dir="${idp.home}/conf" />
-        <mkdir dir="${idp.home}/credentials" />
-        <mkdir dir="${idp.home}/lib" />
-        <mkdir dir="${idp.home}/logs" />
-        <mkdir dir="${idp.home}/metadata" />
-        <mkdir dir="${idp.home}/war" />
-
-        <var name="idp.entity.id" value="https://${idp.hostname}/shibboleth" />
-            
-        <regexSplit input="${idp.hostname}" regex="^.*\.(.*\..*$)" addproperty="idp.scope" />
-            
-        <echo message="Generating signing and encryption key and certificate. "/>
-        <selfSignedCert hostname="${idp.hostname}"
-                        privateKeyFile="${idp.home}/credentials/idp.key"
-                        certificateFile="${idp.home}/credentials/idp.crt" />
-        <stringFromFile input="${idp.home}/credentials/idp.crt" addProperty="idp.cert" />
-
-        <copy todir="${idp.home}/bin" preservelastmodified="true">
-            <fileset dir="${tools.dir}" />
-            <filterset begintoken="$" endtoken="$">
-                <filter token="IDP_HOME" value="${idp.home}" />
-                <filter token="IDP_VERSION" value="${version}" />
-            </filterset>
-        </copy>
-        <chmod file="${idp.home}/bin/*.sh" perm="+x" />
+    <target name="install" description="Installs the identity provider software.">
+        <input message="Is this a new installation? Answering yes will overwrite your current configuration. [yes|no]"
+               addproperty="new.install"
+               defaultvalue="no" />
 
         <if>
-            <available file="${idp.home}/conf" />
+            <equals arg1="${new.install}" arg2="yes" />
             <then>
-                <mkdir dir="${idp.home}/conf.bak" />
-                <copy todir="${idp.home}/conf.bak" preservelastmodified="true">
-                    <fileset dir="${idp.home}/conf" />
+                <input message="Where should the Shibboleth Identity Provider software be installed? [default: ${idp.home}]"
+                       addproperty="idp.home.input"
+                       defaultvalue="${idp.home}" />
+                <var name="idp.home" value="${idp.home.input}" />
+
+                <input message="What is the hostname of the Shibboleth Identity Provider server? [default: ${idp.hostname}]"
+                       addproperty="idp.hostname.input"
+                       defaultvalue="${idp.hostname}" />
+                <var name="idp.hostname" value="${idp.hostname.input}" />
+                
+                <input message="A keystore is about to be generated for you. Please enter a password that will be used to protect it."
+                       addproperty="idp.keystore.pass" />
+
+                <propertyfile file="install.properties">
+                    <entry key="idp.home" value="${idp.home.input}" />
+                    <entry key="idp.hostname" value="${idp.hostname.input}" />
+                </propertyfile>
+
+                <mkdir dir="${idp.home}" />
+                <mkdir dir="${idp.home}/bin" />
+                <mkdir dir="${idp.home}/conf" />
+                <mkdir dir="${idp.home}/credentials" />
+                <mkdir dir="${idp.home}/lib" />
+                <mkdir dir="${idp.home}/logs" />
+                <mkdir dir="${idp.home}/metadata" />
+                <mkdir dir="${idp.home}/war" />
+
+                <var name="idp.entity.id" value="https://${idp.hostname}/idp/shibboleth" />
+
+                <regexSplit input="${idp.hostname}" regex="^.*\.(.*\..*$)" addproperty="idp.scope" />
+
+                <echo message="Generating signing and encryption key, certificate, and keystore. " />
+                <selfSignedCert hostname="${idp.hostname}"
+                                privateKeyFile="${idp.home}/credentials/idp.key"
+                                certificateFile="${idp.home}/credentials/idp.crt"
+                                keystoreFile="${idp.home}/credentials/idp.jks"
+                                keystorePassword="${idp.keystore.pass}" />
+
+                <copy todir="${idp.home}/bin" preservelastmodified="true">
+                    <fileset dir="${tools.dir}" />
+                    <filterset begintoken="$" endtoken="$">
+                        <filter token="IDP_HOME" value="${idp.home}" />
+                        <filter token="IDP_VERSION" value="${version}" />
+                    </filterset>
+                </copy>
+                <chmod file="${idp.home}/bin/*.sh" perm="+x" />
+
+                <copy todir="${idp.home}/conf" preservelastmodified="true" overwrite="true">
+                    <fileset dir="${conf.dir}" />
+                    <filterset begintoken="$" endtoken="$">
+                        <filter token="IDP_HOME" value="${idp.home}" />
+                        <filter token="IDP_VERSION" value="${version}" />
+                        <filter token="IDP_ENTITY_ID" value="${idp.entity.id}" />
+                        <filter token="IDP_SCOPE" value="${idp.scope}" />
+                        <filter token="IDP_CERTIFICATE" value="${idp.cert}" />
+                        <filter token="IDP_HOSTNAME" value="${idp.hostname}" />
+                    </filterset>
+                </copy>
+
+                <stringFromFile input="${idp.home}/credentials/idp.crt" addProperty="idp.cert" />
+                <regexSplit input="${idp.cert}"
+                            regex="\A.*-----\s((?:.*\s)*)-----END.*\Z"
+                            addproperty="idp.metadata.cert" />
+                <copy todir="${idp.home}/metadata" preservelastmodified="true" overwrite="true">
+                    <fileset dir="${metadata.dir}" />
+                    <filterset begintoken="$" endtoken="$">
+                        <filter token="IDP_ENTITY_ID" value="${idp.entity.id}" />
+                        <filter token="IDP_SCOPE" value="${idp.scope}" />
+                        <filter token="IDP_CERTIFICATE" value="${idp.metadata.cert}" />
+                        <filter token="IDP_HOSTNAME" value="${idp.hostname}" />
+                    </filterset>
                 </copy>
             </then>
         </if>
 
-        <copy todir="${idp.home}/conf" preservelastmodified="true" overwrite="${idp.overwrite-config}">
-            <fileset dir="${conf.dir}" />
-            <filterset begintoken="$" endtoken="$">
-                <filter token="IDP_HOME" value="${idp.home}" />
-                <filter token="IDP_VERSION" value="${version}" />
-                <filter token="IDP_ENTITY_ID" value="${idp.entity.id}" />
-                <filter token="IDP_SCOPE" value="${idp.scope}" />
-                <filter token="IDP_CERTIFICATE" value="${idp.cert}" />
-                <filter token="IDP_HOSTNAME" value="${idp.hostname}" />
-            </filterset>
-        </copy>
-
         <copy todir="${idp.home}/lib" preservelastmodified="true">
             <fileset dir="${lib.dir}" />
             <fileset file="${dist.dir}/${jar.name}" />
             <fileset file="${build-lib.dir}/servlet-2.4.jar" />
         </copy>
 
-        <copy todir="${idp.home}/metadata" preservelastmodified="true" overwrite="${idp.overwrite-config}">
-            <fileset dir="${metadata.dir}" />
-            <filterset begintoken="$" endtoken="$">
-                <filter token="IDP_ENTITY_ID" value="${idp.entity.id}" />
-                <filter token="IDP_SCOPE" value="${idp.scope}" />
-                <filter token="IDP_CERTIFICATE" value="${idp.cert}" />
-                <filter token="IDP_HOSTNAME" value="${idp.hostname}" />
-            </filterset>
-        </copy>
-
         <copy todir="${webinf-temp.dir}">
             <fileset dir="${webinf.dir}" />
             <filterset begintoken="$" endtoken="$">
                 <filter token="IDP_VERSION" value="${version}" />
             </filterset>
         </copy>
+
         <jar destfile="${idp.home}/war/${war.name}" whenempty="fail">
             <zipfileset dir="${webinf-temp.dir}" prefix="WEB-INF/" />
             <zipfileset dir="${webpages.dir}" prefix="" />
             <zipfileset dir="${lib.dir}" prefix="WEB-INF/lib/" />
             <zipfileset file="${dist.dir}/${jar.name}" prefix="WEB-INF/lib/" />
         </jar>
-
     </target>
 
+
     <!-- **************************************************************** -->
     <!-- ***                                                          *** -->
     <!-- ***                     Developer Tasks                      *** -->