This repository has been archived by the owner on Aug 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·67 lines (59 loc) · 1.78 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
#!/bin/sh
# Path to the repository's root
src=$(dirname "$0")
# Default the installation path to '~/.local/share/gnome-shell/extensions'
if [ $# -ge 1 ]
then
path="$@"
else
path=~/.local/share/gnome-shell/extensions
fi
# Called if something goes wrong
die() {
echo 'Installation failed:' "$@"
exit 1
}
# Check that the installation path is a directory
if [ ! -e "$path" ]
then
# Create it if it doesn't exist yet
mkdir -p "$path" \
|| die "Cannot create '$path'"
elif [ ! -d "$path" ]
then
die "'$path' is not a directory"
fi
# Remove previous installation if any
if [ -d "$path/[email protected]" ]
then
read -p 'Previous installation found. Replace it? [Y/n]: ' choice
if [ -z "$choice" ] || [ "$choice" = 'y' ] || [ "$choice" = 'Y' ]
then
rm -rf "$path/[email protected]" \
|| die "Cannot remove '$path/[email protected]'"
else
echo 'Nothing installed'
exit 1
fi
fi
# Create the extension directory
mkdir -p "$path/[email protected]/schemas" \
|| die "Cannot create directory '$path/[email protected]/schemas'"
# Copy the necessary files
cp "$src/extension.js" \
"$src/prefs.js" \
"$src/metadata.json" \
"$path/[email protected]" \
|| die "Cannot copy files to '$path/[email protected]'"
cp "$src/schemas/gschemas.compiled" \
"$src/schemas/[email protected]" \
"$path/[email protected]/schemas" \
|| die "Cannot copy files to '$path/[email protected]/schemas'"
cp -r "$src/locale" \
"$path/[email protected]/locale" \
|| die "Cannot copy files to '$path/[email protected]/locale'"
cp -r "$src/modules" \
"$path/[email protected]/modules" \
|| die "Cannot copy files to '$path/[email protected]/modules'"
# Done!
echo 'Installation finished!'