Skip to content

Instantly share code, notes, and snippets.

@vaxvhbe
Created March 11, 2024 09:11
Show Gist options
  • Save vaxvhbe/ce679df15fc521c8aca1ff9ddf537201 to your computer and use it in GitHub Desktop.
Save vaxvhbe/ce679df15fc521c8aca1ff9ddf537201 to your computer and use it in GitHub Desktop.
incus-ui
%global _canonical_name lxd-ui
%global pkgname incus-ui-canonical
%global pkgver 0.6
%global pkgrel 1
%global debug_package %{nil}
Name: %{pkgname}
Version: %{pkgver}
Release: %{pkgrel}%{?dist}
Summary: lxd-ui rebranded to incus
License: GPL3
URL: https://github.com/KosmX/incus-ui-canonical-arch
Source0: https://github.com/zabbly/incus/archive/refs/heads/daily.tar.gz
Source1: https://github.com/canonical/lxd-ui/archive/refs/tags/%{pkgver}.tar.gz
Source2: incus.service
BuildRequires: git
BuildRequires: yarnpkg
BuildRequires: npm
BuildRequires: rsync
%description
lxd-ui rebranded to incus.
%prep
%setup -q -c -a 1
REPO=$(pwd)/incus-daily
cd %{_canonical_name}-%{pkgver}
# Apply patches
git apply -p1 < ${REPO}/patches/ui-canonical-0001-Branding.patch
patch -p1 -i ${REPO}/patches/ui-canonical-0002-Update-navigation.patch
patch -p1 -i ${REPO}/patches/ui-canonical-0003-Update-certificate-generation.patch
patch -p1 -i ${REPO}/patches/ui-canonical-0004-Remove-external-links.patch
patch -p1 -i ${REPO}/patches/ui-canonical-0005-Remove-Canonical-image-servers.patch
patch -p1 -i ${REPO}/patches/ui-canonical-0006-Remove-version-check.patch
# Generic renaming
sed -i "s/LXD/Incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
sed -i "s/devlxd/guestapi/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
sed -i "s/dev\/lxd/dev\/incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
sed -i "s/lxd_/incus_/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
sed -i "s/\"lxd\"/\"incus\"/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
%build
cd %{_canonical_name}-%{pkgver}
yarn install
yarn build
%install
cd %{_canonical_name}-%{pkgver}
mkdir -p %{buildroot}/opt/incus/ui-canonical/
rsync -a build/ui/ %{buildroot}/opt/incus/ui/
mkdir -p %{buildroot}/etc/systemd/system/
install -p -m 0644 %{SOURCE2} %{buildroot}/etc/systemd/system/
%files
/opt/incus/ui/*
/etc/systemd/system/incus.service
%changelog
[Unit]
Description=Incus Container Hypervisor
After=network-online.target openvswitch-switch.service lxcfs.service incus.socket
Requires=network-online.target lxcfs.service incus.socket
Documentation=man:incusd(1)
[Service]
Environment=INCUS_DOCUMENTATION=/usr/share/doc/incus-doc/html
Environment=INCUS_OVMF_PATH=/usr/share/edk2/ovmf
Environment=INCUS_UI=/opt/incus/ui/
ExecStart=/usr/lib/incus/incusd --group=incus-admin
ExecStartPost=/usr/lib/incus/incusd waitready --timeout=600
ExecStop=/usr/lib/incus/incusd shutdown
KillMode=process
TimeoutStartSec=600s
TimeoutStopSec=30s
Restart=on-failure
Delegate=yes
LimitNOFILE=1048576
LimitNPROC=infinity
LimitCORE=infinity
TasksMax=infinity
[Install]
Also=incus-startup.service incus.socket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment