From 2e06caa8f5f035c338ccf784c1b49238a47085f4 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 31 Oct 2022 22:16:33 +0000 Subject: Add Xfce desktop shortcut to draklive-install at run time, not build time. Xfce has added an extra restriction on executable desktop files in the Desktop directory. They now need to have a xfce-exe-checksum extended file attribute as well as having execute permissions. We can't add this at build time because squashfs does not support system extended attributes. --- config/build.cfg | 14 +++++++------- files/add-draklive-install-shortcut | 17 +++++++++++++++++ files/add-draklive-install-shortcut.desktop | 8 ++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 files/add-draklive-install-shortcut create mode 100644 files/add-draklive-install-shortcut.desktop diff --git a/config/build.cfg b/config/build.cfg index fa60780..ab62c58 100644 --- a/config/build.cfg +++ b/config/build.cfg @@ -269,6 +269,13 @@ my $config = { [ 'files/dolphinrc', '/home/live/.config/dolphinrc', { mode => 0644, no_install => 1 } ], ), + if_($has_xfce, + # Add a desktop shortcut to run draklive-install. This needs to be done during the live session + # startup because Xfce requires the xfce-exe-checksum extended attribute to be set on executable + # files in the Desktop directory, and squashfs doesn't support this attribute. + [ 'files/add-draklive-install-shortcut.desktop', '/etc/xdg/autostart/add-draklive-install-shortcut.desktop', { mode => 0644, no_install => 1 } ], + [ 'files/add-draklive-install-shortcut', '/usr/bin/add-draklive-install-shortcut', { mode => 0755, no_install => 1 } ], + ), ], remove_files => [ (map { "/etc/modprobe.preload.d/$_" } qw(cpufreq pcmcia rfswitch)), @@ -309,13 +316,6 @@ my $config = { "rm -f /usr/share/icons/*/icon-theme.cache", ), - if_($has_xfce, - # Add a desktop icon to run draklive-install. - "mkdir -p /home/$default_user/Desktop", - "cp /usr/share/applications/mageia-draklive-install.desktop /home/$default_user/Desktop/draklive-install.desktop", - "chmod 750 /home/$default_user/Desktop/draklive-install.desktop", - ), - # Switch to NetworkManager. "systemctl -q disable network", "systemctl -q disable network-up", diff --git a/files/add-draklive-install-shortcut b/files/add-draklive-install-shortcut new file mode 100644 index 0000000..8c81d8b --- /dev/null +++ b/files/add-draklive-install-shortcut @@ -0,0 +1,17 @@ +#!/usr/bin/sh + +dst_dir=$HOME/Desktop + +src_file=/usr/share/applications/mageia-draklive-install.desktop +dst_file=$dst_dir/draklive-install.desktop + +[ -x /usr/bin/gio ] || exit +[ -x /usr/bin/sha256sum ] || exit +[ -r $src_file ] || exit +[ -e $dst_file ] && exit + +mkdir -p $dst_dir +cp $src_file $dst_file +checksum=$(sha256sum $dst_file) +gio set $dst_file metadata::xfce-exe-checksum ${checksum:0:64} +chmod 750 $dst_file diff --git a/files/add-draklive-install-shortcut.desktop b/files/add-draklive-install-shortcut.desktop new file mode 100644 index 0000000..8e5b7fc --- /dev/null +++ b/files/add-draklive-install-shortcut.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Add draklive-install shortcut +Comment=Add draklive-install shortcut to desktop +Type=Application +Terminal=false +StartupNotify=false +Exec=/usr/bin/add-draklive-install-shortcut +OnlyShowIn=XFCE; -- cgit v1.2.1