Skip to content

Commit 9eb6977

Browse files
guillaumerosepraveenkumar
authored andcommitted
Change install path of crc to /Applications/CodeReady Containers.app
It uses the tray as a conveyor for the full crc application. Everything is installed in /Applications/CodeReady Containers.app. If the user wants to uninstall the app, he just has to drag and drop the app in the trash (after running crc cleanup). When upgrading, all files will be replaced with newer. There is no more one directory per version.
1 parent 94b5249 commit 9eb6977

7 files changed

Lines changed: 25 additions & 16 deletions

File tree

Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ BUNDLE_VERSION = 4.7.4
44
BUNDLE_EXTENSION = crcbundle
55
CRC_VERSION = 1.24.0
66
COMMIT_SHA=$(shell git rev-parse --short HEAD)
7-
MACOS_INSTALL_PATH = /Library/CodeReady Containers
7+
MACOS_INSTALL_PATH = /Applications/CodeReady Containers.app/Contents/Resources/
88
CONTAINER_RUNTIME ?= podman
99

1010
ifdef OKD_VERSION
@@ -252,20 +252,26 @@ update-go-version:
252252
goversioncheck:
253253
./verify-go-version.sh
254254

255+
TRAY_RELEASE ?= packaging/tmp/crc-tray-macos.tar.gz
256+
255257
packagedir: LDFLAGS+= -X '$(REPOPATH)/pkg/crc/version.macosInstallPath=$(MACOS_INSTALL_PATH)' $(RELEASE_VERSION_VARIABLES)
256258
packagedir: clean check_bundledir $(BUILD_DIR)/macos-amd64/crc $(HOST_BUILD_DIR)/crc-embedder
259+
echo -n $(CRC_VERSION) > packaging/VERSION
257260
sed -e 's/__VERSION__/'$(CRC_VERSION)'/g' -e 's@__INSTALL_PATH__@$(MACOS_INSTALL_PATH)@g' packaging/darwin/Distribution.in >packaging/darwin/Distribution
258261
sed -e 's/__VERSION__/'$(CRC_VERSION)'/g' -e 's@__INSTALL_PATH__@$(MACOS_INSTALL_PATH)@g' packaging/darwin/welcome.html.in >packaging/darwin/Resources/welcome.html
259262
sed -e 's/__VERSION__/'$(CRC_VERSION)'/g' -e 's@__INSTALL_PATH__@$(MACOS_INSTALL_PATH)@g' packaging/darwin/postinstall.in >packaging/darwin/scripts/postinstall
260263
chmod 755 packaging/darwin/scripts/postinstall
261-
mkdir -p packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/
262-
$(HOST_BUILD_DIR)/crc-embedder download packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/
264+
mkdir -p packaging/tmp/
265+
$(HOST_BUILD_DIR)/crc-embedder download packaging/tmp/
266+
267+
mkdir -p packaging/root/Applications
268+
tar -C packaging/root/Applications -xvzf $(TRAY_RELEASE)
269+
rm packaging/tmp/crc-tray-macos.tar.gz
263270

264-
tar -C packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/ -xvzf packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/crc-tray-macos.tar.gz
265-
rm packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/crc-tray-macos.tar.gz
271+
mv packaging/tmp/* packaging/root/"$(MACOS_INSTALL_PATH)"
266272

267-
cp $(HYPERKIT_BUNDLENAME) packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/
268-
cp $(BUILD_DIR)/macos-amd64/crc packaging/root/"$(MACOS_INSTALL_PATH)"/$(CRC_VERSION)/
273+
cp $(HYPERKIT_BUNDLENAME) packaging/root/"$(MACOS_INSTALL_PATH)"
274+
cp $(BUILD_DIR)/macos-amd64/crc packaging/root/"$(MACOS_INSTALL_PATH)"
269275
cp LICENSE packaging/darwin/Resources/LICENSE.txt
270276
pkgbuild --analyze --root packaging/root packaging/components.plist
271277
plutil -replace BundleIsRelocatable -bool NO packaging/components.plist

packaging/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ root/
44
/darwin/Resources/LICENSE.txt
55
/darwin/Resources/welcome.html
66
/darwin/scripts/postinstall
7+
/VERSION

packaging/darwin/postinstall.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22
set -e
33

4-
chmod 755 "__INSTALL_PATH__"/__VERSION__/crc
4+
chmod 755 "__INSTALL_PATH__"/crc
55

66
[ -d /usr/local/bin ] || mkdir /usr/local/bin
77

88
rm -f /usr/local/bin/crc
99

10-
ln -s "__INSTALL_PATH__"/__VERSION__/crc /usr/local/bin/crc
10+
ln -s "__INSTALL_PATH__"/crc /usr/local/bin/crc

packaging/package.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ function sign() {
1919
codesign --deep --sign "${CODESIGN_IDENTITY}" --options runtime --force ${opts} "$1"
2020
}
2121

22-
version=$(ls "${BASEDIR}/root/Library/CodeReady Containers/")
22+
binDir="${BASEDIR}/root/Applications/CodeReady Containers.app/Contents/Resources"
23+
24+
version=$(cat "${BASEDIR}/VERSION")
2325

24-
binDir="${BASEDIR}/root/Library/CodeReady Containers/${version}"
2526
sign "${binDir}/crc"
2627
sign "${binDir}/admin-helper-darwin"
2728
sign "${binDir}/crc-driver-hyperkit"
28-
sign "${binDir}/CodeReady Containers.app"
29+
30+
sign "${BASEDIR}/root/Applications/CodeReady Containers.app"
2931

3032
codesign --verify --verbose "${binDir}/hyperkit"
3133

32-
pkgbuild --identifier com.redhat.crc.${version} --version ${version} \
34+
pkgbuild --identifier com.redhat.crc --version ${version} \
3335
--scripts "${BASEDIR}/darwin/scripts" \
3436
--root "${BASEDIR}/root" \
3537
--install-location / \

pkg/crc/constants/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var (
106106

107107
func defaultBundlePath() string {
108108
if runtime.GOOS == "darwin" && version.IsMacosInstallPathSet() {
109-
path := filepath.Join(version.GetMacosInstallPath(), version.GetCRCVersion(), GetDefaultBundle())
109+
path := filepath.Join(version.GetMacosInstallPath(), GetDefaultBundle())
110110
if _, err := os.Stat(path); err == nil {
111111
return path
112112
}

pkg/crc/constants/constants_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var (
2323

2424
func trayAppBundlePath() string {
2525
if version.IsMacosInstallPathSet() {
26-
path := filepath.Join(version.GetMacosInstallPath(), version.GetCRCVersion(), TrayExecutableName)
26+
path := filepath.Join(filepath.Dir(filepath.Dir(version.GetMacosInstallPath())), TrayExecutableName)
2727
if _, err := os.Stat(path); err == nil {
2828
return path
2929
}

pkg/embed/embed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
func openEmbeddedFile(executablePath, embedName string) (io.ReadCloser, error) {
1616
if runtime.GOOS == "darwin" && version.IsMacosInstallPathSet() {
17-
path := filepath.Join(version.GetMacosInstallPath(), version.GetCRCVersion(), embedName)
17+
path := filepath.Join(version.GetMacosInstallPath(), embedName)
1818
if _, err := os.Stat(path); err == nil {
1919
return os.Open(path)
2020
}

0 commit comments

Comments
 (0)