diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..39d1b2e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Andrey Onischenko loraner123@gmail.com + +pkgname=yandexmusic +pkgver="5.0.8" +pkgrel="1" +pkgdesc="Yandex Music Client" +arch=("any") +url="https://github.com/cucumber-sp/yandex-music-linux" +license=("custom") +depends=("electron" "libpulse") +makedepends=("p7zip" "nodejs" "jq") + +source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.8.exe") +sha256sums=("78b4e1acb61becbbddeb6f48e9d2b55ed7d718cd99c205b89a94f7c3af9df803") + +prepare() { + npm install @electron/asar; +} + +build() { + sh "$srcdir/repack.sh" "Yandex_Music_x64_5.0.8.exe" +} + +package() { + mkdir -p "$pkgdir/usr/lib/yandexmusic" + mkdir -p "$pkgdir/usr/share/applications" + mkdir -p "$pkgdir/usr/bin" + + install -Dm644 "$srcdir/out/yandexmusic.asar" "$pkgdir/usr/lib/yandexmusic/yandexmusic.asar" + install -Dm644 "$srcdir/out/yandexmusic.desktop" "$pkgdir/usr/share/applications/yandexmusic.desktop" + install -Dm644 "$srcdir/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + + # Create a script to launch the app with Electron + echo "#!/bin/sh" > "$pkgdir/usr/bin/yandexmusic" + echo "electron /usr/lib/yandexmusic/yandexmusic.asar" >> "$pkgdir/usr/bin/yandexmusic" + chmod 755 "$pkgdir/usr/bin/yandexmusic" +} diff --git a/generate_packages.sh b/generate_packages.sh new file mode 100644 index 0000000..3e4e958 --- /dev/null +++ b/generate_packages.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +rm -rf ./tmp +mkdir ./tmp + +# loading json from file https://music-desktop-application.s3.yandex.net/stable/download.json +curl -s https://music-desktop-application.s3.yandex.net/stable/download.json > ./tmp/download.json + +exe_link=$(jq -r '.windows' ./tmp/download.json) +version=$(echo $exe_link | grep -oP '(?<=x64_).*(?=.exe)') +exe_name=$(basename $exe_link) + +echo "Windows url: $exe_link" +echo "Version: $version" +echo "Exe name: $exe_name" + +curl $exe_link > ./tmp/$exe_name + +exe_sha256=$(sha256sum ./tmp/$exe_name | awk '{print $1}') + +echo "Exe sha256: $exe_sha256" + +rm -rf ./version_info.json + +echo "{ + \"version\": \"$version\", + \"exe_name\": \"$exe_name\", + \"exe_link\": \"$exe_link\", + \"exe_sha256\": \"$exe_sha256\" +}" > ./version_info.json + +rm -rf ./PKGBUILD +cp ./templates/PKGBUILD ./PKGBUILD + +sed -i "s#%version%#$version#g" ./PKGBUILD +sed -i "s#%release%#1#g" ./PKGBUILD +sed -i "s#%exe_name%#$exe_name#g" ./PKGBUILD +sed -i "s#%exe_link%#$exe_link#g" ./PKGBUILD +sed -i "s#%exe_sha256%#$exe_sha256#g" ./PKGBUILD + +rm -rf ./tmp \ No newline at end of file diff --git a/templates/PKGBUILD b/templates/PKGBUILD index a6c8525..8329c51 100644 --- a/templates/PKGBUILD +++ b/templates/PKGBUILD @@ -1,8 +1,8 @@ # Maintainer: Andrey Onischenko loraner123@gmail.com -pkgname=yandexmusic-bin -pkgver=VERSION -pkgrel=RELEASE_NUMBER +pkgname=yandexmusic +pkgver="%version%" +pkgrel="%release%" pkgdesc="Yandex Music Client" arch=("any") url="https://github.com/cucumber-sp/yandex-music-linux" @@ -10,31 +10,25 @@ license=("custom") depends=("electron" "libpulse") makedepends=("p7zip" "nodejs" "jq") -source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_$pkgver.exe" "https://github.com/cucumber-sp/yandex-music-linux/archive/v$pkgver-$pkgrel.tar.gz") -sha256sums=("EXE_HASH" "SOURCE_HASH") +source=("%exe_link%") +sha256sums=("%exe_sha256%") prepare() { npm install @electron/asar; } build() { - arch_dir="yandex-music-linux-$pkgver-$pkgrel" - mv "$srcdir/Yandex_Music_x64_$pkgver.exe" "$srcdir/$arch_dir" - cd "$srcdir/$arch_dir" - sh "./repack.sh" "Yandex_Music_x64_$pkgver.exe" + sh "$srcdir/repack.sh" "%exe_name%" } package() { - arch_dir="yandex-music-linux-$pkgver-$pkgrel" mkdir -p "$pkgdir/usr/lib/yandexmusic" mkdir -p "$pkgdir/usr/share/applications" mkdir -p "$pkgdir/usr/bin" - install -Dm644 "$srcdir/$arch_dir/out/yandexmusic.asar" "$pkgdir/usr/lib/yandexmusic/yandexmusic.asar" - install -Dm644 "$srcdir/$arch_dir/out/yandexmusic.desktop" "$pkgdir/usr/share/applications/yandexmusic.desktop" - install -Dm644 "$srcdir/$arch_dir/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" - - rm -rf "$srcdir/$arch_dir" + install -Dm644 "$srcdir/out/yandexmusic.asar" "$pkgdir/usr/lib/yandexmusic/yandexmusic.asar" + install -Dm644 "$srcdir/out/yandexmusic.desktop" "$pkgdir/usr/share/applications/yandexmusic.desktop" + install -Dm644 "$srcdir/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" # Create a script to launch the app with Electron echo "#!/bin/sh" > "$pkgdir/usr/bin/yandexmusic" diff --git a/version_info.json b/version_info.json new file mode 100644 index 0000000..2c68413 --- /dev/null +++ b/version_info.json @@ -0,0 +1,6 @@ +{ + "version": "5.0.8", + "exe_name": "Yandex_Music_x64_5.0.8.exe", + "exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.8.exe", + "exe_sha256": "78b4e1acb61becbbddeb6f48e9d2b55ed7d718cd99c205b89a94f7c3af9df803" +}