Skip to content

Commit d6d3c68

Browse files
authored
Merge pull request #747 from davidcassany/integration_and_packaging
Linux: Integration and packaging
2 parents 5084f46 + cd3b23e commit d6d3c68

22 files changed

Lines changed: 96 additions & 65 deletions

.github/workflows/package.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,24 @@ jobs:
8787
- uses: actions/upload-artifact@v2
8888
if: startsWith(matrix.os, 'ubuntu-')
8989
with:
90-
name: Rancher Desktop-linux.zip
91-
path: dist/rancher-desktop*.zip
90+
name: Rancher Desktop-linux.tar.gz
91+
path: dist/rancher-desktop*.tar.gz
9292
if-no-files-found: error
9393
- uses: actions/upload-artifact@v2
9494
if: startsWith(matrix.os, 'ubuntu-')
9595
with:
9696
name: Rancher Desktop.flatpak
9797
path: dist/Rancher Desktop*.flatpak
9898
if-no-files-found: error
99+
- uses: actions/upload-artifact@v2
100+
if: startsWith(matrix.os, 'ubuntu-')
101+
with:
102+
name: Rancher Desktop.rpm
103+
path: dist/rancher-desktop*.rpm
104+
if-no-files-found: error
105+
- uses: actions/upload-artifact@v2
106+
if: startsWith(matrix.os, 'ubuntu-')
107+
with:
108+
name: Rancher Desktop.deb
109+
path: dist/rancher-desktop*.deb
110+
if-no-files-found: error

background.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async function doFirstRun() {
124124
return;
125125
}
126126
await window.openFirstRun();
127-
if (os.platform() === 'darwin') {
127+
if (os.platform() === 'darwin' || os.platform() === 'linux') {
128128
await Promise.all([
129129
linkResource('helm', true),
130130
linkResource('kim', true), // TODO: Remove when we stop shipping kim
@@ -509,10 +509,20 @@ async function getVersion() {
509509
* @param state -- true to symlink, false to delete
510510
*/
511511
async function linkResource(name: string, state: boolean): Promise<Error | null> {
512-
const linkPath = path.join('/usr/local/bin', name);
512+
const linkPath = path.join(paths.integration, name);
513+
514+
let err: Error | null = await new Promise((resolve) => {
515+
fs.mkdir(paths.integration, { recursive: true }, resolve);
516+
});
517+
518+
if (err) {
519+
console.error(`Error creating the directory ${ paths.integration }: ${ err.message }`);
520+
521+
return err;
522+
}
513523

514524
if (state) {
515-
const err: Error | null = await new Promise((resolve) => {
525+
err = await new Promise((resolve) => {
516526
fs.symlink(resources.executable(name), linkPath, 'file', resolve);
517527
});
518528

@@ -522,7 +532,7 @@ async function linkResource(name: string, state: boolean): Promise<Error | null>
522532
return err;
523533
}
524534
} else {
525-
const err: Error | null = await new Promise((resolve) => {
535+
err = await new Promise((resolve) => {
526536
fs.unlink(linkPath, resolve);
527537
});
528538

electron-builder.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ win:
2929
linux:
3030
category: Utility
3131
executableName: rancher-desktop
32-
target: [ flatpak, zip ]
32+
icon: ./resources/icons/linux
33+
synopsis: Kubernetes and container management on the desktop
34+
description: Rancher Desktop is an open-source project to bring Kubernetes and container management to the desktop
35+
target: [ flatpak, tar.gz, rpm, deb ]
3336
nsis:
3437
license: LICENSE
3538
include: build/installer.nsh
@@ -53,6 +56,7 @@ flatpak:
5356
- --filesystem=xdg-data/rancher-desktop:create
5457
- --filesystem=~/.kube:create
5558
- --filesystem=~/.kuberlr:create
59+
- --filesystem=~/.local/bin:create
5660
- --device=kvm
5761
- --device=dri
5862
- --share=ipc
@@ -63,30 +67,24 @@ flatpak:
6367
- --own-name=org.kde.* # Fixes Tray in KDE (https://github.com/flathub/im.riot.Riot/issues/100)
6468
files:
6569
- ["dist/linux-unpacked/resources/resources/linux/misc/io.rancherdesktop.app.appdata.xml", "/share/metainfo/io.rancherdesktop.app.appdata.xml"]
66-
- ["dist/linux-unpacked/resources/resources/linux/misc/io.rancherdesktop.app.desktop", "/share/applications/io.rancherdesktop.app.desktop"]
67-
- ["dist/linux-unpacked/resources/resources/icons/linux", "/share/icons/hicolor"]
6870
modules:
6971
- name: qemu
7072
config-opts:
7173
- "--disable-user"
7274
- "--enable-kvm"
73-
#- "--enable-vde"
7475
- "--target-list=x86_64-softmmu"
7576
sources:
7677
- type: archive
7778
url: https://download.qemu.org/qemu-6.1.0.tar.xz
7879
sha256: eebc089db3414bbeedf1e464beda0a7515aad30f73261abc246c9b27503a3c96
79-
# We do not need vde under linux
80-
#modules:
81-
#- name: vde-2
82-
# sources:
83-
# - type: git
84-
# url: https://github.com/virtualsquare/vde-2
85-
# tag: vde-2
86-
# buildsystem: simple
87-
# build-commands:
88-
# - |
89-
# cd 2.3.2
90-
# autoreconf --install
91-
# ./configure --prefix=/app --disable-python --disable-cryptcab
92-
# make install
80+
rpm:
81+
depends:
82+
- qemu
83+
fpm:
84+
# Make sure not /usr/lib/.build-id artifacts are created
85+
# This config is likely to be missing in non RPM based hosts
86+
- --rpm-rpmbuild-define=_build_id_links none
87+
deb:
88+
depends:
89+
- qemu-utils
90+
- qemu-system-x86
File renamed without changes.

flatpak/io.rancherdesktop.app.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ finish-args:
2222
- --filesystem=xdg-data/rancher-desktop:create
2323
- --filesystem=~/.kube:create
2424
- --filesystem=~/.kuberlr:create
25+
- --filesystem=~/.local/bin:create
2526
- --talk-name=org.freedesktop.Notifications
2627
- --own-name=org.kde.*
2728
modules:
@@ -32,49 +33,41 @@ modules:
3233
- type: dir
3334
path: ..
3435
dest: lib
36+
- type: file
37+
path: io.rancherdesktop.app.desktop
38+
dest: lib
3539
- type: script
3640
dest-filename: electron-wrapper
3741
commands:
3842
- |
3943
export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID"
4044
41-
if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then
42-
zypak-wrapper /app/lib/io.rancherdesktop.app/rancher-desktop --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"
43-
else
44-
zypak-wrapper /app/lib/io.rancherdesktop.app/rancher-desktop "$@"
45-
fi
45+
zypak-wrapper /app/lib/io.rancherdesktop.app/rancher-desktop "$@"
4646
build-commands:
4747
# Bundle electron build after npm run build -- --linux --publish=never
4848
- cp -a dist/linux*unpacked /app/lib/io.rancherdesktop.app
4949
# Include FreeDesktop integration files at expected locations
5050
- rm -rf /app/share/metainfo /app/share/icons /app/share/applications
51-
- mkdir -p /app/share/metainfo /app/share/icons /app/share/applications
51+
- mkdir -p /app/share/metainfo /app/share/applications
52+
- |
53+
icons=/app/lib/io.rancherdesktop.app/resources/resources/icons/linux
54+
for img in $(ls "${icons}"); do
55+
size="${img//rancher-desktop./}"
56+
size="${size%%.png}"
57+
mkdir "/app/share/icons/hicolor/${size}/apps" -p
58+
cp "${icons}/${img}" "/app/share/icons/hicolor/${size}/apps/io.rancherdesktop.app.png"
59+
done
5260
- cp /app/lib/io.rancherdesktop.app/resources/resources/linux/misc/io.rancherdesktop.app.appdata.xml /app/share/metainfo
53-
- cp /app/lib/io.rancherdesktop.app/resources/resources/linux/misc/io.rancherdesktop.app.desktop /app/share/applications
54-
- cp -r /app/lib/io.rancherdesktop.app/resources/resources/icons/linux /app/share/icons/hicolor
61+
- mv io.rancherdesktop.app.desktop /app/share/applications
5562
# Install app wrapper
5663
- install -Dm755 -t /app/bin/ ../electron-wrapper
5764
modules:
5865
- name: qemu
5966
config-opts:
6067
- "--disable-user"
6168
- "--enable-kvm"
62-
#- "--enable-vde"
6369
- "--target-list=x86_64-softmmu"
6470
sources:
6571
- type: archive
6672
url: https://download.qemu.org/qemu-6.1.0.tar.xz
6773
sha256: eebc089db3414bbeedf1e464beda0a7515aad30f73261abc246c9b27503a3c96
68-
#modules:
69-
#- name: vde-2
70-
# sources:
71-
# - type: git
72-
# url: https://github.com/virtualsquare/vde-2
73-
# tag: vde-2
74-
# buildsystem: simple
75-
# build-commands:
76-
# - |
77-
# cd 2.3.2
78-
# autoreconf --install
79-
# ./configure --prefix=/app --disable-python --disable-cryptcab
80-
# make install

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"name": "rancher-desktop",
33
"license": "Apache-2.0",
44
"version": "0.6.0",
5+
"author": {
6+
"name": "SUSE",
7+
"email": "containers@suse.com"
8+
},
59
"engines": {
610
"node": ">=14.14"
711
},

resources/icons/linux/128x128/apps/io.rancherdesktop.app.png renamed to resources/icons/linux/rancher-desktop.128x128.png

File renamed without changes.
File renamed without changes.

resources/icons/linux/256x256/apps/io.rancherdesktop.app.png renamed to resources/icons/linux/rancher-desktop.256x256.png

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)