############################################################################## # 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_ is possible. # # Abstract: # target order: config, prepare, retrieve, create, package, publish, commit, cleanup # callbacks: # ############################################################################## function cleanup() { echo "Cleanup" builder_cleanup } write_svcpack_file() { local control_file=$1 local control_section=$2 local control_option=$3 local control_value=$4 sed -i -e "/^\[$control_section\]/,/^\[.*\]/ s|^\($control_option[ \t]*=[ \t]*\).*$|\1$control_value|" "$control_file" } function create() { echo "Create" builder_create extract_file cab $INST_DIR/Temp/x86/kels/Runtimes.cab $INST_DIR/Temp/x86/kels extract_file 7zip $INST_DIR/Temp/x86/vb6/core/*.exe $INST_DIR/Temp/x86/vb6/core extract_file inno $INST_DIR/Temp/x86/vb6/update/*.exe $INST_DIR/Temp/x86/vb6/update extract_file inno $INST_DIR/Temp/x86/vbset/*.exe $INST_DIR/Temp/x86/vbset extract_file msp-x $INST_DIR/Temp/x86/vc71/sp1fix/*.msp $INST_DIR/Temp/x86/vc71/sp1fix extract_file cab $INST_DIR/Temp/x86/vc71/sp1fix/PCW* $INST_DIR/Temp/x86/vc71/sp1fix extract_file inno $INST_DIR/Temp/x86/openssl/*.exe $INST_DIR/Temp/x86/openssl extract_file inno $INST_DIR/Temp/x64/openssl/*.exe $INST_DIR/Temp/x64/openssl mv $INST_DIR/Temp/x86/autoit/install/AutoItX $INST_DIR/Temp/x86/autoit rm -rf $INST_DIR/Temp/x86/autoit/install mv $INST_DIR/Temp/x64/autoit/install/AutoItX $INST_DIR/Temp/x64/autoit rm -rf $INST_DIR/Temp/x64/autoit/install mv $INST_DIR/Temp/x86/vc10run/core/*/* $INST_DIR/Temp/x86/vc10run/core rm -rf $INST_DIR/Temp/x86/vc10run/core/Req* mkdir $INST_DIR/Temp/x86/vc10run/update2 mv -vf $INST_DIR/Temp/x86/kels/plugin.dll $INST_DIR/Temp/x86/vc10run/update2 mv -vf $INST_DIR/Temp/x86/vb6/update/\{sys\}/msvcrt.dll $INST_DIR/Temp/x86/vc10run/update2 cp $INST_DIR/Temp/x86/openssl/\{app\}/ssleay32.dll $INST_DIR/Temp/x86/openssl/\{app\}/libssl32.dll for i in `find $INST_DIR/Temp -type f` ; do mv "$i" `echo $i | tr [:upper:] [:lower:]`; done mkdir -p $INST_DIR/bin/system{16,32,64} mkdir -p $INST_DIR/bin/program{32,64} # ============================================================================================= # Old Runtimes # ============================================================================================= for i in $INST_DIR/Temp/x86/vc10run/core/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done for i in $INST_DIR/Temp/x86/vc10run/update/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done for i in $INST_DIR/Temp/x86/vc10run/update2/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done # ============================================================================================= # Kels Runtime # ============================================================================================= rm $INST_DIR/Temp/x86/kels/*.{cab,ini,inf} rm $INST_DIR/Temp/x86/kels/usp10.dll for i in $INST_DIR/Temp/x86/kels/*.{dll,ocx} do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # cygwin # ============================================================================================= for i in $INST_DIR/Temp/x86/cygwin/usr/bin/cygwin1.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64/cygwin/usr/bin/cygwin1.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # zlib # ============================================================================================= for i in $INST_DIR/Temp/x86/zlib/zlib1.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # zlib wapi # ============================================================================================= for i in $INST_DIR/Temp/x86/zlibwapi/dll32/zlibwapi.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64/zlibwapi/dllx64/zlibwapi.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # VB 1.0.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vb1/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done # ============================================================================================= # VB 2.0.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vb2/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done # ============================================================================================= # VB 3.0.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vb3/*.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done # ============================================================================================= # VB 4.0.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vb4/vb40016.dll do copyver $i $INST_DIR/bin/system16/`basename $i` done for i in $INST_DIR/Temp/x86/vb4/vb40032.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # VB 5.0.0 # ============================================================================================= rm $INST_DIR/Temp/x86/vb5/w95* for i in $INST_DIR/Temp/x86/vb5/*.{dll,tlb} do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # VB 6.0.0 # ============================================================================================= rm $INST_DIR/Temp/x86/vb6/core/w95* for i in $INST_DIR/Temp/x86/vb6/core/*.{dll,tlb} do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x86/vb6/update/\{sys\}/*.{dll,tlb,ocx} do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # VB Set # ============================================================================================= rm $INST_DIR/Temp/x86/vbset/\{sys\}/w95* rm $INST_DIR/Temp/x86/vbset/\{sys\}/*.inf for i in $INST_DIR/Temp/x86/vbset/\{sys\}/*.{dll,tlb,ocx} do copyver $i $INST_DIR/bin/system32/`basename $i` done # ============================================================================================= # Vc 7.0.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vc70/core/*.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in atl70 msvcr70 msvci70 mfc70 mfc70u mfc70deu mfc70esp mfc70fra mfc70ita mfc70chs mfc70cht mfc70jpn mfc70kor msvcp70 do copyver $INST_DIR/Temp/x86/vc70/rick/$i.dll $INST_DIR/bin/system32/$i.dll done for i in atl70 msvcr70 msvci70 mfc70 mfc70u mfc70deu mfc70esp mfc70fra mfc70ita mfc70chs mfc70cht mfc70jpn mfc70kor msvcp70 do copyver $INST_DIR/Temp/x86/vc70/sp1fix/fl_${i}_dll_* $INST_DIR/bin/system32/$i.dll done # ============================================================================================= # Vc 7.1.0 # ============================================================================================= for i in $INST_DIR/Temp/x86/vc71/core/*.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in atl71 msvcr71 mfc71 mfc71u mfc71deu mfc71esp mfc71fra mfc71ita mfc71chs mfc71cht mfc71jpn mfc71kor msvcp71 do copyver $INST_DIR/Temp/x86/vc71/rick/$i.dll $INST_DIR/bin/system32/$i.dll done for i in atl71 msvcr71 mfc71 mfc71u mfc71deu mfc71esp mfc71fra mfc71ita mfc71chs mfc71cht mfc71jpn mfc71kor msvcp71 do copyver $INST_DIR/Temp/x86/vc71/sp1fix/fl_${i}_dll__* $INST_DIR/bin/system32/$i.dll done # ============================================================================================= # AutoIt # ============================================================================================= for i in $INST_DIR/Temp/x86/autoit/AutoItX/autoitx3.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64/autoit/AutoItX/autoitx3_x64.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # OpenSSL # ============================================================================================= for i in $INST_DIR/Temp/x86/openssl/\{app\}/*.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64//openssl/\{app\}/*.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # SDL 1 # ============================================================================================= for i in $INST_DIR/Temp/x86/sdl1/*.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64/sdl1/*.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # SDL 2 # ============================================================================================= for i in $INST_DIR/Temp/x86/sdl2/*.dll do copyver $i $INST_DIR/bin/system32/`basename $i` done for i in $INST_DIR/Temp/x64/sdl2/*.dll do copyver $i $INST_DIR/bin/system64/`basename $i` done # ============================================================================================= # Build the AIORuntimes.dll and exe # ============================================================================================= sed -e "s/1.2.3.4/${VERSION}/g" -e "s/1, 2, 3, 4/${VERSION//./, }/g" $PRODUCT_DIR/code/AIORuntimes.rc > $INST_DIR/Temp/version.rc windres -i $INST_DIR/Temp/version.rc -O coff -o $INST_DIR/Temp/version.res gcc -mwindows -c -o $INST_DIR/Temp/AIORuntimes_dll.o $PRODUCT_DIR/code/AIORuntimes_dll.c gcc -mwindows -shared $INST_DIR/Temp/version.res $INST_DIR/Temp/AIORuntimes_dll.o -o $INST_DIR/Temp/AIORuntimes.dll gcc -mwindows -o $INST_DIR/Temp/AIORuntimes $PRODUCT_DIR/code/AIORuntimes_exe.c -L$INST_DIR/Temp/ -lAIORuntimes copyver $INST_DIR/Temp/AIORuntimes.dll $INST_DIR/bin/system32/ copyver $INST_DIR/Temp/AIORuntimes.exe $INST_DIR/bin/program32/ # ============================================================================================= # Build the Setup # ============================================================================================= cp -vf $PRODUCT_DIR/code/install_script.iss $INST_DIR/install_script.iss for i in $INST_DIR/bin/system16/* do echo "$(cygpath -pw "$i")" echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{win}\system\"; MinVersion: 0.0,5.0;" >> $INST_DIR/install_script.iss done for i in $INST_DIR/bin/system32/* do echo "$(cygpath -pw "$i")" fname=$(basename $i) if [ "${i##*.}" == "ocx" ] || [ "${fname}" == "autoitx3.dll" ] || [ "${fname}" == "msstdfmt.dll" ] || [ "${fname}" == "msstkprp.dll" ] || [ "${fname}" == "scrrun.dll" ] || [ "${fname}" == "olepro32.dll" ] || [ "${fname}" == "oleaut32.dll" ] || [ "${fname}" == "msvbvm50.dll" ] || [ "${fname}" == "msvbvm60.dll" ] || [ "${fname}" == "cmct3de.dll" ] ; then echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{sys}\"; MinVersion: 0.0,5.0; Flags: restartreplace regserver overwritereadonly noregerror 32bit" >> $INST_DIR/install_script.iss elif [ "${fname}" == "zlib1.dll" ] || [ "${fname}" == "atl71.dll" ] || [ "${fname}" == "mfc71u.dll" ] || [ "${fname}" == "msvcp71.dll" ] || [ "${fname}" == "msvcr71.dll" ] ; then echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{sys}\"; MinVersion: 0.0,5.0; Flags: restartreplace overwritereadonly 32bit" >> $INST_DIR/install_script.iss elif [ "${i##*.}" == "tlb" ] ; then echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{sys}\"; MinVersion: 0.0,5.0; Flags: restartreplace regtypelib overwritereadonly noregerror 32bit" >> $INST_DIR/install_script.iss else echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{sys}\"; MinVersion: 0.0,5.0; Flags: restartreplace overwritereadonly 32bit" >> $INST_DIR/install_script.iss # echo "Source: \"$(cygpath -pw "$i")\"; DestDir: \"{sys}\"; MinVersion: 0.0,5.0; Flags: 32bit" >> $INST_DIR/install_script.iss fi done for i in $INST_DIR/bin/system64/* do echo "$(cygpath -pw "$i")" done for i in $INST_DIR/bin//program32/* do echo "$(cygpath -pw "$i")" done write_svcpack_file $INST_DIR/install_script.iss "Setup" "AppVerName" "${VERSION}" write_svcpack_file $INST_DIR/install_script.iss "Setup" "AppVersion" "${VERSION}" ISCC.exe /Q /O"$(cygpath -pw "$INST_DIR")" /F"Geos_One_General_Runtimes_Installer_$VERSION" "$(cygpath -pw "$INST_DIR/install_script.iss")" ################################################### # Temp Package.xml ################################################### echo "" > $INST_DIR/package.old echo "" >> $INST_DIR/package.old echo "" >> $INST_DIR/package.old echo "" >> $INST_DIR/package.old echo "" >> $INST_DIR/package.old echo "" >> $INST_DIR/package.old echo "" >> $INST_DIR/package.old ################################################### # Package.xml end and cleanup ################################################### tidy_xml $INST_DIR/package.old $INST_DIR/package.xml rm $INST_DIR/package.old rm $INST_DIR/*.iss rm -rf $INST_DIR/bin #exit 1 }