mirror of
https://github.com/cucumber-sp/yandex-music-linux.git
synced 2024-12-23 22:22:59 +03:00
Merge branch 'master' into dev
This commit is contained in:
commit
19360d7fa1
46
.github/workflows/build.sh
vendored
46
.github/workflows/build.sh
vendored
@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
OS=$NAME
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
. /etc/lsb-release
|
||||
OS=$DISTRIB_ID
|
||||
else
|
||||
OS=$(uname -s)
|
||||
fi
|
||||
|
||||
case $OS in
|
||||
"Arch Linux")
|
||||
echo "Arch Linux"
|
||||
pacman -Syy --noconfirm
|
||||
pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python
|
||||
# fix makepkg from non-root
|
||||
mkdir /home/build
|
||||
chgrp nobody /home/build
|
||||
chmod g+ws /home/build
|
||||
setfacl -m u::rwx,g::rwx /home/build
|
||||
setfacl -d --set u::rwx,g::rwx,o::- /home/build
|
||||
chown nobody .
|
||||
sudo -u nobody makepkg --log
|
||||
|
||||
mkdir dist
|
||||
mv *.pkg.tar.zst dist
|
||||
|
||||
mv ./src/app/yandex-music.asar dist/yandex-music.asar
|
||||
mv ./src/app/release_notes.json dist/release_notes.json
|
||||
|
||||
sh ./build_deb.sh -a all
|
||||
mv deb/*.deb dist
|
||||
;;
|
||||
"Ubuntu")
|
||||
echo NixOS
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
nix build --impure
|
||||
;;
|
||||
*)
|
||||
echo "Operating system is not recognized."
|
||||
;;
|
||||
esac
|
38
.github/workflows/build.yml
vendored
38
.github/workflows/build.yml
vendored
@ -21,26 +21,58 @@ jobs:
|
||||
container:
|
||||
image: archlinux:latest
|
||||
steps:
|
||||
- name: Install packages
|
||||
run: pacman -Syy --noconfirm && pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python rpm-tools
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ (inputs.ref || '') }}
|
||||
|
||||
- name: Build
|
||||
run: sh ./.github/workflows/build.sh
|
||||
- name: Create dist directory
|
||||
run: mkdir -p dist
|
||||
|
||||
- name: Upload Arch artifact
|
||||
- name: Fix permissions for build
|
||||
run: mkdir /home/build && chgrp nobody /home/build && chmod g+ws /home/build && setfacl -m u::rwx,g::rwx /home/build && setfacl -d --set u::rwx,g::rwx,o::- /home/build && chown nobody .
|
||||
|
||||
- name: Make Arch package
|
||||
run: sudo -u nobody makepkg --log && mv *.pkg.tar.zst dist/
|
||||
|
||||
- name: Build tarball packages
|
||||
run: bash ./build_tarball.sh -a all && cp tar/* dist/
|
||||
|
||||
- name: Build Deb packages
|
||||
run: bash ./build_deb.sh -a all && mv deb/*.deb dist
|
||||
|
||||
- name: Build RPM packages
|
||||
run: bash ./build_rpm.sh && mv rpm/*.rpm dist
|
||||
|
||||
- name: Retrieve Asar and release notes
|
||||
run: mv ./src/app/yandex-music.asar dist/yandex-music.asar && mv ./src/app/release_notes.json dist/release_notes.json
|
||||
|
||||
- name: Upload Arch artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ./dist/*.pkg.tar.zst
|
||||
name: arch-packages
|
||||
|
||||
- name: Upload tarball artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ./dist/*.tar.gz
|
||||
name: tar-packages
|
||||
|
||||
- name: Upload Deb artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ./dist/*.deb
|
||||
name: deb-packages
|
||||
|
||||
- name: Upload RPM artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: ./dist/*.rpm
|
||||
name: rpm-packages
|
||||
|
||||
- name: Upload Asar artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
8
.github/workflows/update-build-release.yml
vendored
8
.github/workflows/update-build-release.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
run: python utility/generate_packages.py
|
||||
|
||||
- name: Retrieve version to make commit
|
||||
run: sh .github/workflows/retrieve_version.sh
|
||||
run: bash .github/workflows/retrieve_version.sh
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: EndBug/add-and-commit@v9.1.4
|
||||
@ -44,7 +44,7 @@ jobs:
|
||||
author_email: "loraner123@gmail.com"
|
||||
|
||||
- name: Publish package changes to AUR
|
||||
if: "${{ github.event.commits[0] }}"
|
||||
if: "${{ github.event.commits[0] || steps.commit.outputs.commited }}"
|
||||
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
|
||||
with:
|
||||
pkgname: "yandex-music"
|
||||
@ -54,7 +54,7 @@ jobs:
|
||||
commit_username: "cucumber-sp"
|
||||
commit_email: "loraner123@gmail.com"
|
||||
ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}"
|
||||
commit_message: "${{ github.event.commits[0].message }}"
|
||||
commit_message: "${{ github.event.commits[0].message || env.release_name }}"
|
||||
ssh_keyscan_types: "rsa,dsa,ecdsa,ed25519"
|
||||
|
||||
outputs:
|
||||
@ -86,7 +86,7 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install jq
|
||||
sh ./.github/workflows/retrieve_version.sh
|
||||
bash ./.github/workflows/retrieve_version.sh
|
||||
|
||||
- name: Get Release Notes HTML
|
||||
run: echo "release_html=$(jq -r --arg version "$VERSION" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_ENV
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,3 +7,7 @@ app/
|
||||
arch/
|
||||
|
||||
deb/
|
||||
|
||||
tar/
|
||||
|
||||
rpm/
|
||||
|
8
PKGBUILD
8
PKGBUILD
@ -1,7 +1,7 @@
|
||||
# Maintainer: Andrey Onischenko loraner123@gmail.com
|
||||
|
||||
pkgname=yandex-music
|
||||
pkgver="5.0.12"
|
||||
pkgver="5.0.14"
|
||||
pkgrel="1"
|
||||
pkgdesc="Yandex Music - Personal recommendations, selections for any occasion and new music"
|
||||
arch=("any")
|
||||
@ -10,11 +10,11 @@ license=("custom")
|
||||
depends=("electron27" "libpulse" "xdg-utils")
|
||||
makedepends=("p7zip" "nodejs" "asar" "jq" "python")
|
||||
|
||||
source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe" "git+https://github.com/cucumber-sp/yandex-music-linux")
|
||||
sha256sums=("4ebeac9620f60e9e2333114cf8c8fb3dc6f2c2c70da58ba56902aa75d65ce4f8" "SKIP")
|
||||
source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" "git+https://github.com/cucumber-sp/yandex-music-linux")
|
||||
sha256sums=("c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4" "SKIP")
|
||||
|
||||
build() {
|
||||
sh "$srcdir/yandex-music-linux/repack.sh" "$srcdir/Yandex_Music_x64_5.0.12.exe"
|
||||
bash "$srcdir/yandex-music-linux/repack.sh" "$srcdir/Yandex_Music_x64_5.0.14.exe"
|
||||
}
|
||||
|
||||
package() {
|
||||
|
60
README.md
60
README.md
@ -36,7 +36,7 @@ You can obtain the latest version of package from `AUR` using one of the [AUR He
|
||||
|
||||
For this example I will use [yay](https://github.com/Jguer/yay)
|
||||
|
||||
```
|
||||
```bash
|
||||
yay -S yandex-music
|
||||
```
|
||||
|
||||
@ -46,7 +46,7 @@ Download prebuilt binary package from [Releases](https://github.com/cucumber-sp/
|
||||
|
||||
Then you can install it with the following command
|
||||
|
||||
```
|
||||
```bash
|
||||
pacman -U yandex-music-<version>-any.pkg.tar.zst
|
||||
```
|
||||
|
||||
@ -66,7 +66,7 @@ Download prebuilt binary package from [Releases](https://github.com/cucumber-sp/
|
||||
|
||||
Then you can install it with the following command
|
||||
|
||||
```
|
||||
```bash
|
||||
dpkg -i yandex-music_<version>_<arch>.deb
|
||||
```
|
||||
|
||||
@ -89,7 +89,7 @@ That's the list of packages you might need to install to be able to manually bui
|
||||
|
||||
In addition you will need to install [Asar](https://github.com/electron/asar) tool with `npm`. I recommend install it globally with the following command
|
||||
|
||||
```
|
||||
```bash
|
||||
npm install -g @electron/asar
|
||||
```
|
||||
|
||||
@ -101,8 +101,8 @@ Last step is to download original client `.exe` file. You can get it yourself or
|
||||
|
||||
If you only want to get extracted app project with applied patches, you can use the following command:
|
||||
|
||||
```
|
||||
sh repack.sh -x [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
```bash
|
||||
bash repack.sh -x [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
```
|
||||
***
|
||||
|
||||
@ -110,8 +110,8 @@ sh repack.sh -x [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
|
||||
`.asar` is archive file that containes all electron app resources and information, but doesn't hold Electron binaries. If you have `.asar` file you can launch app using `electron <app>.asar`. You can build this archive with the following command:
|
||||
|
||||
```
|
||||
sh repack.sh [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
```bash
|
||||
bash repack.sh [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
```
|
||||
|
||||
***
|
||||
@ -120,7 +120,7 @@ sh repack.sh [-o OUTPUT_DIR default=./app] <YM.exe>
|
||||
|
||||
You can build `pacman` package file manually using `PKGBUILD` file from the this repository. Run following commands in folder with `PKGBUILD` file inside to get `.pkg.tar.zst` package:
|
||||
|
||||
```
|
||||
```bash
|
||||
pacman -S electron libpulse
|
||||
makepkg
|
||||
```
|
||||
@ -131,8 +131,8 @@ makepkg
|
||||
|
||||
You can build `.deb` binary package using the following command:
|
||||
|
||||
```
|
||||
sh build_deb.sh [-a <x64|armv7l|arm64|all> default=x64]
|
||||
```bash
|
||||
bash build_deb.sh [-a <x64|armv7l|arm64|all> default=x64]
|
||||
```
|
||||
|
||||
***
|
||||
@ -146,7 +146,7 @@ The `yandex-music` package has unlicensed license, so you need to have
|
||||
|
||||
Execute next to build and run yandex music directly from github
|
||||
|
||||
```
|
||||
```bash
|
||||
nix run github:cucumber-sp/yandex-music-linux
|
||||
```
|
||||
|
||||
@ -155,11 +155,41 @@ nix run github:cucumber-sp/yandex-music-linux
|
||||
Execute next in this repository to build yandex-music package without using
|
||||
flakes.
|
||||
|
||||
```
|
||||
```bash
|
||||
nix-build --expr '(import <nixpkgs> {}).callPackage ./nix {}'
|
||||
```
|
||||
|
||||
### Install to NixOS
|
||||
|
||||
This flake exports `modules` list. Append it to your system modules and add
|
||||
`yandex-music` package to `environment.systemPackages`.
|
||||
1. Add input in your flake.nix
|
||||
|
||||
```nix
|
||||
inputs = {
|
||||
yandex-music.url = "github:cucumber-sp/yandex-music-linux";
|
||||
};
|
||||
```
|
||||
|
||||
2. Import module in your `configuration.nix` or `home-manager.nix`
|
||||
|
||||
```nix
|
||||
imports = [
|
||||
yandex-music.nixosModule
|
||||
];
|
||||
```
|
||||
|
||||
3. Add package `yandex-music`
|
||||
|
||||
For `configuration.nix`:
|
||||
|
||||
```nix
|
||||
environment.systemPackages = with pkgs; [
|
||||
yandex-music
|
||||
];
|
||||
```
|
||||
For Home Manager:
|
||||
|
||||
```nix
|
||||
home.packages = with pkgs; [
|
||||
yandex-music
|
||||
];
|
||||
```
|
||||
|
53
build_deb.sh
53
build_deb.sh
@ -10,12 +10,14 @@ usage() {
|
||||
echo " -h Show this help and exit"
|
||||
}
|
||||
|
||||
download_electron_binary(){
|
||||
prepare_tarball(){
|
||||
arch=${1}
|
||||
echo "Downloading electron ${arch}"
|
||||
LINK=$(jq -r .electron."${arch}" ./utility/version_info.json)
|
||||
curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}"
|
||||
unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}"
|
||||
echo "Preparing tarball for ${arch}"
|
||||
if [ ! -f "tar/yandex-music_${version}_${arch}.tar.gz" ]; then
|
||||
echo "Building tarball for ${arch}"
|
||||
bash build_tarball.sh -a "${arch}"
|
||||
fi
|
||||
cp "tar/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz"
|
||||
}
|
||||
|
||||
build_deb(){
|
||||
@ -30,25 +32,8 @@ build_deb(){
|
||||
sed -i "s/%version%/${version}/g" "${pkgdir}/DEBIAN/control"
|
||||
sed -i "s/%arch%/${pkgarch}/g" "${pkgdir}/DEBIAN/control"
|
||||
|
||||
mkdir -p "${pkgdir}/usr/lib/yandex-music"
|
||||
mkdir -p "${pkgdir}/usr/share/applications"
|
||||
mkdir -p "${pkgdir}/usr/share/licenses/yandex-music"
|
||||
mkdir -p "${pkgdir}/usr/share/pixmaps"
|
||||
mkdir -p "${pkgdir}/usr/bin"
|
||||
|
||||
install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${pkgdir}/usr/lib/yandex-music/yandex-music.asar"
|
||||
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/pixmaps/yandex-music.png"
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${pkgdir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png"
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
|
||||
|
||||
install -Dm644 "./templates/desktop" "${pkgdir}/usr/share/applications/yandex-music.desktop"
|
||||
install -Dm644 "./LICENSE.md" "${pkgdir}/usr/share/licenses/yandex-music/LICENSE"
|
||||
mv "${TEMPDIR}/electron-${arch}/" "${pkgdir}/usr/lib/yandex-music/electron"
|
||||
|
||||
echo "#!/bin/sh" > "${pkgdir}/usr/bin/yandex-music"
|
||||
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${pkgdir}/usr/bin/yandex-music"
|
||||
chmod 755 "${pkgdir}/usr/bin/yandex-music"
|
||||
# extract tarball to pkgdir
|
||||
tar -xzf "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" -C "${pkgdir}"
|
||||
|
||||
dpkg-deb --build "${pkgdir}" "deb/yandex-music_${version}_${pkgarch}.deb"
|
||||
}
|
||||
@ -101,34 +86,20 @@ trap clear EXIT
|
||||
|
||||
#loading version info with jq
|
||||
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
||||
exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json)
|
||||
exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json)
|
||||
exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json)
|
||||
|
||||
#downloading exe
|
||||
echo "Downloading ${exe_name}"
|
||||
curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}"
|
||||
|
||||
#checking sha256
|
||||
echo "Checking sha256"
|
||||
echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c
|
||||
|
||||
echo "Repaking ${exe_name}"
|
||||
sh repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}"
|
||||
|
||||
mkdir -p "deb"
|
||||
|
||||
if [ ${x64} -eq 1 ]; then
|
||||
download_electron_binary "x64"
|
||||
prepare_tarball "x64"
|
||||
build_deb "x64" "amd64"
|
||||
fi
|
||||
|
||||
if [ ${armv7l} -eq 1 ]; then
|
||||
download_electron_binary "armv7l"
|
||||
prepare_tarball "armv7l"
|
||||
build_deb "armv7l" "armhf"
|
||||
fi
|
||||
|
||||
if [ ${arm64} -eq 1 ]; then
|
||||
download_electron_binary "arm64"
|
||||
prepare_tarball "arm64"
|
||||
build_deb "arm64" "arm64"
|
||||
fi
|
115
build_rpm.sh
Normal file
115
build_rpm.sh
Normal file
@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "Usage: $(basename "$0") [-h] [-a <x64|armv7l|arm64|all> default=x64]"
|
||||
echo
|
||||
echo " Options:"
|
||||
echo " -a Architecture to build for (<x64|armv7l|arm64|all> default=x64)"
|
||||
echo " -h Show this help and exit"
|
||||
}
|
||||
|
||||
prepare_tarball(){
|
||||
arch=${1}
|
||||
echo "Preparing tarball for ${arch}"
|
||||
if [ ! -f "tar/yandex-music_${version}_${arch}.tar.gz" ]; then
|
||||
echo "Building tarball for ${arch}"
|
||||
bash build_tarball.sh -a "${arch}"
|
||||
fi
|
||||
cp "tar/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz"
|
||||
cd "${TEMPDIR}"
|
||||
tar -xzf "yandex-music_${version}_${arch}.tar.gz"
|
||||
mkdir -p "yandex-music-${version}"
|
||||
mv usr "yandex-music-${version}"
|
||||
tar -czf "yandex-music_${version}_${arch}.tar.gz" "yandex-music-${version}"
|
||||
rm -rf "yandex-music-${version}"
|
||||
cd "${INITIAL_DIR}"
|
||||
cp "${TEMPDIR}/yandex-music_${version}_${arch}.tar.gz" "${TEMPDIR}/rpmbuild/SOURCES/yandex-music_${version}_${arch}.tar.gz"
|
||||
}
|
||||
|
||||
build_rpm(){
|
||||
arch=${1}
|
||||
pkgarch=${2}
|
||||
echo "Building ${arch} package"
|
||||
cp "templates/rpm.spec" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec"
|
||||
sed -i "s/%version%/${version}/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec"
|
||||
sed -i "s/%arch%/${pkgarch}/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec"
|
||||
sed -i "s/%source_tarball%/yandex-music_${version}_${arch}.tar.gz/g" "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec"
|
||||
rpmbuild --define "_topdir ${TEMPDIR}/rpmbuild" -bb "${TEMPDIR}/rpmbuild/SPECS/${arch}.spec"
|
||||
cp "${TEMPDIR}/rpmbuild/RPMS/${pkgarch}/yandex-music-${version}-1.${pkgarch}.rpm" "rpm/yandex-music-${version}-1.${pkgarch}.rpm"
|
||||
}
|
||||
|
||||
init_rpm(){
|
||||
echo "Initializing RPM build"
|
||||
mkdir -p "${TEMPDIR}/rpmbuild/SOURCES"
|
||||
mkdir -p "${TEMPDIR}/rpmbuild/SPECS"
|
||||
}
|
||||
|
||||
x64=0
|
||||
armv7l=0
|
||||
arm64=0
|
||||
|
||||
#checking for arch option (if not specified set x64) and h option
|
||||
while getopts :a:h name; do
|
||||
case ${name} in
|
||||
a)
|
||||
case ${OPTARG} in
|
||||
x64) x64=1 ;;
|
||||
armv7l) armv7l=1 ;;
|
||||
arm64) arm64=1 ;;
|
||||
all)
|
||||
x64=1
|
||||
armv7l=1
|
||||
arm64=1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid architecture specified"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#checking if at least one arch is specified else set x64
|
||||
if [ ${x64} -eq 0 ] && [ ${armv7l} -eq 0 ] && [ ${arm64} -eq 0 ]; then
|
||||
x64=1
|
||||
fi
|
||||
|
||||
clear() {
|
||||
rm -rf "${TEMPDIR}"
|
||||
}
|
||||
TEMPDIR="$(mktemp -d)"
|
||||
INITIAL_DIR=${PWD}
|
||||
trap clear EXIT
|
||||
|
||||
#loading version info with jq
|
||||
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
||||
|
||||
init_rpm
|
||||
mkdir -p "rpm"
|
||||
|
||||
if [ ${x64} -eq 1 ]; then
|
||||
prepare_tarball "x64"
|
||||
build_rpm "x64" "x86_64"
|
||||
fi
|
||||
|
||||
if [ ${armv7l} -eq 1 ]; then
|
||||
prepare_tarball "armv7l"
|
||||
build_rpm "armv7l" "armv7hl"
|
||||
fi
|
||||
|
||||
if [ ${arm64} -eq 1 ]; then
|
||||
prepare_tarball "arm64"
|
||||
build_rpm "arm64" "aarch64"
|
||||
fi
|
131
build_tarball.sh
Normal file
131
build_tarball.sh
Normal file
@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
echo "Usage: $(basename "$0") [-h] [-a <x64|armv7l|arm64|all> default=x64]"
|
||||
echo
|
||||
echo " Options:"
|
||||
echo " -a Architecture to build for (<x64|armv7l|arm64|all> default=x64)"
|
||||
echo " -o Output directory"
|
||||
echo " -h Show this help and exit"
|
||||
}
|
||||
|
||||
download_electron_binary(){
|
||||
arch=${1}
|
||||
echo "Downloading electron ${arch}"
|
||||
LINK=$(jq -r .electron."${arch}" ./utility/version_info.json)
|
||||
curl -L -o "${TEMPDIR}/electron-${arch}.zip" "${LINK}"
|
||||
unzip -q "${TEMPDIR}/electron-${arch}.zip" -d "${TEMPDIR}/electron-${arch}"
|
||||
}
|
||||
|
||||
build_tarball(){
|
||||
arch=${1}
|
||||
app_dir="${TEMPDIR}/yandex-music_${version}_${arch}"
|
||||
|
||||
mkdir -p "${app_dir}/usr/lib/yandex-music"
|
||||
mkdir -p "${app_dir}/usr/share/applications"
|
||||
mkdir -p "${app_dir}/usr/share/licenses/yandex-music"
|
||||
mkdir -p "${app_dir}/usr/share/pixmaps"
|
||||
mkdir -p "${app_dir}/usr/bin"
|
||||
|
||||
install -Dm644 "${TEMPDIR}/app/yandex-music.asar" "${app_dir}/usr/lib/yandex-music/yandex-music.asar"
|
||||
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/pixmaps/yandex-music.png"
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.png" "${app_dir}/usr/share/icons/hicolor/48x48/apps/yandex-music.png"
|
||||
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
|
||||
|
||||
install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop"
|
||||
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
|
||||
mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron"
|
||||
|
||||
echo "#!/bin/sh" > "${app_dir}/usr/bin/yandex-music"
|
||||
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${app_dir}/usr/bin/yandex-music"
|
||||
chmod 755 "${app_dir}/usr/bin/yandex-music"
|
||||
|
||||
cd "${app_dir}"
|
||||
tar cvfz "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *
|
||||
cd "${INITIAL_DIR}"
|
||||
}
|
||||
|
||||
INITIAL_DIR="${PWD}"
|
||||
OUTPUT_DIR="${PWD}/tar"
|
||||
x64=0
|
||||
armv7l=0
|
||||
arm64=0
|
||||
|
||||
#checking for arch option (if not specified set x64) and h option
|
||||
while getopts :a:h name; do
|
||||
case ${name} in
|
||||
a)
|
||||
case ${OPTARG} in
|
||||
x64) x64=1 ;;
|
||||
armv7l) armv7l=1 ;;
|
||||
arm64) arm64=1 ;;
|
||||
all)
|
||||
x64=1
|
||||
armv7l=1
|
||||
arm64=1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid architecture specified"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
#checking if at least one arch is specified else set x64
|
||||
if [ ${x64} -eq 0 ] && [ ${armv7l} -eq 0 ] && [ ${arm64} -eq 0 ]; then
|
||||
x64=1
|
||||
fi
|
||||
|
||||
clear() {
|
||||
rm -rf "${TEMPDIR}"
|
||||
}
|
||||
TEMPDIR="$(mktemp -d)"
|
||||
trap clear EXIT
|
||||
|
||||
#loading version info with jq
|
||||
version=$(jq -r '.ym.version' ./utility/version_info.json)
|
||||
exe_name=$(jq -r '.ym.exe_name' ./utility/version_info.json)
|
||||
exe_link=$(jq -r '.ym.exe_link' ./utility/version_info.json)
|
||||
exe_sha256=$(jq -r '.ym.exe_sha256' ./utility/version_info.json)
|
||||
|
||||
#downloading exe
|
||||
echo "Downloading ${exe_name}"
|
||||
curl -L -o "${TEMPDIR}/${exe_name}" "${exe_link}"
|
||||
|
||||
#checking sha256
|
||||
echo "Checking sha256"
|
||||
echo "${exe_sha256} ${TEMPDIR}/${exe_name}" | sha256sum -c
|
||||
|
||||
echo "Repaking ${exe_name}"
|
||||
bash repack.sh -o "${TEMPDIR}/app" "${TEMPDIR}/${exe_name}"
|
||||
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
if [ ${x64} -eq 1 ]; then
|
||||
download_electron_binary "x64"
|
||||
build_tarball "x64"
|
||||
fi
|
||||
|
||||
if [ ${armv7l} -eq 1 ]; then
|
||||
download_electron_binary "armv7l"
|
||||
build_tarball "armv7l"
|
||||
fi
|
||||
|
||||
if [ ${arm64} -eq 1 ]; then
|
||||
download_electron_binary "arm64"
|
||||
build_tarball "arm64"
|
||||
fi
|
@ -56,13 +56,13 @@
|
||||
"ymExe": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"narHash": "sha256-a7D/8m6ECtYsep7mD9SqI8zFbWxFcjVJ4ELDWcxsWHA=",
|
||||
"narHash": "sha256-6YOx1r40nBcexbeqmQn5/FkuUaHxRrg4Qn1mEwPVnTs=",
|
||||
"type": "file",
|
||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe"
|
||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe"
|
||||
},
|
||||
"original": {
|
||||
"type": "file",
|
||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe"
|
||||
"url": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
49
flake.nix
49
flake.nix
@ -1,34 +1,41 @@
|
||||
{
|
||||
description = "Native Yandex Music desktop client";
|
||||
|
||||
inputs = {
|
||||
ymExe.url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe;
|
||||
ymExe.url = https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe;
|
||||
ymExe.flake = false;
|
||||
};
|
||||
|
||||
outputs = { self, ymExe, nixpkgs, flake-utils }:
|
||||
let
|
||||
yandex-music-with = pkgs: pkgs.callPackage ./nix {
|
||||
inherit ymExe;
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
yandex-music = yandex-music-with pkgs;
|
||||
yandex-music-noflakes = pkgs.callPackage ./nix {};
|
||||
default = yandex-music;
|
||||
};
|
||||
}
|
||||
) // {
|
||||
modules = [{
|
||||
let
|
||||
yandex-music-with = pkgs: pkgs.callPackage ./nix {
|
||||
inherit ymExe;
|
||||
};
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
yandex-music = yandex-music-with pkgs;
|
||||
yandex-music-noflakes = pkgs.callPackage ./nix {};
|
||||
default = yandex-music;
|
||||
};
|
||||
}
|
||||
) // {
|
||||
nixosModules = rec {
|
||||
yandex-music = {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
yandex-music = yandex-music-with prev;
|
||||
})
|
||||
];
|
||||
}];
|
||||
};
|
||||
default = yandex-music;
|
||||
};
|
||||
|
||||
nixosModule = self.nixosModules.default;
|
||||
};
|
||||
}
|
||||
|
BIN
icons/apple-touch-icon.png
Normal file
BIN
icons/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
icons/favicon.png
Normal file
BIN
icons/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
4
icons/favicon.svg
Normal file
4
icons/favicon.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg width="445" height="445" viewBox="0 0 442 445" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M220.86 445C342.838 445 441.72 345.383 441.72 222.5C441.72 99.6166 342.838 0 220.86 0C98.8825 0 0 99.6166 0 222.5C0 345.383 98.8825 445 220.86 445Z" fill="black"/>
|
||||
<path d="M388.708 178.197L387.278 171.452L330.975 161.518L363.753 116.785L359.979 112.401L311.802 135.794L317.888 73.7995L312.958 70.8868L283.65 121.169L250.842 46.3281H245.06L252.881 118.533L170.161 51.571L163.192 53.6252L226.769 134.629L100.802 92.2262L94.9892 98.6648L207.595 163.572L52.3207 176.725L50.5859 186.383L211.947 204.197L77.2767 317.087L83.0895 324.967L243.295 236.666L211.673 392.235H221.26L282.767 245.741L320.232 360.348L326.897 355.075L311.528 238.72L369.839 305.681L373.613 299.519L328.936 216.491L391.326 239.885L391.904 232.864L335.905 191.044L388.708 178.197Z" fill="#FED42B"/>
|
||||
</svg>
|
After Width: | Height: | Size: 879 B |
@ -30,6 +30,7 @@ stdenvNoCC.mkDerivation
|
||||
repack = ./../repack.sh;
|
||||
patches = ./../patches;
|
||||
utility = ./../utility;
|
||||
icons = ./../icons;
|
||||
desktopItem = ../templates/desktop;
|
||||
src =
|
||||
if ymExe != null
|
||||
@ -44,6 +45,7 @@ stdenvNoCC.mkDerivation
|
||||
cp -r $repack ./repack.sh
|
||||
cp -r $patches ./patches
|
||||
cp -r $utility ./utility
|
||||
cp -r $icons ./icons
|
||||
bash "./repack.sh" -o "./app" "$src"
|
||||
'';
|
||||
dontPatch = true;
|
||||
|
@ -9,4 +9,3 @@ diff --git a/package.json b/package.json
|
||||
+ },
|
||||
+ "license": "UNLICENSED"
|
||||
}
|
||||
--
|
||||
|
@ -12,4 +12,3 @@ diff --git a/package.json b/package.json
|
||||
+ "scalable": "build/next-desktop/favicon.svg"
|
||||
+ }
|
||||
}
|
||||
--
|
||||
|
@ -5,8 +5,8 @@ diff --git a/main/lib/createWindow.js b/main/lib/createWindow.js
|
||||
x: 16,
|
||||
y: 10
|
||||
},
|
||||
- minWidth: 1024,
|
||||
- minHeight: 800,
|
||||
- minWidth: 768,
|
||||
- minHeight: 650,
|
||||
width: 1280,
|
||||
height: 800,
|
||||
webPreferences: {
|
||||
|
@ -19,7 +19,7 @@ nopatch=0
|
||||
while getopts :xo:ph name; do
|
||||
case $name in
|
||||
x) extract_only=1 ;;
|
||||
o) dst="$OPTARG" ;;
|
||||
o) dst="$(realpath "$OPTARG")" ;;
|
||||
p) nopatch=1 ;;
|
||||
h)
|
||||
usage
|
||||
@ -83,6 +83,10 @@ find "./" -type f -name "*.html" -print0 | while IFS= read -r -d $'\0' file; do
|
||||
done
|
||||
echo "Title Fixed"
|
||||
|
||||
echo "Replacing Icons"
|
||||
cp -drf "$SCRIPT_DIR/icons/." "./build/next-desktop/"
|
||||
echo "Replaced Icons"
|
||||
|
||||
# applying patches
|
||||
|
||||
# This function accepts patch file. If it names starts with `XXXX-optional`,
|
||||
|
@ -14,7 +14,7 @@ source=("%exe_link%" "git+https://github.com/cucumber-sp/yandex-music-linux")
|
||||
sha256sums=("%exe_sha256%" "SKIP")
|
||||
|
||||
build() {
|
||||
sh "$srcdir/yandex-music-linux/repack.sh" "$srcdir/%exe_name%"
|
||||
bash "$srcdir/yandex-music-linux/repack.sh" "$srcdir/%exe_name%"
|
||||
}
|
||||
|
||||
package() {
|
||||
|
@ -4,7 +4,7 @@ Name[ru]=Яндекс Музыка
|
||||
Comment=Yandex Music — we collect music for you
|
||||
Comment[ru]=Яндекс Музыка — собираем музыку для вас
|
||||
GenericName=YandexMusic
|
||||
Exec=yandex-music %U
|
||||
Exec=yandex-music --no-sandbox %U
|
||||
Icon=yandex-music
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
|
33
templates/rpm.spec
Normal file
33
templates/rpm.spec
Normal file
@ -0,0 +1,33 @@
|
||||
Name: yandex-music
|
||||
Version: %version%
|
||||
Release: 1
|
||||
Summary: Yandex Music Client
|
||||
License: Custom
|
||||
URL: https://github.com/cucumber-sp/yandex-music-linux
|
||||
|
||||
Source0: %source_tarball%
|
||||
|
||||
BuildArch: %arch%
|
||||
|
||||
Requires: (kde-cli-tools or kde-cli-tools5 or kde-runtime or trash-cli or glib2 or gvfs-client), (libXtst or libXtst6), (libnotify or libnotify4), (libxcb or libxcb1), (mesa-libgbm or libgbm1), (nss or mozilla-nss), at-spi2-core, gtk3, libdrm, xdg-utils
|
||||
|
||||
%description
|
||||
Yandex Music - Personal recommendations, selections for any occasion and new music
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%install
|
||||
|
||||
cp -r ./usr %{buildroot}/
|
||||
chmod 755 %{buildroot}/usr/bin/yandex-music
|
||||
|
||||
|
||||
%files
|
||||
/usr/bin/yandex-music
|
||||
/usr/lib/yandex-music
|
||||
/usr/share/applications/yandex-music.desktop
|
||||
/usr/share/icons/hicolor/48x48/apps/yandex-music.png
|
||||
/usr/share/icons/hicolor/scalable/apps/yandex-music.svg
|
||||
/usr/share/licenses/yandex-music
|
||||
/usr/share/pixmaps/yandex-music.png
|
@ -1,14 +1,14 @@
|
||||
{
|
||||
"ym": {
|
||||
"version": "5.0.12",
|
||||
"exe_name": "Yandex_Music_x64_5.0.12.exe",
|
||||
"exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.12.exe",
|
||||
"exe_sha256": "4ebeac9620f60e9e2333114cf8c8fb3dc6f2c2c70da58ba56902aa75d65ce4f8"
|
||||
"version": "5.0.14",
|
||||
"exe_name": "Yandex_Music_x64_5.0.14.exe",
|
||||
"exe_link": "https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe",
|
||||
"exe_sha256": "c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4"
|
||||
},
|
||||
"electron": {
|
||||
"version": "27.3.3",
|
||||
"x64": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-x64.zip",
|
||||
"armv7l": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-armv7l.zip",
|
||||
"arm64": "https://github.com/electron/electron/releases/download/v27.3.3/electron-v27.3.3-linux-arm64.zip"
|
||||
"version": "27.3.5",
|
||||
"x64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-x64.zip",
|
||||
"armv7l": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-armv7l.zip",
|
||||
"arm64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-arm64.zip"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user