.desktop files installed by gui/
Hello,
Currently, gui/Makefile installs three .desktop files:
* /usr/share/system-config-selinux/selinux-polgengui.desktop (with "Exec=/usr/bin/selinux-polgengui")
* /usr/share/system-config-selinux/sepolicy.desktop (with "Exec=/usr/bin/sepolicy gui")
* /usr/share/system-config-selinux/system-config-selinux.desktop (with Exec=/usr/bin/system-config-selinux)
There are several issues about them:
* The first one does not work because "make install" does not create /usr/bin/selinux-polgengui. It creates /usr/share/system-config-selinux/polgengui.py instead.
* The first two ones do not work on Arch Linux because the commands they use need to be run as root in order to load.
* None of them are seen by GNOME or XFCE, which look for .desktop files in /usr/share/applications/. This has been reported for Arch Linux on https://github.com/archlinuxhardened/selinux/issues/20.
Are these files used by other distributions? Would it break things if these files are moved to /usr/share/applications/ and if pkexec is introduced in order to run commands as root (ie. selinux-polgengui.desktop is changed to "Exec=/usr/bin/pkexec /usr/share/system-config-selinux/polgengui.py" and sepolicy.desktop to "Exec=/usr/bin/pkexec /usr/bin/sepolicy gui")?
Nicolas
Quoted 20 lines · Nicolas Iooss
Hello,
Currently, gui/Makefile installs three .desktop files:
*/usr/share/system-config-selinux/selinux-polgengui.desktop(with "Exec=/usr/bin/selinux-polgengui")
*/usr/share/system-config-selinux/sepolicy.desktop(with "Exec=/usr/bin/sepolicy gui")
*/usr/share/system-config-selinux/system-config-selinux.desktop(with Exec=/usr/bin/system-config-selinux)There are several issues about them:
* The first one does not work because "make install" does not create/usr/bin/selinux-polgengui. It creates/usr/share/system-config-selinux/polgengui.pyinstead.
* The first two ones do not work on Arch Linux because the commands they use need to be run as root in order to load.
* None of them are seen by GNOME or XFCE, which look for .desktop files in/usr/share/applications/. This has been reported for Arch Linux on https://github.com/archlinuxhardened/selinux/issues/20.
Quoted 2 lines
Are these files used by other distributions? Would it break things if these files are moved to
/usr/share/applications/
This is from Fedora policycoreutils.spec:
---
ln -sf /usr/share/system-config-selinux/polgengui.py %{buildroot}%{_bindir}/selinux-polgengui
desktop-file-install --dir %{buildroot}%{_datadir}/applications --add-category Settings \
%{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.desktop
desktop-file-install --dir %{buildroot}%{_datadir}/applications --add-category Settings \
%{buildroot}%{_datadir}/system-config-selinux/sepolicy.desktop
desktop-file-install --dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/system-config-selinux/selinux-polgengui.desktop
rm -f %{buildroot}%{_datadir}/system-config-selinux/selinux-polgengui.desktop rm -f %{buildroot}%{_datadir}/system-config-selinux/sepolicy.desktop rm -f %{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.desktop
---
It's been like that for more than 6 years already.
Given that it addresses almost all the described problems I can say that your proposed changes won't break anything in Fedora.
Quoted 6 lines
and if pkexec is
introduced in order to run commands as root (ie. selinux-polgengui.desktop is changed to "Exec=/usr/bin/pkexec/usr/share/system-config-selinux/polgengui.py" and sepolicy.desktop to "Exec=/usr/bin/pkexec/usr/bin/sepolicygui")?
/usr/share/system-config-selinux/polgengui.py works without root on Fedora.
sepolicy gui asks for privileges on "Action:
org.selinux.customized" which is decorated by @slip.dbus.polkit.require_auth so I'm not sure if pkexec is really needed.
Quoted 1 line
Nicolas
Quoted 58 lines · Petr Lautrbach
Quoted 26 lines · Nicolas Iooss
Hello,
Currently, gui/Makefile installs three .desktop files:
*/usr/share/system-config-selinux/selinux-polgengui.desktop(with
"Exec=/usr/bin/selinux-polgengui")
*/usr/share/system-config-selinux/sepolicy.desktop(with "Exec=/usr/bin/sepolicy gui")
*/usr/share/system-config-selinux/system-config-selinux.desktop(with
Exec=/usr/bin/system-config-selinux)There are several issues about them:
* The first one does not work because "make install" does not create/usr/bin/selinux-polgengui. It creates/usr/share/system-config-selinux/polgengui.pyinstead.
* The first two ones do not work on Arch Linux because the commands
they use need to be run as root in order to load.
* None of them are seen by GNOME or XFCE, which look for .desktop
files in/usr/share/applications/. This has been reported for Arch
Linux on https://github.com/archlinuxhardened/selinux/issues/20.Quoted 3 lines
Are these files used by other distributions? Would it break things if
these files are moved to/usr/share/applications/This is from Fedora policycoreutils.spec:
---
ln -sf/usr/share/system-config-selinux/polgengui.py%{buildroot}%{_bindir}/selinux-polgenguidesktop-file-install --dir %{buildroot}%{_datadir}/applications --add-category Settings \
%{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.desktopdesktop-file-install --dir %{buildroot}%{_datadir}/applications --add-category Settings \
%{buildroot}%{_datadir}/system-config-selinux/sepolicy.desktopdesktop-file-install --dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/system-config-selinux/selinux-polgengui.desktoprm -f %{buildroot}%{_datadir}/system-config-selinux/selinux-polgengui.desktop rm -f %{buildroot}%{_datadir}/system-config-selinux/sepolicy.desktop rm -f %{buildroot}%{_datadir}/system-config-selinux/system-config-selinux.desktop
---
Quoted 5 lines
It's been like that for more than 6 years already.
Given that it addresses almost all the described problems I can say that
your proposed changes won't break anything in Fedora.
I haven't even packaged the gui on Gentoo, so its definitely not a regression here :)
Quoted 9 lines
Quoted 8 lines
and if pkexec is
introduced in order to run commands as root (ie. selinux-polgengui.desktop is changed to "Exec=/usr/bin/pkexec/usr/share/system-config-selinux/polgengui.py" and sepolicy.desktop to
"Exec=/usr/bin/pkexec/usr/bin/sepolicygui")?
Quoted 8 lines
/usr/share/system-config-selinux/polgengui.pyworks without root on
Fedora.sepolicy gui asks for privileges on "Action:
org.selinux.customized" which is decorated by @slip.dbus.polkit.require_auth so I'm not sure if pkexec is really needed.
If it works without thats obviously the best. But also I seem to recall pkexec had issues on my machine. It might need policy updates?
Not that I'd be opposed if you added pkexec since its not used here at all right now so if I added the gui I'd just fix pkexec first.
-- Jason
Quoted 3 lines
Quoted 2 lines
Nicolas
PATCH 1/2 gui: Install polgengui.py to /usr/bin/selinux-polgengui
In reply to Petr Lautrbachpolgengui.py is a standalone gui tool which should be in /usr/bin with other tools.
--- gui/Makefile | 2 +- gui/modulesPage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
gui/Makefile +1 -1
@@ -31,7 +31,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR) - install -m 755 polgengui.py $(DESTDIR)$(SHAREDIR) + install -m 755 polgengui.py $(DESTDIR)$(BINDIR)/selinux-polgengui install -m 644 $(TARGETS) $(DESTDIR)$(SHAREDIR) install -m 644 system-config-selinux.8 $(DESTDIR)$(MANDIR)/man8 install -m 644 selinux-polgengui.8 $(DESTDIR)$(MANDIR)/man8
gui/modulesPage.py +1 -1
@@ -118,7 +118,7 @@ class modulesPage(semanagePage): def new_module(self, args): try: - Popen(["/usr/share/system-config-selinux/polgengui.py"]) + Popen(["selinux-polgengui"]) except ValueError as e: self.error(e.args[0])
Signature · 1 line
2.20.1
PATCH 2/2 gui: Install .desktop files to /usr/share/applications by default
/usr/share/applications is a standard directory for .desktop files. Installation path can be changed using DESKTOPDIR variable in installation phase, e.g.
make DESKTOPDIR=/usr/local/share/applications install
--- gui/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
gui/Makefile +2 -1
@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \
@@ -44,7 +45,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop $(DESTDIR)$(DATADIR)/system-config-selinux + install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \
Signature · 1 line
2.20.1
Re: [PATCH 2/2] gui: Install .desktop files to /usr/share/applications by default
Quoted 8 lines · Petr Lautrbach
/usr/share/applicationsis a standard directory for .desktop files. Installation path can be changed using DESKTOPDIR variable in installation phase, e.g.make DESKTOPDIR=/usr/local/share/applications install
Signed-off-by Petr Lautrbach <[email protected]>
Thanks for your patch and sorry for the delay (I have been on holidays the last two weeks). I agree with moving .desktop files to /usr/share/applications/ by default and your patch looks good, but it does not create the directory if it does not exist (Travis-CI fails with "install: target '/home/travis/build/fishilico/selinux/installdir/usr/share/applications' is not a directory"). Could you please add "-mkdir -p $(DESTDIR)$(DESKTOPDIR)" next to the other mkdir commands?
Nicolas
Quoted 28 lines
--- gui/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)gui/Makefile +2
-2@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \@@ -44,7 +45,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop $(DESTDIR)$(DATADIR)/system-config-selinux + install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \ --2.20.1
PATCH v2 1/1 gui: Install .desktop files to /usr/share/applications by default
/usr/share/applications is a standard directory for .desktop files. Installation path can be changed using DESKTOPDIR variable in installation phase, e.g.
make DESKTOPDIR=/usr/local/share/applications install
--- gui/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
gui/Makefile +3 -1
@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \
@@ -29,6 +30,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ + -mkdir -p $(DESTDIR)$(DESKTOPDIR) install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR) install -m 755 polgengui.py $(DESTDIR)$(BINDIR)/selinux-polgengui
@@ -44,7 +46,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop $(DESTDIR)$(DATADIR)/system-config-selinux + install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \
Signature · 1 line
2.21.0
Re: [PATCH v2] gui: Install .desktop files to /usr/share/applications by default
Quoted 7 lines · Petr Lautrbach
/usr/share/applicationsis a standard directory for .desktop files. Installation path can be changed using DESKTOPDIR variable in installation phase, e.g.make DESKTOPDIR=/usr/local/share/applications install
Signed-off-by Petr Lautrbach <[email protected]>
Travis CI passed
https://travis-ci.org/bachradsusi/SELinuxProject-selinux/builds/507842594
Quoted 40 lines
--- gui/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)gui/Makefile +2
-0@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \@@ -29,6 +30,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ + -mkdir -p $(DESTDIR)$(DESKTOPDIR) install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR)gui/Makefile +0
-1install -m 755 polgengui.py $(DESTDIR)$(BINDIR)/selinux-polgengui@@ -44,7 +46,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop$(DESTDIR)$(DATADIR)/system-config-selinux
gui/Makefile +1
-0+ install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR) -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \
Nicolas Iooss
Acked-byRe: [PATCH v2] gui: Install .desktop files to /usr/share/applications by default
Quoted 9 lines · Petr Lautrbach
Quoted 6 lines · Petr Lautrbach
/usr/share/applicationsis a standard directory for .desktop files.
Installation path can be changed using DESKTOPDIR variable in installation
phase, e.g.
Quoted 6 lines
Quoted 3 lines
make DESKTOPDIR=/usr/local/share/applications install
Signed-off-by Petr Lautrbach <[email protected]>Travis CI passed
https://travis-ci.org/bachradsusi/SELinuxProject-selinux/builds/507842594
Thanks!
Nicolas
Quoted 41 lines
Quoted 40 lines
--- gui/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)gui/Makefile +2
-0@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \@@ -29,6 +30,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ + -mkdir -p $(DESTDIR)$(DESKTOPDIR) install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR)install -m 755
polgengui.py
$(DESTDIR)$(BINDIR)/selinux-polgenguigui/Makefile +0
-1@@ -44,7 +46,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop$(DESTDIR)$(DATADIR)/system-config-selinux
+ install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR)-mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \
Re: [PATCH v2] gui: Install .desktop files to /usr/share/applications by default
Quoted 15 lines · Nicolas Iooss
Quoted 13 lines · Petr Lautrbach
Quoted 9 lines · Petr Lautrbach
/usr/share/applicationsis a standard directory for .desktop files.
Installation path can be changed using DESKTOPDIR variable in installation
phase, e.g.make DESKTOPDIR=/usr/local/share/applications install
Signed-off-by Petr Lautrbach <[email protected]>
Quoted 7 lines
Quoted 2 lines
Travis CI passed
https://travis-ci.org/bachradsusi/SELinuxProject-selinux/builds/507842594Acked-by Nicolas Iooss <[email protected]>Thanks!
Nicolas
Merged.
Nicolas
Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
--- gui/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)gui/Makefile +2
-0@@ -5,6 +5,7 @@ BINDIR ?= $(PREFIX)/bin SHAREDIR ?= $(PREFIX)/share/system-config-selinux DATADIR ?= $(PREFIX)/share MANDIR ?= $(PREFIX)/share/man +DESKTOPDIR ?= $(PREFIX)/share/applications TARGETS= \ booleansPage.py \@@ -29,6 +30,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/pixmaps -mkdir -p $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ + -mkdir -p $(DESTDIR)$(DESKTOPDIR) install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR)install -m 755
polgengui.py
$(DESTDIR)$(BINDIR)/selinux-polgenguigui/Makefile +0
-1@@ -44,7 +46,7 @@ install: all install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/pixmaps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/icons/hicolor/24x24/apps install -m 644 system-config-selinux.png $(DESTDIR)$(DATADIR)/system-config-selinux - install -m 644 *.desktop$(DESTDIR)$(DATADIR)/system-config-selinux
+ install -m 644 *.desktop $(DESTDIR)$(DESKTOPDIR)-mkdir -p $(DESTDIR)$(DATADIR)/pixmaps install -m 644 sepolicy_256.png $(DESTDIR)$(DATADIR)/pixmaps/sepolicy.png for i in 16 22 32 48 256; do \
Re: [PATCH 1/2] gui: Install polgengui.py to /usr/bin/selinux-polgengui
In reply to Petr LautrbachQuoted 5 lines · Petr Lautrbach
polgengui.pyis a standalone gui tool which should be in/usr/binwith other tools.Signed-off-by Petr Lautrbach <[email protected]>
Thanks, I applied this patch.
Nicolas
Quoted 34 lines
--- gui/Makefile | 2 +- gui/modulesPage.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)gui/Makefile +1
-1@@ -31,7 +31,7 @@ install: all -mkdir -p $(DESTDIR)$(DATADIR)/polkit-1/actions/ install -m 755 system-config-selinux.py $(DESTDIR)$(SHAREDIR) install -m 755 system-config-selinux $(DESTDIR)$(BINDIR) - install -m 755 polgengui.py $(DESTDIR)$(SHAREDIR) + install -m 755 polgengui.py $(DESTDIR)$(BINDIR)/selinux-polgengui install -m 644 $(TARGETS) $(DESTDIR)$(SHAREDIR) install -m 644 system-config-selinux.8 $(DESTDIR)$(MANDIR)/man8 install -m 644 selinux-polgengui.8 $(DESTDIR)$(MANDIR)/man8gui/modulesPage.py +1
-2@@ -118,7 +118,7 @@ class modulesPage(semanagePage): def new_module(self, args): try: - Popen(["/usr/share/system-config-selinux/polgengui.py"]) + Popen(["selinux-polgengui"]) except ValueError as e: self.error(e.args[0]) --2.20.1