sereby.aio/builder-targets-cb.sh

149 lines
9.4 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 retrieve() {
echo "Retrieve"
# work around big file download for verison change
local olddir=`echo $DIST_CACHE_DIR | sed -e "s/\/[^\/]*$//"`
echo $olddir
mv $olddir/${PN}-* tempsereby
mv tempsereby $DIST_CACHE_DIR
builder_retrieve
}
function create() {
echo "Create"
builder_create
# create directories and extract the runtime packages
mkdir -p $INST_DIR/CLIENT_DATA/{Install/Packages/Air,Config}
mkdir -p $INST_DIR/CLIENT_DATA/UnInstall/Packages/{Flash,Shockwave,Silverlight}
7z x -o$INST_DIR/CLIENT_DATA/Install $INST_DIR/CLIENT_DATA/X86/svcpack/aio-runtimes.exe
# move the Windows 8 dotnet 2 - 3.5 in place
mv -v $INST_DIR/CLIENT_DATA/X86/win8dotnet35/sources/sxs $INST_DIR/CLIENT_DATA/Install/NET/WIN8.0
# Serby and its hacks workaround (sereby pack wants to copy a file on install but thats not possible on a readonly device in opsi
# move the combined x86/x64 to a common name
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5 $INST_DIR/CLIENT_DATA/Install/NET/35
# recreate the new dir
mkdir -p $INST_DIR/CLIENT_DATA/Install/NET/3.5
# move the common dir to the x86 name under the new dir
mv $INST_DIR/CLIENT_DATA/Install/NET/35 $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86
# remove the copy from the install.bat
sed -e '/^copy/d' -i $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/_Install.bat
# move the package.xml un dir up
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/package.xml $INST_DIR/CLIENT_DATA/Install/NET/3.5
# now link copy the x86 dir to x64
cp -al $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86 $INST_DIR/CLIENT_DATA/Install/NET/3.5/x64
# do the copy for x86 (seded away erlyer)
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/vs_setup_x86.msi $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/vs_setup.msi
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/setup_x86.sdb $INST_DIR/CLIENT_DATA/Install/NET/3.5/x86/setup.sdb
# do the copy for x64 (seded away erlyer)
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5/x64/vs_setup_x64.msi $INST_DIR/CLIENT_DATA/Install/NET/3.5/x64/vs_setup.msi
mv $INST_DIR/CLIENT_DATA/Install/NET/3.5/x64/setup_x64.sdb $INST_DIR/CLIENT_DATA/Install/NET/3.5/x64/setup.sdb
# create a new install.bat that calls the right setup from the right dir
echo "@echo off" >> $INST_DIR/CLIENT_DATA/Install/NET/3.5/_Install.bat
echo "set arch=%1" >> $INST_DIR/CLIENT_DATA/Install/NET/3.5/_Install.bat
echo "call %~dp0\%arch%\_Install.bat" >> $INST_DIR/CLIENT_DATA/Install/NET/3.5/_Install.bat
# sed everything to disabled
sed -e "s!\"1\"!\"0\"!g" -e "s!maximized=\"0\"!maximized=\"1\"!" $INST_DIR/CLIENT_DATA/X86/WinPKG.xml > $INST_DIR/CLIENT_DATA/Config/WinPKG.xml
# sed force update on flash
sed -e "s!-install!-force -install!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Flash/package.xml
# Move Adobe Air and sereby config in place
mv -v $INST_DIR/CLIENT_DATA/X86/air_${AIRVERSION}_win.exe $INST_DIR/CLIENT_DATA/Install/Packages/Air/air3-8_win.exe
mv -v $INST_DIR/CLIENT_DATA/AdobeAIR_package.xml $INST_DIR/CLIENT_DATA/Install/Packages/Air/package.xml
mv -v $INST_DIR/CLIENT_DATA/AdobeAIR_7zip_config.txt $INST_DIR/CLIENT_DATA/Install/Packages/Air/7zip_config.txt
sed 's/.*<\/settings>.*/\t<set component="AdobeAir" checked="0" \/>\n&/' -i $INST_DIR/CLIENT_DATA/Config/WinPKG.xml
sed "s!.\..\..\....!${AIRVERSION}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Air/package.xml
7z a $INST_DIR/CLIENT_DATA/Install/Packages/Air/AdobeAIR.7z $INST_DIR/CLIENT_DATA/Install/Packages/Air/air3-8_win.exe
cat $INST_DIR/CLIENT_DATA/X86/7ZipSFX/7zsd_All.sfx $INST_DIR/CLIENT_DATA/Install/Packages/Air/7zip_config.txt $INST_DIR/CLIENT_DATA/Install/Packages/Air/AdobeAIR.7z > $INST_DIR/CLIENT_DATA/Install/Packages/Air/AdobeAIR.exe
rm $INST_DIR/CLIENT_DATA/Install/Packages/Air/air3-8_win.exe $INST_DIR/CLIENT_DATA/Install/Packages/Air/7zip_config.txt $INST_DIR/CLIENT_DATA/Install/Packages/Air/AdobeAIR.7z
# Update Java
if [ "$JREUPDATE" = "1" ]; then
rm -rf $INST_DIR/CLIENT_DATA/Install/Packages/JRE/*/jre.exe
mv $INST_DIR/CLIENT_DATA/X86/jre7u${JREUVERSION}-x86.exe $INST_DIR/CLIENT_DATA/Install/Packages/JRE/x86/jre.exe
mv $INST_DIR/CLIENT_DATA/X86/jre7u${JREUVERSION}-x64.exe $INST_DIR/CLIENT_DATA/Install/Packages/JRE/x64/jre.exe
sed "s!Update ..!Update ${JREUVERSION}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/JRE/package.xml
sed "s!.\..\....\...!${JREVERSION}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/JRE/package.xml
fi
sed "s!/s!/s REBOOT=Suppress!" -i $INST_DIR/CLIENT_DATA/Install/Packages/JRE/package.xml
echo "@echo off" >> $INST_DIR/CLIENT_DATA/Install/Packages/JRE/disable.bat
echo "if exist \"%PROGRAMFILES%\Java\jre7\bin\jqs.exe\" \"%PROGRAMFILES%\Java\jre7\bin\jqs.exe\" -unregister" >> $INST_DIR/CLIENT_DATA/Install/Packages/JRE/disable.bat
echo "if exist \"%PROGRAMFILES(x86)%\Java\jre7\bin\jqs.exe\" \"%PROGRAMFILES(x86)%\Java\jre7\bin\jqs.exe\" -unregister" >> $INST_DIR/CLIENT_DATA/Install/Packages/JRE/disable.bat
# echo "REG DELETE HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v SunJavaUpdateSched /f" >> $INST_DIR/CLIENT_DATA/Install/Packages/JRE/disable.bat
sed 's/.*\t<\/install>.*/\t\t<cmd path="disable.bat" name="Disable Java Update Check " \/>\n&/' -i $INST_DIR/CLIENT_DATA/Install/Packages/JRE/package.xml
# Update Flash
if [ "$FLASHUPDATE" = "1" ]; then
rm -f $INST_DIR/CLIENT_DATA/Install/Packages/Flash/*.exe
cp $INST_DIR/CLIENT_DATA/X86/install_flash_player-${FLASHVERSION}.exe $INST_DIR/CLIENT_DATA/Install/Packages/Flash/install_flash_player.exe
cp $INST_DIR/CLIENT_DATA/X86/install_flash_player_ax-${FLASHVERSION}.exe $INST_DIR/CLIENT_DATA/Install/Packages/Flash/install_flash_player_ax.exe
sed "s!..\..\....\....!${FLASHVERSION}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Flash/package.xml
sed "s!.._._..._...!${FLASHVERSION//./_}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Flash/package.xml
fi
mv -v $INST_DIR/CLIENT_DATA/AdobeFlash_mms.cfg $INST_DIR/CLIENT_DATA/Install/Packages/Flash/mms.cfg
sed 's/.*\t<\/install>.*/\t\t<cmd path="disable32.bat" name="Disable Flash Update Check x86" \/>\n&/' -i $INST_DIR/CLIENT_DATA/Install/Packages/Flash/package.xml
sed 's/.*\t<\/install>.*/\t\t<cmd path="disable64.bat" name="Disable Flash Update Check x64" arch="x64" \/>\n&/' -i $INST_DIR/CLIENT_DATA/Install/Packages/Flash/package.xml
echo "@echo off" >> $INST_DIR/CLIENT_DATA/Install/Packages/Flash/disable32.bat
echo "copy /y /v \"%~dp0mms.cfg\" \"%WINDIR%\system32\Macromed\Flash\mms.cfg\"" >> $INST_DIR/CLIENT_DATA/Install/Packages/Flash/disable32.bat
echo "@echo off" >> $INST_DIR/CLIENT_DATA/Install/Packages/Flash/disable64.bat
echo "copy /y /v \"%~dp0mms.cfg\" \"%WINDIR%\SysWOW64\Macromed\Flash\mms.cfg\"" >> $INST_DIR/CLIENT_DATA/Install/Packages/Flash/disable64.bat
# Update Shockwave
if [ "$SHOCKUPDATE" = "1" ]; then
rm -f $INST_DIR/CLIENT_DATA/Install/Packages/Shockwave/*.msi
cp $INST_DIR/CLIENT_DATA/X86/sw_lic_full_installer-${SHOCKVERSION}.msi $INST_DIR/CLIENT_DATA/Install/Packages/Shockwave/sw_lic_full_installer.msi
sed "s!..\..\..r...!${SHOCKVERSION}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Shockwave/package.xml
sed "s!v12!v${SHOCKVERSION//r/.}!" -i $INST_DIR/CLIENT_DATA/Install/Packages/Shockwave/package.xml
fi
# move the uninstallers in place (directory layout like the sereby package)
mv -v $INST_DIR/CLIENT_DATA/X86/JavaRa $INST_DIR/CLIENT_DATA/UnInstall/Packages/JRE
mv -v $INST_DIR/CLIENT_DATA/JavaUninstallScript.vbs $INST_DIR/CLIENT_DATA/UnInstall/Packages/JRE
mv -v $INST_DIR/CLIENT_DATA/CleanSilverlight.cmd $INST_DIR/CLIENT_DATA/UnInstall/Packages/Silverlight
mv -v $INST_DIR/CLIENT_DATA/X86/dotnet $INST_DIR/CLIENT_DATA/UnInstall/NET
mv -v $INST_DIR/CLIENT_DATA/X86/uninstall_flash_player-${FLASHVERSION}.exe $INST_DIR/CLIENT_DATA/UnInstall/Packages/Flash/uninstall_flash_player.exe
mv -v $INST_DIR/CLIENT_DATA/X86/uninstall_shock_player.exe $INST_DIR/CLIENT_DATA/UnInstall/Packages/Shockwave
# move the opsi wrapper to the right dir (close the error window if nothing needs to be done)
mv -v $INST_DIR/CLIENT_DATA/opsi-WinPKG.exe $INST_DIR/CLIENT_DATA/Install/
# set exec bit on executeables
find $INST_DIR/CLIENT_DATA/Install/ -type f -print0 | xargs -0 chmod +x
find $INST_DIR/CLIENT_DATA/UnInstall/ -type f -print0 | xargs -0 chmod +x
find $INST_DIR/CLIENT_DATA -type d -print0 | xargs -0 chmod 755 -v
# delete the temp directory
rm -rf $INST_DIR/CLIENT_DATA/X86
}