Files
omarchy-pkgs/pkgbuilds/elsewhen/PKGBUILD
T

71 lines
2.7 KiB
Bash

# Maintainer: Spencer Bull <spencer.bull@hey.com>
pkgname=elsewhen
pkgver=0.1.0
pkgrel=1
pkgdesc='World clock plugin for the Omarchy shell'
arch=('any')
url='https://github.com/omacom/elsewhen'
license=('MIT')
# What the plugin needs to load and run. It also shells out to bash, date
# (coreutils) and timedatectl (systemd) and reads /usr/share/zoneinfo
# (tzdata); those are members of the base group and stay implicit, per Arch
# convention. The citations for each entry are in .omarchy/README.md.
depends=(
'omarchy'
'python'
'quickshell'
)
options=('!debug')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
# Fill once the v0.1.0 tag exists:
# curl -fsSL https://github.com/omacom/elsewhen/archive/refs/tags/v0.1.0.tar.gz | sha256sum
# bin/sync-upstream rewrites this array only when it moves pkgver forward, so
# the first release's digest has to be entered by hand.
sha256sums=('FILL_FROM_RELEASE_ARCHIVE')
package() {
# The packaged plugin root, scanned by the shell between its bundled
# plugins and ~/.config/omarchy/plugins since omarchy PR #12051. An older
# shell never looks here, so on it this package installs cleanly and does
# nothing; there is no omarchy version to pin until a release carries #12051.
local plugin="$pkgdir/usr/share/omarchy/plugins/omacom.elsewhen"
cd "$srcdir/$pkgname-$pkgver" || return 1
# The shell loads the entry point each manifest declares. A tree without
# either would install cleanly and never load, so fail the build instead of
# shipping it.
[[ -f manifest.json ]] || {
echo "release tree is missing manifest.json" >&2
return 1
}
grep -Eq '"id"[[:space:]]*:[[:space:]]*"omacom\.elsewhen"' manifest.json || {
echo "manifest.json does not declare the plugin id omacom.elsewhen" >&2
return 1
}
grep -Eq '"barWidget"[[:space:]]*:[[:space:]]*"Panel\.qml"' manifest.json || {
echo "manifest.json does not name Panel.qml as the bar widget entry point" >&2
return 1
}
[[ -f Panel.qml ]] || {
echo "release tree is missing the entry point Panel.qml" >&2
return 1
}
# An explicit allow-list of runtime files, so tests/, .github/ and the rest
# of the repository never reach the package. Directories end up 0755 and
# every file 0644: worldclock-data.py runs as `python3 <path>` and needs no
# execute bit. An unmatched glob is left literal and fails install, which
# is the right outcome for a release tree missing its QML or JS.
local file
for file in manifest.json cities.json world.json worldclock-data.py *.qml *.js; do
install -Dm644 "$file" "$plugin/$file"
done
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
}