blob: 09ca1eb3f15afa1e9003cc07a7ed58481358f35f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# Maintainer: Dominic Giebert <dominic.giebert@gmail.com>
# Contributor: Parker Johansen <johansen.parker@gmail.com>
pkgname=rancher-desktop
pkgdesc='Rancher Desktop is an open-source project to bring Kubernetes and container management to the desktop'
pkgver=1.2.1
pkgrel=1
arch=('x86_64')
license=('Apache')
url='https://rancherdesktop.io/'
makedepends=('npm' 'nvm' 'nodejs' 'imagemagick' 'go')
optdepends=('kubectl: Kubernetes control, can be downloaded from settings'
'nerdctl-bin: Docker-compatible CLI for containerd'
'helm: for Apps section, only useful if your deploy uses helm or plan to use it')
provides=('rancher-desktop' 'docker' 'helm' 'kubectl' 'nerdctl' 'limactl')
depends=('qemu')
source=("https://github.com/rancher-sandbox/rancher-desktop/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('fdcf88f33741c6a838c344389ecb7d77a4c9b6b92c8586ff1b5e57cbe521196a')
# https://wiki.archlinux.org/title/Node.js_package_guidelines#Using_nvm
_ensure_local_nvm() {
which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
export NVM_DIR="${srcdir}/.nvm"
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}
prepare() {
_ensure_local_nvm
nvm install 16.14.0
cd "${pkgname}-${pkgver}"
sed -i "s|childProcess.execFileSync('git', \['describe', '--tags'\]).toString().trim()|'v${pkgver}'|g" scripts/build.mjs
# Uncomment if you want to have the tray functionality
# sed -i "/if (os.platform() === 'linux' \&\& !settings.isFirstRun()) {\$/,+2d" background.ts
}
build() {
_ensure_local_nvm
cd "${pkgname}-${pkgver}"
# Generate icons
icon="resources/icons/logo-square-512.png"
for size in 512x512 256x256 128x128 96x96 64x64 48x48 32x32 24x24 16x16; do
mkdir "share/icons/hicolor/${size}/apps" -p
convert -resize "${size}" "${icon}" "share/icons/hicolor/${size}/apps/${pkgname}.png"
done
sed -i "s|Exec=rancher-desktop|Exec=opt/${pkgname}/rancher-desktop|g" packaging/linux/rancher-desktop.desktop
sed -i "s|target: \[ zip \]|target: [ dir ]|g" electron-builder.yml
# Remove Flatpak and appimage as they are not needed
rm packaging/linux/appimage.yml
rm packaging/linux/flatpak.yaml
# https://github.com/rancher-sandbox/rancher-desktop#how-to-run
npm install
npm run build
}
package() {
cd "${pkgname%-bin}-$pkgver"
# Copy over the data
install -d "$pkgdir/opt/${pkgname}"
install -d "$pkgdir/usr/share/icons/hicolor/"
cp -r dist/linux-unpacked/* "$pkgdir/opt/${pkgname}/"
cp -r share/icons/hicolor/* "$pkgdir/usr/share/icons/hicolor/"
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
# Some weird fix
sed -i "s|opt/rancher-desktop/||g" packaging/linux/rancher-desktop.desktop
# Add integration for desktop env
install -Dm644 packaging/linux/rancher-desktop.desktop -t "$pkgdir/usr/share/applications"
install -Dm644 packaging/linux/rancher-desktop.appdata.xml -t "$pkgdir/usr/share/metainfo"
# Creating the symlink for better usage
install -d "$pkgdir"/usr/bin/
ln -sf /opt/${pkgname}/${pkgname} ${pkgdir}/usr/bin/${pkgname}
ln -sf /opt/${pkgname}/resources/resources/linux/lima/bin/limactl ${pkgdir}/usr/bin/limactl
}
|