microsoft-msvc/builder-targets-cb.sh
2013-09-17 09:09:02 +02:00

236 lines
15 KiB
Bash

##############################################################################
# This optional file "builder-targets-cb.sh" will be called by builder.sh
#
# The targets will be called from thde opsi-builder using the following
# order: config, prepare, retrieve, create, package, publish, commit, cleanup
# You can overwrite the target functions in builder-targets-cb.sh
#
# You can define callback functions. The functions are called from
# opsi-builder within processing a target
# cb_package_makeproductfile
#
# You can use every variable defined in any configuration file or by
# the defined builder script itself. Also, calling the predefined
# targets builder_<targetname> is possible.
#
# Abstract:
# target order: config, prepare, retrieve, create, package, publish, commit, cleanup
# callbacks: <none>
#
##############################################################################
function cleanup() {
echo "Cleanup"
builder_cleanup
}
function create() {
echo "Create"
builder_create
echo "<package id=\"msvc\" name=\"%NAME% Runtimes\" group=\"Standard Programme\" priority=\"1\">" >$INST_DIR/package.old
echo "<variable name=\"NAME\" value=\"Visual C++\" />" >> $INST_DIR/package.old
echo "<install>" >> $INST_DIR/package.old
###################################################
# VC 2005
###################################################
extract_file msi-a $INST_DIR/Temp/x86/2005/vcredist.msi $INST_DIR/x86/2005
extract_file msi-a $INST_DIR/Temp/x64/2005/vcredist.msi $INST_DIR/x64/2005
# Space in filepath not handled correctly by cygpath so copy th a dir witout spaces
cp $INST_DIR/x86/2005/Program\ Files/Common\ Files/Microsoft\ Shared/VC/msdia80.dll $INST_DIR/Temp/msdia80_x86.dll
get_file_ver vc2005ver_x86 $INST_DIR/Temp/msdia80_x86.dll
cp $INST_DIR/x64/2005/Program\ Files/Common\ Files/Microsoft\ Shared/VC/amd64/msdia80.dll $INST_DIR/Temp/msdia80_x64.dll
get_file_ver vc2005ver_x64 $INST_DIR/Temp/msdia80_x64.dll
echo "msvc 2005 x86 $vc2005ver_x86"
echo "msvc 2005 x64 $vc2005ver_x64"
echo "<cmd name=\"%NAME% 2005\" path=\"x86\2005\vcredist.msi\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%commonprogramfiles%\microsoft shared\VC\msdia80.dll\" value=\"$vc2005ver_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles(x86)%\Common Files\microsoft shared\VC\msdia80.dll\" value=\"$vc2005ver_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2005 x64\" path=\"x64\2005\vcredist.msi\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles(x86)%\Common Files\microsoft shared\VC\amd64\msdia80.dll\" value=\"$vc2005ver_x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
###################################################
# VC 2008
###################################################
cp $PRODUCT_DIR/cscripts/vc2k8_slim.vbs $INST_DIR/Temp/x86/2008/
pushd $INST_DIR/Temp/x86/2008/
cscript vc2k8_slim.vbs
popd
extract_file msi-a $INST_DIR/Temp/x86/2008/vc_red.msi $INST_DIR/x86/2008
rm -f $INST_DIR/Temp/x86/2008/*{msi,cab}
mv $INST_DIR/Temp/x86/2008/* $INST_DIR/x86/2008
rm -f $INST_DIR/x86/2008/*.cab
mv $INST_DIR/x86/2008/VC_RED.MSI $INST_DIR/x86/2008/vc_red.msi
cp $PRODUCT_DIR/cscripts/vc2k8_slim.vbs $INST_DIR/Temp/x64/2008/
pushd $INST_DIR/Temp/x64/2008/
cscript vc2k8_slim.vbs
popd
extract_file msi-a $INST_DIR/Temp/x64/2008/vc_red.msi $INST_DIR/x64/2008
rm -f $INST_DIR/Temp/x64/2008/*{msi,cab}
mv $INST_DIR/Temp/x64/2008/* $INST_DIR/x64/2008
rm -f $INST_DIR/x64/2008/*.cab
mv $INST_DIR/x64/2008/VC_RED.MSI $INST_DIR/x64/2008/vc_red.msi
# Space in filepath not handled correctly by cygpath so copy th a dir witout spaces
cp $INST_DIR/x86/2008/Program\ Files/Common\ Files/Microsoft\ Shared/VC/msdia90.dll $INST_DIR/Temp/msdia90_x86.dll
get_file_ver vc2008ver_x86 $INST_DIR/Temp/msdia90_x86.dll
cp $INST_DIR/x64/2008/Program\ Files\(64\)/Common\ Files/Microsoft\ Shared/VC/msdia90.dll $INST_DIR/Temp/msdia90_x64.dll
get_file_ver vc2008ver_x64 $INST_DIR/Temp/msdia90_x64.dll
echo "msvc 2008 x86 $vc2008ver_x86"
echo "msvc 2008 x64 $vc2008ver_x64"
echo "<cmd name=\"%NAME% 2008\" path=\"x86\2008\install.exe\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%commonprogramfiles%\microsoft shared\VC\msdia90.dll\" value=\"$vc2008ver_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles(x86)%\Common Files\microsoft shared\VC\msdia90.dll\" value=\"$vc2008ver_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2008 x64\" path=\"x64\2008\install.exe\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles%\Common Files\Microsoft Shared\VC\msdia90.dll\" value=\"$vc2008ver_x86\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
###################################################
# VC 2010
###################################################
# cp $PRODUCT_DIR/cscripts/vc2k10_slim.vbs $INST_DIR/Temp/x86/2010/
# pushd $INST_DIR/Temp/x86/2010/
# cscript vc2k10_slim.vbs
# popd
extract_file msi-a $INST_DIR/Temp/x86/2010/vc_red.msi $INST_DIR/x86/2010
rm -f $INST_DIR/x86/2010/*.cab
mv $INST_DIR/x86/2010/VC_RED.MSI $INST_DIR/x86/2010/vc_red.msi
# rm -f $INST_DIR/Temp/x86/2010/*{msi,cab,msp}
mv -f $INST_DIR/Temp/x86/2010/* $INST_DIR/x86/2010
# cp $PRODUCT_DIR/cscripts/vc2k10_slim.vbs $INST_DIR/Temp/x64/2010/
# pushd $INST_DIR/Temp/x64/2010/
# cscript vc2k10_slim.vbs
# popd
extract_file msi-a $INST_DIR/Temp/x64/2010/vc_red.msi $INST_DIR/x64/2010
rm -f $INST_DIR/x64/2010/*.cab
mv $INST_DIR/x64/2010/VC_RED.MSI $INST_DIR/x64/2010/vc_red.msi
# rm -f $INST_DIR/Temp/x64/2010/*{msi,cab,msp}
mv -f $INST_DIR/Temp/x64/2010/* $INST_DIR/x64/2010
# Space in filepath not handled correctly by cygpath so copy th a dir witout spaces
cp $INST_DIR/x86/2010/Program\ Files/Microsoft\ Visual\ Studio\ 10.0/Common\ Files/Microsoft\ Shared/VC/msdia100.dll $INST_DIR/Temp/msdia100_x86.dll
get_file_ver vc2010ver_x86 $INST_DIR/Temp/msdia100_x86.dll
cp $INST_DIR/x64/2010/Program\ Files\(64\)/Microsoft\ Visual\ Studio\ 10.0/Common\ Files/Microsoft\ Shared/VC/msdia100.dll $INST_DIR/Temp/msdia100_x64.dll
get_file_ver vc2010ver_x64 $INST_DIR/Temp/msdia100_x64.dll
rm -rf $INST_DIR/x86/2010/{Program*,Win}
rm -rf $INST_DIR/x64/2010/{Program*,Win}
echo "msvc 2010 x86 $vc2010ver_x86"
echo "msvc 2010 x64 $vc2010ver_x64"
echo "<cmd name=\"%NAME% 2010\" path=\"x86\2010\Setup.exe\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%commonprogramfiles%\microsoft shared\VC\msdia100.dll\" value=\"$vc2010ver_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles(x86)%\Common Files\microsoft shared\VC\msdia100.dll\" value=\"$vc2010ver_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2010 x64\" path=\"x64\2010\Setup.exe\" param=\"/q\">" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%programfiles%\Common Files\Microsoft Shared\VC\msdia100.dll\" value=\"$vc2010ver_x86\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
###################################################
# VC 2012
###################################################
extract_file cab-sfx $INST_DIR/Temp/x86/2012/vcredist2012_x86.exe $INST_DIR/Temp/x86/2012/
extract_file cab-sfx $INST_DIR/Temp/x64/2012/vcredist2012_x64.exe $INST_DIR/Temp/x64/2012/
extract_file msi-a $INST_DIR/Temp/x86/2012/packages/vcRuntimeMinimum_x86/vc_runtimeMinimum_x86.msi $INST_DIR/x86/2012
extract_file msi-a $INST_DIR/Temp/x86/2012/packages/vcRuntimeAdditional_x86/vc_runtimeAdditional_x86.msi $INST_DIR/x86/2012
extract_file msi-a $INST_DIR/Temp/x64/2012/packages/vcRuntimeMinimum_amd64/vc_runtimeMinimum_x64.msi $INST_DIR/x64/2012
extract_file msi-a $INST_DIR/Temp/x64/2012/packages/vcRuntimeAdditional_amd64/vc_runtimeAdditional_x64.msi $INST_DIR/x64/2012
get_file_ver vc2012ver_atl_x86 $INST_DIR/x86/2012/Win/System/atl110.dll
get_file_ver vc2012ver_atl_x64 $INST_DIR/x64/2012/Win/System64/atl110.dll
get_file_ver vc2012ver_mfc_x86 $INST_DIR/x86/2012/Win/System/mfc110.dll
get_file_ver vc2012ver_mfc_x64 $INST_DIR/x64/2012/Win/System64/mfc110.dll
echo "msvc 2012 Minimal x86 $vc2010ver_atl_x86"
echo "msvc 2012 Minimal x64 $vc2010ver_atl_x64"
echo "msvc 2012 Additional x86 $vc2010ver_mfc_x86"
echo "msvc 2012 Additional x64 $vc2010ver_mfc_x64"
echo "<cmd name=\"%NAME% 2012 Minimum\" path=\"x86\2012\vc_runtimeMinimum_x86.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.0.6002.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\system32\atl110.dll\" value=\"$vc2012ver_atl_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\atl110.dll\" value=\"$vc2012ver_atl_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd name=\"%NAME% 2012 Additional\" path=\"x86\2012\vc_runtimeAdditional_x86.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.0.6002.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\system32\mfc110.dll\" value=\"$vc2012ver_mfc_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\mfc110.dll\" value=\"$vc2012ver_mfc_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2012 Minimum x64\" path=\"x64\2012\vc_runtimeMinimum_x64.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.0.6002.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\atl110.dll\" value=\"$vc2012ver_atl_x64\"/>" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2012 Additional x64\" path=\"x64\2012\vc_runtimeAdditional_x64.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.0.6002.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\mfc110.dll\" value=\"$vc2012ver_mfc_x64\"/>" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
###################################################
# VC 2013
###################################################
extract_file cab-sfx $INST_DIR/Temp/x86/2013/vcredist2013_x86.exe $INST_DIR/Temp/x86/2013/
extract_file cab-sfx $INST_DIR/Temp/x64/2013/vcredist2013_x64.exe $INST_DIR/Temp/x64/2013/
extract_file msi-a $INST_DIR/Temp/x86/2013/packages/vcRuntimeMinimum_x86/vc_runtimeMinimum_x86.msi $INST_DIR/x86/2013
extract_file msi-a $INST_DIR/Temp/x86/2013/packages/vcRuntimeAdditional_x86/vc_runtimeAdditional_x86.msi $INST_DIR/x86/2013
extract_file msi-a $INST_DIR/Temp/x64/2013/packages/vcRuntimeMinimum_amd64/vc_runtimeMinimum_x64.msi $INST_DIR/x64/2013
extract_file msi-a $INST_DIR/Temp/x64/2013/packages/vcRuntimeAdditional_amd64/vc_runtimeAdditional_x64.msi $INST_DIR/x64/2013
get_file_ver vc2013ver_msvcp_x86 $INST_DIR/x86/2013/System/msvcp120.dll
get_file_ver vc2013ver_msvcp_x64 $INST_DIR/x64/2013/System64/msvcp120.dll
get_file_ver vc2013ver_mfc_x86 $INST_DIR/x86/2013/System/mfc120.dll
get_file_ver vc2013ver_mfc_x64 $INST_DIR/x64/2013/System64/mfc120.dll
echo "msvc 2013 Minimal x86 $vc2013ver_msvcp_x86"
echo "msvc 2013 Minimal x64 $vc2013ver_msvcp_x64"
echo "msvc 2013 Additional x86 $vc2013ver_mfc_x86"
echo "msvc 2013 Additional x64 $vc2013ver_mfc_x64"
echo "<cmd name=\"%NAME% 2013 Minimum\" path=\"x86\2013\vc_runtimeMinimum_x86.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.1.7600.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\system32\msvcp120.dll\" value=\"$vc2013ver_msvcp_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\msvcp120.dll\" value=\"$vc2013ver_msvcp_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd name=\"%NAME% 2013 Additional\" path=\"x86\2013\vc_runtimeAdditional_x86.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.1.7600.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\system32\mfc120.dll\" value=\"$vc2013ver_mfc_x86\" arch=\"x86\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\mfc120.dll\" value=\"$vc2013ver_mfc_x86\" arch=\"x64\" />" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2013 Minimum x64\" path=\"x64\2013\vc_runtimeMinimum_x64.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.1.7600.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\msvcp120.dll\" value=\"$vc2013ver_msvcp_x64\"/>" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
echo "<cmd arch=\"x64\" name=\"%NAME% 2013 Additional x64\" path=\"x64\2013\vc_runtimeAdditional_x64.msi\" param=\"/q /norestart MSIFASTINSTALL=7 NOVSUI=1\">" >> $INST_DIR/package.old
echo "<check type=\"os\" condition=\">\" value=\"6.1.7600.0\" />" >> $INST_DIR/package.old
echo "<check type=\"file\" condition=\"<\" path=\"%windir%\syswow64\mfc120.dll\" value=\"$vc2013ver_mfc_x64\"/>" >> $INST_DIR/package.old
echo "</cmd>" >> $INST_DIR/package.old
###################################################
# Package.xml end and cleanup
###################################################
echo "</install>" >> $INST_DIR/package.old
echo "</package>" >> $INST_DIR/package.old
tidy_xml $INST_DIR/package.old $INST_DIR/package.xml
rm $INST_DIR/package.old
# exit 1
}