    <target name="update.firststeps.xml"
        depends="detectCurrentOSFamily,
                 defineOSSpecificConfigFlag,
                 setOSFileSeparator,
                 setFirstStepsScript"
        unless="configOS400" unless="isEmbed">
  
        <antcall target="replaceRegExpAllInstancesOfGivenTokenWithGivenValueForTheGivenDir">
        		<param name="port" value="WC_adminhost"/>        					
			<param name="token" value="http(.*)://(.*):(.*)/ibm/console"/>
			<param name="tokenValue" value="http\1://\2:${WC_adminhost}/ibm/console"/>
			<param name="fileType" value="html"/>
		</antcall>
		
        <antcall target="replaceRegExpAllInstancesOfGivenTokenWithGivenValueForTheGivenDir">
        		<param name="port" value="WC_defaulthost"/>       			
			<param name="token" value="http(.*)://(.*):(.*)/WSsamples"/>
			<param name="tokenValue" value="http\1://\2:${WC_defaulthost}/WSsamples"/>
			<param name="fileType" value="html"/>
		</antcall>

        <antcall target="replaceRegExpAllInstancesOfGivenTokenWithGivenValueForTheGivenFile">
        		<param name="port" value="WC_adminhost"/> 
        		<param name="file" value="${dir}/${firststepsScript}"/>      			
			<param name="token" value="--defaulthostport (.*)"/>
			<param name="tokenValue" value="--defaulthostport ${WC_adminhost}"/>
		</antcall>

        <antcall target="setUnixShellScriptPermissions"/>
    </target>
    
    <target name="detectCurrentOSFamily"
            description="Detects the current OS family (UNIX or Windows)">
        
        <!-- OS/400 setting must come before the unix setting -->
        <condition property="currentOSFamily" value="os/400">
            <equals arg1="${os.name}" arg2="OS/400"/>
        </condition>
        
        <condition property="currentOSFamily" value="windows">
            <os family="windows"/>
        </condition>
        
        <condition property="currentOSFamily" value="unix">            
            <os family="unix"/>
        </condition>
        
        <wscmtlog>Detected current OS family to be: ${currentOSFamily}</wscmtlog>
    </target>
    
    <target name="defineOSSpecificConfigFlag"
            description="Defines either configUNIX or configWindows depending on the current OS">
            
        <condition property="configOS400" value="true">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>
        
        <condition property="configUNIX" value="true">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>
        
        <condition property="configWindows" value="true">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
    </target>

    <target name="setOSFileSeparator"
            description="Sets the current file separator for this platform (file.separator is unreliable on ANT 1.5.4)">

        <condition property="separatorFile" value="/">
            <equals arg1="${currentOSFamily}" arg2="os/400"/>
        </condition>
        
        <condition property="separatorFile" value="/">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>

        <condition property="separatorFile" value="\">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
    </target>
    
    <target name="setFirstStepsScript"
            description="Sets the First Steps script according to the current OS">
            
        <condition property="firststepsScript" value="firststeps.sh">
            <equals arg1="${currentOSFamily}" arg2="unix"/>
        </condition>
        
        <condition property="firststepsScript" value="firststeps.bat">
            <equals arg1="${currentOSFamily}" arg2="windows"/>
        </condition>
    </target>

    <target name="setUnixShellScriptPermissions"
            description="Set permissions for *.sh to 755 on unix systems"
            if="configUNIX">
                <chmod dir="${profilePath}${separatorFile}firststeps" perm="ugo-rwx,ugo+rx,u+w" includes="**/*.sh"/>
    </target>

