Skip to content

Instantly share code, notes, and snippets.

@TaylanTatli
Created September 16, 2023 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TaylanTatli/88c0e344c65408be038e1596365019ca to your computer and use it in GitHub Desktop.
Save TaylanTatli/88c0e344c65408be038e1596365019ca to your computer and use it in GitHub Desktop.
UpNote
# Maintainer: taylantatli <taylantatli90 at gmail dot com>
pkgname=upnote-git
pkgver=8.0.4
pkgrel=1
pkgdesc="UpNote's a beautiful app for writing and organizing."
arch=('x86_64')
url="https://getupnote.com"
license=('custom')
conflicts=('upnote')
options=(!strip) # necessary otherwise the AppImage file in the package is truncated
source=("https://upnote.sfo3.cdn.digitaloceanspaces.com/UpNote.AppImage")
sha512sums=('52df8588fd68be159b326f3780ccbefb02168acf5f5adf795023af70faa210706b80acf7565d92018b4e0951dc9061bf7db0f9a111a69f25c83d8dabe269252e')
_filename="UpNote.AppImage"
_squashfs_desktop_file="upnote.desktop"
_desktop_file="/usr/share/applications/upnote.desktop"
_appimage_name=$(echo "${_filename}"|sed -E 's/-[0-9]*.[0-9]*.[0-9]*//')
_install_path="/opt/appimages/${_appimage_name}"
package() {
chmod +x "${_filename}"
mkdir -p squashfs-root/usr/share/icons/hicolor/{72x72,16x16}/apps
./${_filename} --appimage-extract "usr/share/icons/hicolor/*/apps/upnote.png" > /dev/null 2>&1
./${_filename} --appimage-extract upnote.desktop > /dev/null 2>&1
sed -i -E "s|Exec=AppRun|Exec=${_install_path}|" "squashfs-root/${_squashfs_desktop_file}"
# install icons
install -dm755 "${pkgdir}/usr/share/icons"
cp -dpr --no-preserve=ownership "squashfs-root/usr/share/icons" "${pkgdir}/usr/share"
chmod -R 755 "${pkgdir}/usr/share/icons"
find "${pkgdir}/usr/share/icons" -type f -name "upnote.png" -exec chmod 644 {} \;
# install .desktop file and image file
# disable appimage desktop integration: https://github.com/AppImage/AppImageSpec/blob/master/draft.md#desktop-integration
# disable AppimageLauncher integration prompt
# https://github.com/TheAssassin/AppImageLauncher/issues/78#issuecomment-466390939
sed -i -E "s|Exec=${_install_path}|Exec=env DESKTOPINTEGRATION=0 APPIMAGELAUNCHER_DISABLE=1 /usr/bin/upnote|" "squashfs-root/${_squashfs_desktop_file}"
install -Dm644 "squashfs-root/${_squashfs_desktop_file}" "${pkgdir}/${_desktop_file}"
install -Dm755 "${_filename}" "${pkgdir}/${_install_path}"
mkdir "${pkgdir}/usr/bin/" && chmod 755 "${pkgdir}/usr/bin/"
ln -s "${_install_path}" "${pkgdir}/usr/bin/upnote"
# disable AppImage integration prompt
# https://github.com/electron-userland/electron-builder/issues/1962
install -dm755 "${pkgdir}/usr/share/appimagekit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment