Repository: pop-os/popsicle (language: rust)

Issue:
Install Location
By default the Makefile for popsicle installs `popsicle-gtk` at `/usr/local/bin/popsicle-gtk` but `popsicle-pkexec` expects `popsicle-gtk` to located to `/usr/bin/popsicle-gtk`.  Is there a reason why in the Makefile `prefix` is `/usr/local` by default when other code seems to assume `/usr` or is this a bug?


Discussion / hints:

Fix patch:
diff --git a/Makefile b/Makefile
index 751f797..67e694c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
-prefix ?= /usr/local
+default_prefix = /usr/local
+prefix ?= $(default_prefix)
 exec_prefix = $(prefix)
 bindir = $(exec_prefix)/bin
 libdir = $(exec_prefix)/lib
@@ -24,6 +25,9 @@ ICONS=\
 	24x24@2x/apps/$(BIN).png \
 	512x512@2x/apps/$(BIN).png
 
+BEFORE := $(shell echo $(default_prefix) | sed 's/\//\\\//g')
+AFTER := $(shell echo $(prefix) | sed 's/\//\\\//g')
+
 all: cli gtk
 
 cli: target/release/$(BIN) target/release/$(BIN).1.gz
@@ -49,6 +53,11 @@ install-gtk: gtk
 		install -D -m 0644 "gtk/assets/icons/$$icon" "$(DESTDIR)$(datadir)/icons/hicolor/$$icon"; \
 	done
 
+	# Fix paths in assets
+	sed -i -e 's/$(BEFORE)/$(AFTER)/g' $(DESTDIR)$(datadir)/applications/popsicle.desktop \
+		&& sed -i -e 's/$(BEFORE)/$(AFTER)/g' $(DESTDIR)$(datadir)/polkit-1/actions/$(POLICY) \
+		&& sed -i -e 's/$(BEFORE)/$(AFTER)/g' $(DESTDIR)$(bindir)/$(PKEXEC_BIN)
+
 install: all install-cli install-gtk
 
 uninstall-cli:
diff --git a/gtk/assets/com.system76.pkexec.popsicle.policy b/gtk/assets/com.system76.pkexec.popsicle.policy
index 5c5f201..daabdcc 100644
--- a/gtk/assets/com.system76.pkexec.popsicle.policy
+++ b/gtk/assets/com.system76.pkexec.popsicle.policy
@@ -12,7 +12,7 @@
       <allow_inactive>auth_admin</allow_inactive>
       <allow_active>auth_admin</allow_active>
     </defaults>
-    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/popsicle-gtk</annotate>
+    <annotate key="org.freedesktop.policykit.exec.path">/usr/local/bin/popsicle-gtk</annotate>
     <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
   </action>
 
diff --git a/gtk/assets/popsicle-pkexec b/gtk/assets/popsicle-pkexec
index e611ac0..ff0d343 100644
--- a/gtk/assets/popsicle-pkexec
+++ b/gtk/assets/popsicle-pkexec
@@ -1,2 +1,2 @@
 #!/bin/sh
-pkexec /usr/bin/popsicle-gtk $@
\ No newline at end of file
+pkexec /usr/local/bin/popsicle-gtk $@
diff --git a/gtk/assets/popsicle.desktop b/gtk/assets/popsicle.desktop
index 9b8fbae..eb003b7 100644
--- a/gtk/assets/popsicle.desktop
+++ b/gtk/assets/popsicle.desktop
@@ -9,4 +9,4 @@ Keywords=USB;Flash;Drive;Popsicle;
 MimeType=application/x-cd-image;application/x-raw-disk-image;application/x-raw-disk-image-xz-compressed;
 Terminal=false
 StartupNotify=true
-Exec=/usr/bin/popsicle-pkexec %U
+Exec=/usr/local/bin/popsicle-pkexec %U


Test patch: