Skip to content

Commit

Permalink
Allow prefixes other than /usr/bin
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Jun 26, 2018
1 parent 30e6d70 commit 9f63e28
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion 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
Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gtk/assets/com.system76.pkexec.popsicle.policy
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion gtk/assets/popsicle-pkexec
@@ -1,2 +1,2 @@
#!/bin/sh
pkexec /usr/bin/popsicle-gtk $@
pkexec /usr/local/bin/popsicle-gtk $@
2 changes: 1 addition & 1 deletion gtk/assets/popsicle.desktop
Expand Up @@ -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

0 comments on commit 9f63e28

Please sign in to comment.