-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinstall.sh
executable file
·86 lines (73 loc) · 2.35 KB
/
install.sh
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
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
set -e
if [ "$UID" = "0" ]; then
echo 'This should not be run as root'
exit 101
fi
NAME=awesome-tiles\@velitasali.com
function pack-extension {
echo "Packing extension..."
gnome-extensions pack src \
--force \
--podir="../po" \
--extra-source="constants.js" \
--extra-source="prefs-utils.js" \
--extra-source="utils.js" \
--extra-source="windowMover.js" \
--extra-source="prefs-shortcut-dialog.ui" \
--extra-source="../LICENSE"
}
function compile-preferences {
if [ -d src/resources ]; then
echo 'Compiling resources...'
glib-compile-resources --sourcedir=src/resources \
--target=src/resources/prefs.gresource \
src/resources/org.gnome.shell.extensions.awesome-tiles.prefs.gresource.xml
else
echo 'No resources to compile... Skipping'
fi
if [ -d src/schemas ]; then
echo 'Compiling schemas...'
glib-compile-schemas --targetdir=src/schemas src/schemas
else
echo 'No schemas to compile... Skipping'
fi
}
function restart-shell {
echo 'Restarting shell...'
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting…", global.context)'
echo 'Done'
}
function usage() {
echo 'Usage: ./install.sh COMMAND'
echo 'COMMAND:'
echo " local-install install the extension in the user's home directory"
echo ' under ~/.local'
echo ' zip Creates a zip file of the extension'
echo ' update-po Update po files to match source files'
}
function update-po() {
echo '' > messages.po
find ./src -type f \( -name "*.ui" -or -name "*.js" \) | xgettext --from-code utf-8 -j messages.po -f -
sed -i 's|"Content\-Type: text/plain; charset=CHARSET\\n"|"Content-Type: text/plain; charset=UTF-8\\n"|g' messages.po
find ./po -type f -name "*.po" | xargs -i msgmerge {} messages.po -N --no-wrap -U
mv messages.po $(find ./po -type f -name "*.pot")
}
case "$1" in
"local-install" )
compile-preferences
pack-extension
gnome-extensions install --force $NAME.shell-extension.zip && restart-shell
;;
"zip" )
compile-preferences
pack-extension
;;
"update-po" )
update-po
;;
* )
usage
;;
esac
exit