Commit 8b3c6702 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play yandexmusic: cleanup code

parent 5b01d5fd
......@@ -8,10 +8,8 @@ VERSION="$3"
PKGNAME=$PRODUCT-$VERSION.tar
# erc unpack /var/tmp/tmp.F8zrFHvurl/Yandex_Music_amd64_5.71.2.deb
# ERROR: Can't recognize type of /var/tmp/tmp.F8zrFHvurl/Yandex_Music_amd64_5.71.2.deb.
a='' ar -x $TAR
a='' tar xf "data.tar.xz"
erc unpack $TAR || fatal
cd *
# drop dirname with spaces
mv -v "opt/Яндекс Музыка" opt/yandex-music || fatal
......@@ -19,15 +17,14 @@ mv -v "opt/Яндекс Музыка" opt/yandex-music || fatal
# disable autoupdate
rm -v opt/yandex-music/resources/app-update.yml
mkdir -p usr/bin
cat <<EOF >usr/bin/yandex-music
cat <<EOF > create_exec_file /usr/bin/$PRODUCT
#!/bin/sh
# workaround for https://github.com/electron/electron/issues/46538
/opt/yandex-music/yandexmusic --gtk-version=3
/opt/yandex-music/$PRODUCT --gtk-version=3
EOF
chmod 755 usr/bin/yandex-music
subst 's|^Exec=.*|Exec=yandex-music %U|' usr/share/applications/yandexmusic.desktop
subst "s|^Exec=.*|Exec=$PRODUCT %U|" usr/share/applications/yandexmusic.desktop
erc pack $PKGNAME opt usr
......
......@@ -8,14 +8,12 @@ URL="https://music.yandex.ru/download"
. $(dirname $0)/common.sh
DOWNLOAD_JSON="https://music-desktop-application.s3.yandex.net/stable/download.json"
JSON="$(eget -O- "$DOWNLOAD_JSON")"
if [ "$VERSION" = "*" ] ; then
VERSION=$(echo $JSON | grep -oP '(?<=Yandex_Music_amd64_)[0-9.]+(?=\.deb)')
PKGURL="$(eget -O- "$DOWNLOAD_JSON" | epm tool json -b | get_json_value "linux")"
else
PKGURL="https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_amd64_${VERSION}.deb"
fi
PKGURL="https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_amd64_${VERSION}.deb"
install_pack_pkgurl "$VERSION"
install_pkgurl
......@@ -9,8 +9,25 @@ SPEC="$2"
# Conflicts with an official client used before
add_conflicts yandex-music
move_to_opt "/opt/Яндекс Музыка"
# disable autoupdate
remove_file -v $PRODUCTDIR/resources/app-update.yml
cat <<EOF | create_exec_file /usr/bin/$PRODUCT
#!/bin/sh
# workaround for https://github.com/electron/electron/issues/46538
exec $PRODUCTDIR/$PRODUCT --gtk-version=3
EOF
# for compatibility
add_bin_link_command yandex-music $PRODUCT
subst "s|^Exec=.*|Exec=$PRODUCT %U|" usr/share/applications/yandexmusic.desktop
add_libs_requires
fix_chrome_sandbox
add_electron_deps
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment