net-im/discord-bin: rewrite ebuild
authorGino <onigino@protonmail.com>
Sun, 9 Sep 2018 21:54:17 +0000 (14:54 -0700)
committerThomas Deutschmann <whissi@gentoo.org>
Sat, 19 Jan 2019 05:08:30 +0000 (06:08 +0100)
This rewrite offers better handling of electron files installed into
/opt

Closes: https://bugs.gentoo.org/660870
Closes: https://github.com/gentoo/gentoo/pull/9815
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
net-im/discord-bin/discord-bin-0.0.5-r1.ebuild [moved from net-im/discord-bin/discord-bin-0.0.5.ebuild with 64% similarity]

similarity index 64%
rename from net-im/discord-bin/discord-bin-0.0.5.ebuild
rename to net-im/discord-bin/discord-bin-0.0.5-r1.ebuild
index aebe7f5fee12f25cea99cdf1a4e00a05f65619ae..4f5af1205dcf52d78d43ee96fe524c00271f9bdd 100644 (file)
@@ -1,10 +1,11 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
 
 MY_PN=${PN/-bin/}
-inherit eutils gnome2-utils unpacker
+MY_BIN="D${MY_PN/d/}"
+inherit eutils gnome2-utils unpacker desktop xdg-utils
 
 DESCRIPTION="All-in-one voice and text chat for gamers"
 HOMEPAGE="https://discordapp.com"
@@ -50,9 +51,9 @@ S=${WORKDIR}
 RESTRICT="mirror bindist"
 
 QA_PREBUILT="
-       opt/discord/share/discord/Discord
-       opt/discord/share/discord/libnode.so
-       opt/discord/share/discord/libffmpeg.so
+       opt/discord/${MY_BIN}
+       opt/discord/libnode.so
+       opt/discord/libffmpeg.so
 "
 
 src_unpack() {
@@ -63,30 +64,28 @@ src_prepare() {
        default
 
        sed -i \
-               -e "s:/usr/share/discord/Discord:discord:g" \
+               -e "s:/usr/share/discord/Discord:/opt/${MY_PN}/${MY_BIN}:g" \
                usr/share/${MY_PN}/${MY_PN}.desktop || die
 }
 
 src_install() {
-       insinto /opt/${MY_PN}
-       doins -r usr/.
+       domenu opt/${MY_PN}/${MY_PN}.desktop
+       doicon opt/${MY_PN}/${MY_PN}.png
 
-       fperms +x /opt/${MY_PN}/bin/${MY_PN}
-       dosym ../../opt/${MY_PN}/bin/${MY_PN} /usr/bin/${MY_PN}
-       dosym ../../../opt/${MY_PN}/share/applications/${MY_PN}.desktop \
-               /usr/share/applications/${MY_PN}.desktop
-       dosym ../../../opt/${MY_PN}/share/pixmaps/${MY_PN}.png \
-               /usr/share/pixmaps/${MY_PN}.png
-}
-
-pkg_preinst() {
-       gnome2_icon_savelist
+       insinto /opt
+       doins -r usr/share/${MY_PN}
+       fperms +x /opt/${MY_PN}/${MY_BIN}
+       dosym ../../opt/${MY_PN}/${MY_BIN} usr/bin/${MY_PN}
 }
 
 pkg_postinst() {
+       xdg_desktop_database_update
+       xdg_mimeinfo_database_update
        gnome2_icon_cache_update
 }
 
 pkg_postrm() {
+       xdg_desktop_database_update
+       xdg_mimeinfo_database_update
        gnome2_icon_cache_update
 }