From 217c54a5c3c6461c06071e98fa7b798655be114e Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 19 Jul 2018 01:10:52 +0200 Subject: [PATCH] Provide Arch Linux PKGBUILD to be pushed to AUR closes #1145 --- .gitignore | 17 ++++++--- build/linux/arch/PKGBUILD | 53 ++++++++++++++++++++++++++++ build/linux/arch/ledger-live.desktop | 10 ++++++ scripts/helpers/display-env.sh | 6 ++-- scripts/publish-arch-package.sh | 44 +++++++++++++++++++++++ 5 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 build/linux/arch/PKGBUILD create mode 100644 build/linux/arch/ledger-live.desktop create mode 100755 scripts/publish-arch-package.sh diff --git a/.gitignore b/.gitignore index 649b19be..65ca3013 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,20 @@ -.DS_Store -*.log /.env /dist/ /flow-typed/ /node_modules/ /static/fonts/museosans/ /storybook-static/ -thumbs.db + +/build/linux/arch/.SRCINFO +/build/linux/arch/pkg +/build/linux/arch/src +/build/linux/arch/*.tar.gz +/build/linux/arch/*.tar.xz + +# TODO this should be in devs global gitignore +# it makes no sense to have it here +*.log +.DS_Store .vscode -jsconfig.json \ No newline at end of file +thumbs.db +jsconfig.json diff --git a/build/linux/arch/PKGBUILD b/build/linux/arch/PKGBUILD new file mode 100644 index 00000000..6a76ecc0 --- /dev/null +++ b/build/linux/arch/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Meriadec Pillet +# shellcheck disable=SC2154,SC2034,SC2164 + +pkgname=ledger-live +pkgver=1.0.3 +pkgrel=1 +pkgdesc="Open source companion app for your Ledger devices" +arch=('x86_64') +url="https://www.ledgerwallet.com/live" +license=('MIT') +makedepends=(yarn python2) + +# TODO generate changelog from release notes +changelog= + +source=("https://github.com/LedgerHQ/ledger-live-desktop/archive/v${pkgver}.tar.gz" + "ledger-live.desktop") +md5sums=('51ff80d0db79e82c52c1732b52ff1174' + '52705147909a0a988907a23a71199092') +# TODO sign with ledger pgp +validpgpkeys=() + +extractedFolder=ledger-live-desktop-$pkgver + +prepare() { + cd $extractedFolder + export JOBS=max + yarn --ignore-scripts +} + +build() { + cd $extractedFolder + export GIT_REVISION=$pkgver + export JOBS=max + yarn dist +} + +package() { + install -D -m644 \ + "${pkgname}.desktop" \ + "${pkgdir}/usr/share/applications/${pkgname}.desktop" + + cd $extractedFolder + + install -dm755 "${pkgdir}/opt" + cp -r "dist/linux-unpacked" "${pkgdir}/opt/ledger-live" + install -dm755 "${pkgdir}/usr/bin" + ln -s "/opt/${pkgname}/ledger-live-desktop" "${pkgdir}/usr/bin/${pkgname}" + + install -D -m644 \ + "static/images/browser-window-icon-512x512.png" \ + "${pkgdir}/usr/share/icons/hicolor/512x512/apps/ledger-live.png" +} diff --git a/build/linux/arch/ledger-live.desktop b/build/linux/arch/ledger-live.desktop new file mode 100644 index 00000000..aaa950e5 --- /dev/null +++ b/build/linux/arch/ledger-live.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=ledger-live +Comment=Open source companion app for your Ledger devices +Path=/opt/ledger-live +Exec=ledger-live +Icon=ledger-live +Type=Application +StartupNotify=true +Categories=Utility; +StartupWMClass=ledger-live diff --git a/scripts/helpers/display-env.sh b/scripts/helpers/display-env.sh index 2407d0f9..5f903413 100644 --- a/scripts/helpers/display-env.sh +++ b/scripts/helpers/display-env.sh @@ -3,10 +3,12 @@ # shellcheck disable=SC1091 source scripts/helpers/format.sh -appVersion=$(grep version package.json | sed 's/.*"\(.*\)",$/\1/') +if [ "$GIT_REVISION" == "" ]; then + GIT_REVISION=$(git rev-parse HEAD) +fi echo -printf " │ \\e[4;1m%s\\e[0;0m\\n" "Ledger Live Desktop - ${appVersion}" +printf " │ \\e[4;1m%s\\e[0;0m\\n" "Ledger Live Desktop - ${GIT_REVISION}" printf " │ \\e[1;30m%s\\e[1;0m\\n" "$(uname -srmo)" printf " │ \\e[2;1mcommit \\e[0;33m%s\\e[0;0m\\n" "$(git rev-parse HEAD)" echo diff --git a/scripts/publish-arch-package.sh b/scripts/publish-arch-package.sh new file mode 100755 index 00000000..937e921e --- /dev/null +++ b/scripts/publish-arch-package.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +# shellcheck disable=SC1091 +source scripts/helpers/run-job.sh + +# shellcheck disable=SC1091 +source scripts/helpers/display-env.sh + +gitTag=$(git describe --tags) +tmpDir=$(mktemp -d) + +runJob \ + "pushd build/linux/arch >/dev/null; makepkg --printsrcinfo > .SRCINFO; popd >/dev/null" \ + "creating .SRCINFO" \ + "successfully created .SRCINFO" \ + "error creating .SRCINFO" + +runJob \ + "git clone ssh://aur@aur.archlinux.org/ledger-live.git ${tmpDir}" \ + "cloning AUR repository" \ + "cloned AUR repository" \ + "error cloning AUR repository" + +runJob \ + "cp build/linux/arch/* \"${tmpDir}\"; cp build/linux/arch/.SRCINFO \"${tmpDir}\"" \ + "copying files" \ + "copied files" \ + "error copying files" + +ls -l "$tmpDir" + +# shellcheck disable=SC2164 +cd "$tmpDir" + +git add . +git commit -m "Build for ${gitTag}" + +runJob \ + "git push origin master" \ + "pushing package" \ + "successfully pushed package" \ + "error pushing package"