Skip to content

Instantly share code, notes, and snippets.

@getzze
Last active April 1, 2019 15:27
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 getzze/8c75486b3f44ea22a3fe61a65b1d8ef8 to your computer and use it in GitHub Desktop.
Save getzze/8c75486b3f44ea22a3fe61a65b1d8ef8 to your computer and use it in GitHub Desktop.
PKGBUILD gnome-shell-extension-activities-config
# Maintainer: XZS <d dot f dot fischer at web dot de>
# This PKGBUILD is maintained on GitHub <https://github.com/dffischer/gnome-shell-extensions>.
# You may find it convenient to file issues and pull requests there.
pkgname=gnome-shell-extension-activities-config
pkgver=71
pkgrel=1
pkgdesc="Configure the Activities Button via the Gnome Shell Extension Preferences Tool."
arch=(any)
url="https://extensions.gnome.org/extension/358/activities-configurator/"
license=(GPLv2)
source=('archlinux-logo-gray-scalable.svg')
md5sums=('69063bc3433d20d9de0f9dce2269186b')
find_version() {
if [ ! -d version ]; then
curl -s ${url} | # download source of the extension page
grep -Po '(?<=data-svm=").*(?=")' | # extract version information
sed 's/&quot;/"/g' | # unescape quotes
sed 's/[{ ,]*"[[:digit:].]\+": {"pk": \([[:digit:]]\+\),'$(
)' "version": \([[:digit:]]\+\)}[ ,}]*/\2 \1\n/g' | # list one version per line
sort -nr | head -n1 | tr ' ' '\n' > version # get newest and write
fi
}
pkgver() {
find_version
head -n1 version
}
prepare() {
find_version
local name=$(tail -n1 version).shell-extension.zip
if [ ! -f $name ]
then
curl -LO "https://extensions.gnome.org/review/download/$name"
unzip -od extension $name
fi
}
build() {
cd extension
sed -i '/^const ICON_FILE =.*$/{
s|face-smile-3.svg|archlinux-logo-gray-scalable.svg|;
s|//.*|// Arch Linux Icon.|}' keys.js
cp --remove-destination ../archlinux-logo-gray-scalable.svg archlinux-logo-gray-scalable.svg
}
package() {
for function in $(declare -F | grep -Po 'package_[[:digit:]]+[[:alpha:]_]*$')
do
$function
done
}
package_01_locate() {
msg2 'Locating extension...'
cd "$(find -name 'metadata.json' -execdir test -e extension.js \; \
-printf '%C@ %h\n' | sort -nr | sed 's/^.* //;q' )"
extname=$(grep -Po '(?<="uuid": ")[^"]*' metadata.json)
destdir="$pkgdir/usr/share/gnome-shell/extensions/$extname"
}
package_02_install() {
msg2 'Installing extension code...'
find -maxdepth 1 \( -iname '*.js*' -or -iname '*.css' -or -iname '*.ui' \) \
-exec install -Dm644 -t "$destdir" '{}' +
}
depends+=(gnome-shell-extensions gnome-shell)
package_09_icon() {
install -Dm644 *.svg "$destdir"
}
package_10_locale() {
msg2 'Installing translations...'
(
cd locale
for locale in */
do
install -Dm644 -t "$pkgdir/usr/share/locale/$locale/LC_MESSAGES" "$locale/LC_MESSAGES"/*.mo
done
)
}
package_20_schemas() {
msg2 'Installing schemas...'
find -name '*.xml' -exec install -Dm644 -t "$pkgdir/usr/share/glib-2.0/schemas" '{}' +
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment