Skip to content

Commit cbce7aa

Browse files
committed
[create-pkg] Clean up previous installations
Adds a preinstall script which will completely delete our primary installation directory of /Library/Frameworks/Xamarin.Android.framework before the pkg is installed. These changes ensure that we don't leave old versions behind when a new version is installed.
1 parent 78640d8 commit cbce7aa

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

build-tools/create-pkg/create-pkg.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PkgDistributionDestination>$(OutputPath)\pkg\distribution.xml</PkgDistributionDestination>
1616
<PkgLicenseSrcEn Condition="'$(PkgLicenseSrcEn)' == ''">$(XamarinAndroidSourcePath)\LICENSE</PkgLicenseSrcEn>
1717
<PkgLicenseDestinationEn>$(PkgResourcesPath)\en.lproj</PkgLicenseDestinationEn>
18+
<PkgScriptsDir>$(MSBuildThisFileDirectory)scripts</PkgScriptsDir>
1819
<UpdateInfoGuid>d1ec039f-f3db-468b-a508-896d7c382999</UpdateInfoGuid>
1920
</PropertyGroup>
2021
<Target Name="_CopyFilesToPayloadDir"
@@ -120,6 +121,7 @@
120121
<PkgBuildArgs Include="--identifier com.xamarin.android.pkg" />
121122
<PkgBuildArgs Include="--version $(XAVersion)"/>
122123
<PkgBuildArgs Include="--install-location &quot;$(PkgInstallDir)&quot; "/>
124+
<PkgBuildArgs Include="--scripts &quot;$(PkgScriptsDir)&quot; "/>
123125
<PkgBuildArgs Include="&quot;$(PkgOutputPath)/xamarin.android.pkg&quot; "/>
124126
</ItemGroup>
125127
<Exec Command="pkgbuild @(PkgBuildArgs, ' ')" />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
DESTINATION=/Library/Frameworks/Xamarin.Android.framework
4+
5+
# Ensure installations of previous versions are cleaned up
6+
# by deleting all content in our installation directory root.
7+
if [ -d "$DESTINATION" ]; then
8+
rm -rf "$DESTINATION"
9+
fi

0 commit comments

Comments
 (0)