diff options
author | Tom "Ravi" Hale | 2018-11-04 12:36:26 +0700 |
---|---|---|
committer | Tom "Ravi" Hale | 2023-06-29 09:40:08 +0700 |
commit | 4dd5b87a9984eb3dc94f6114674a8e96cdf4d6ef (patch) | |
tree | bf92fc6aa427c397682576b1d7e97283a380a9e2 | |
parent | 690b470dce1676ae4d631efab8b3ee22e25b6077 (diff) | |
download | aur-4dd5b87a9984eb3dc94f6114674a8e96cdf4d6ef.tar.gz |
PKGBUILD: add first working version
-rw-r--r-- | PKGBUILD | 75 |
1 files changed, 48 insertions, 27 deletions
@@ -1,63 +1,84 @@ # Maintainer: Tom Hale <tom[noodle]hale[point]ee> _pkgname=nixnote2 -pkgname=${_pkgname}-appimage-bin -pkgver=2.1.0.beta4j +pkgname=${_pkgname}-latest-bin +pkgver=2.1.0.beta5a pkgrel=1 pkgdesc='Evernote clone (formerly Nevernote) - latest binary release' url="https://github.com/robert7/$_pkgname" arch=(x86_64) license=(GPL3) -depends=(zlib) # For --appimage-extract +depends=(hicolor-icon-theme) makedepends=(git) +conflicts=(nixnote2-git) provides=("nixnote=${pkgver%.r*}" "$_pkgname=${pkgver%.r*}") replaces=(nevernote nixnote nixnote-beta) -source=("$_pkgname.AppImage::$url/releases/download/continuous/NixNote2-${CARCH}.AppImage") +_appimage_path=$(curl -s 'https://github.com/robert7/nixnote2/releases' | + sed -En 's|.*(/releases/download/v[^"]+[Aa]pp[Ii]mage)".*|\1|p' | + head -n1) +echo XXX Using latest AppImage # XXX +_appimage_path='/releases/download/continuous-develop/NixNote2-x86_64.AppImage' +source=("$url/$_appimage_path" + nixnote2 + nixnote2.desktop.patch) # https://github.com/robert7/nixnote2/releases/tag/continuous-develop -sha256sums=('SKIP') +sha256sums=(SKIP + 3731377af54d7b98af271e5d2e1bdbc50ae82f07e445597aff89b6c2769faa31 + 4f12cddc49e0c694f41e344acebc0d8a3bce07a3496098eb2fae258ba9044967) OPTIONS=(!strip) # Stripping an AppImage makes it non-functional -# Directories which contain files to unpack / install -# Note that --appimage-extract currently doesn't support recursive extraction -# Also, `install` doesn't support directories, only files: -# https://unix.stackexchange.com/questions/475242/install-directories-recursively-with-gnu-install +PKGEXT=".pkg.tar" + +# All files in the directories specified are extracted +# Note that --appimage-extract currently doesn't support recursive extraction: +# https://github.com/AppImage/AppImageKit/issues/370 _extract_dirs=(usr/share/applications - usr/share/doc/nixnote2 usr/share/man/man1 + usr/share/icons/hicolor/48x48/apps usr/share/nixnote2 - usr/share/icons/hicolor/48x48/apps) + usr/share/nixnote2/help + usr/share/nixnote2/translations) + prepare() { - chmod 755 "$_pkgname.AppImage" + _appimage=${_appimage_path##*/} # basename of AppImage + yelp _appimage=$_appimage + chmod 755 "$_appimage" # Due to this issue, all --appimage-extract target directories must already exist # https://github.com/AppImage/AppImageKit/issues/363 local dir for dir in "${_extract_dirs[@]}"; do mkdir -p squashfs-root/"$dir" - "./$_pkgname.AppImage" --appimage-extract "$dir/*" + "./$_appimage" --appimage-extract "$dir/*" done + + rm -r squashfs-root/usr/share/"$_pkgname"/{java,images} # Remove non-human resources + + # Directories are extracted with no permissions for group and other. Fix: + find squashfs-root -type d -exec chmod go+rx -- {} + } +# pkg/nixnote2-latest-bin/usr/share/icons/hicolor/48x48/apps/nixnote2.png + pkgver() { - cat squashfs-root/usr/share/nixnote2/version.txt | sed 's/-/./g' + sed 's/-/./g' < squashfs-root/usr/share/nixnote2/version.txt } package() { cd "$pkgdir" + _appimage=${_appimage_path##*/} # basename of AppImage + yelp _appimage=$_appimage - install -Dm755 -t "opt/$_pkgname" "$SRCDEST/$_pkgname.AppImage" +yelp $PWD + # User resources + cp -pr "$srcdir"/squashfs-root/usr . - local dir file - for dir in "${_extract_dirs[@]}"; do - for file in "$srcdir/squashfs-root/$dir"/*; do - # install fails if given a directory, so check: - [[ -f $file ]] && install -Dm644 -t "$dir" "$file" - done - done + # AppImage itself + install -Dm755 -t "opt/$_pkgname" "$SRCDEST/$_appimage" + + # Wrapper script for /usr/bin + install -Dm755 -t usr/bin "$SRCDEST/$_pkgname" - # Create symlink to AppImage - install -d usr/bin - # Install copies symlink targets rather than the symlink itself - # https://unix.stackexchange.com/q/475246/143394 - (cd usr/bin && ln -fs "/opt/$_pkgname/$_pkgname.AppImage" "$_pkgname") + # Make a constant filename that the wrapper can execute + ( cd opt/"$_pkgname" && ln -s "$_appimage" "$_pkgname" ) } |