-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-zip.sh
More file actions
executable file
·77 lines (64 loc) · 1.62 KB
/
make-zip.sh
File metadata and controls
executable file
·77 lines (64 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
set -e
# Based on script by Florian Müllner gnome-shell-extensions/export-zips.sh
# and gamemode-extension/make-zip.sh by Christian Kellner
# Check script dependencies
for cmd in meson ninja gnome-extensions zip; do
if ! [ -x "$(command -v ${cmd})" ]; then
echo "Need '${cmd}' command. Please install." >&2
exit 1
fi
done
srcdir=`dirname $0`
srcdir=`(cd $srcdir && pwd)`
builddir="${srcdir}/.build-zip"
installdir="${srcdir}/.install-zip"
uuid="focus-timer@focustimerhq.github.io"
zipname="$uuid.zip"
# Build the extension and install it into a temporary directory.
# Then, pack the extension into a zip file.
build () {
meson setup --prefix=$installdir -Dbundle=true $srcdir $builddir
ninja -C$builddir install
extensiondir="${installdir}/share/gnome-shell/extensions/${uuid}"
(cd $extensiondir && zip -qr "${srcdir}/${zipname}" .)
echo "Extension saved to ${zipname}"
}
validate () {
if [ ! -d "${srcdir}/venv" ] || [ ! -x "${srcdir}/venv/bin/shexli" ]; then
echo "Skipping validation (shexli not available)" >&2
return 0
fi
source "${srcdir}/venv/bin/activate"
"${srcdir}/venv/bin/shexli" "${srcdir}/${zipname}"
}
install () {
gnome-extensions install --force "${zipname}" || exit 1
echo "Installed ${uuid}"
}
cleanup () {
rm -rf $builddir
rm -rf $installdir
}
usage () {
echo "usage: $0 [install]"
exit 1
}
if [ "$#" -ge 1 ]; then
case "$1" in
install)
cleanup
build
validate
cleanup
install
;;
*)
usage
;;
esac
else
cleanup
build
validate
fi