From 0087a6b6654c8b190899c5f8aeadd007c0f634b3 Mon Sep 17 00:00:00 2001
From: Raboneko <119771935+raboneko@users.noreply.github.com>
Date: Fri, 23 Jan 2026 20:25:10 -0800
Subject: [PATCH] add: kopia (#9450) (#9466)
* add: kopia
* validate installed desktop file
* use `%{evr}` macro
* add missing period in description
(cherry picked from commit 07e395063393107193f52d2176d5b83b7c5b4507)
Co-authored-by: metcya <134973769+metcya@users.noreply.github.com>
---
anda/apps/kopia/anda.hcl | 5 ++
anda/apps/kopia/fix-electron-output-dir.patch | 13 +++
anda/apps/kopia/io.kopia.ui.desktop | 7 ++
anda/apps/kopia/io.kopia.ui.metainfo.xml | 13 +++
anda/apps/kopia/kopia.spec | 84 +++++++++++++++++++
anda/apps/kopia/update.rhai | 1 +
6 files changed, 123 insertions(+)
create mode 100644 anda/apps/kopia/anda.hcl
create mode 100644 anda/apps/kopia/fix-electron-output-dir.patch
create mode 100644 anda/apps/kopia/io.kopia.ui.desktop
create mode 100644 anda/apps/kopia/io.kopia.ui.metainfo.xml
create mode 100644 anda/apps/kopia/kopia.spec
create mode 100644 anda/apps/kopia/update.rhai
diff --git a/anda/apps/kopia/anda.hcl b/anda/apps/kopia/anda.hcl
new file mode 100644
index 0000000000..1773be8778
--- /dev/null
+++ b/anda/apps/kopia/anda.hcl
@@ -0,0 +1,5 @@
+project pkg {
+ rpm {
+ spec = "kopia.spec"
+ }
+}
diff --git a/anda/apps/kopia/fix-electron-output-dir.patch b/anda/apps/kopia/fix-electron-output-dir.patch
new file mode 100644
index 0000000000..d6d7377616
--- /dev/null
+++ b/anda/apps/kopia/fix-electron-output-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/app/package.json b/app/package.json
+index bd3a699a..df05befa 100644
+--- a/app/package.json
++++ b/app/package.json
+@@ -45,7 +45,7 @@
+ ],
+ "directories": {
+ "buildResources": "assets",
+- "output": "../dist/kopia-ui"
++ "output": "./dist"
+ },
+ "nsis": {
+ "oneClick": false,
diff --git a/anda/apps/kopia/io.kopia.ui.desktop b/anda/apps/kopia/io.kopia.ui.desktop
new file mode 100644
index 0000000000..0fe5a8ffff
--- /dev/null
+++ b/anda/apps/kopia/io.kopia.ui.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Terminal=false
+Name=KopiaUI
+Comment=Fast and secure open-source backup/restore tool
+Exec=kopia-ui
+Icon=kopia
diff --git a/anda/apps/kopia/io.kopia.ui.metainfo.xml b/anda/apps/kopia/io.kopia.ui.metainfo.xml
new file mode 100644
index 0000000000..875b109407
--- /dev/null
+++ b/anda/apps/kopia/io.kopia.ui.metainfo.xml
@@ -0,0 +1,13 @@
+
+ KopiaUI
+
+ A backup/restore tool that allows you to create encrypted snapshots
+
+
+ System
+ Network
+
+
+ kopia-ui
+
+
diff --git a/anda/apps/kopia/kopia.spec b/anda/apps/kopia/kopia.spec
new file mode 100644
index 0000000000..7d9ea4fef5
--- /dev/null
+++ b/anda/apps/kopia/kopia.spec
@@ -0,0 +1,84 @@
+%global appid io.kopia.ui
+%global appstream_component desktop-application
+
+Name: kopia
+%electronmeta -D
+Version: 0.22.3
+Release: 1%{?dist}
+Summary: A backup/restore tool that allows you to create encrypted snapshots
+
+License: Apache-2.0 AND CC0-1.0 AND %{electron_license}
+URL: https://kopia.io/
+Source0: https://github.com/kopia/kopia/archive/v%{version}.tar.gz
+Source1: io.kopia.ui.desktop
+Source2: io.kopia.ui.metainfo.xml
+Patch0: fix-electron-output-dir.patch
+ExclusiveArch: %{golang_arches_future}
+Packager: metcya
+
+BuildRequires: go-rpm-macros
+BuildRequires: terra-appstream-helper
+
+%global gui_name %{name}-ui
+
+%package -n %{gui_name}
+Summary: GUI for %{name}
+Requires: %{name} = %{evr}
+ExclusiveArch: %{electron_arches}
+
+%description
+Kopia is a fast and secure open-source backup/restore tool that allows you to
+create encrypted snapshots of your data and save the snapshots to remote or
+cloud storage of your choice, to network-attached storage or server, or locally
+on your machine. Kopia does not 'image' your whole machine. Rather, Kopia
+allows you to backup/restore any and all files/directories that you deem are
+important or critical.
+
+%description -n %{gui_name}
+A graphical user interface for %{name}.
+
+%prep
+%autosetup -p1
+
+%build
+%global gomodulesmode GO111MODULE=on
+%gobuild -o %{name} .
+
+pushd app
+%npm_build -B
+popd
+
+%install
+install -Dm 755 %{name} -t %{buildroot}%{_bindir}
+
+pushd app
+%electron_install -b %{gui_name} -d %{gui_name} -s %{gui_name} -I ../icons
+popd
+
+# the offical package for kopia-ui includes a bundled copy of the kopia binary
+# but we'll just symlink it
+mkdir -p %{buildroot}%{_libdir}/%{gui_name}/resources/server
+%{__ln_s} %{_bindir}/%{name} %{buildroot}%{_libdir}/%{gui_name}/resources/server/%{name}
+
+%desktop_file_install %{S:1}
+
+%terra_appstream -o %{S:2}
+
+%check
+%desktop_file_validate %{buildroot}%{_appsdir}/%{appid}.desktop
+
+%files
+%license README.md
+%doc LICENSE
+%{_bindir}/%{name}
+
+%files -n %{gui_name}
+%{_bindir}/%{gui_name}
+%{_libdir}/%{gui_name}/
+%{_appsdir}/%{appid}.desktop
+%{_metainfodir}/%{appid}.metainfo.xml
+%{_hicolordir}/*/apps/kopia.png
+
+%changelog
+* Thu Jan 22 2026 metcya - 0.22.3-1
+- Initial package
diff --git a/anda/apps/kopia/update.rhai b/anda/apps/kopia/update.rhai
new file mode 100644
index 0000000000..a36be96a92
--- /dev/null
+++ b/anda/apps/kopia/update.rhai
@@ -0,0 +1 @@
+rpm.version(gh("kopia/kopia"));