From 1a5161455e1a4ccee521718eaa5918549722f84c Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Mon, 14 Nov 2022 22:22:50 +0100
Subject: [PATCH] Fix font installation

---
 scripts/PopOS/fonts.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/PopOS/fonts.sh b/scripts/PopOS/fonts.sh
index 55230541..469a6ccd 100755
--- a/scripts/PopOS/fonts.sh
+++ b/scripts/PopOS/fonts.sh
@@ -5,5 +5,10 @@ then
     sudo bash "$BASH_SOURCE" "$USER"
 else
     homeDir=$(sudo -u $1 bash -c 'realpath ~')
-    cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" /usr/share/font/opentype
+    fontFileBaseName="Caskaydia Cove Regular Nerd Font Complete.otf"
+    tempFile=$(sudo -u $1 mktemp -d)/$fontFileBaseName
+    destination=/usr/share/font/opentype
+
+    sudo -u $1 cp "$homeDir/Nextcloud/Caskaydia Cove Regular Nerd Font Complete.otf" "$tempFile"
+    cp "$tempFile" /usr/share/fonts/opentype
 fi