-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall.sh
executable file
·49 lines (40 loc) · 1.29 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
#!/bin/bash -e
BASEDIR="$HOME/.local/share/gnome-shell/extensions"
DIR="[email protected]"
URL="https://github.com/kishorv06/window-state-manager.git"
which gnome-shell 2> /dev/null > /dev/null || ( echo Could not find GNOME Shell ; exit 1 )
GSVERSION=$(gnome-shell --version | awk '{ print $3; }')
case $GSVERSION in
45|45.*|46|46.*|47|47.*)
echo "Version ${GSVERSION} is supported."
;;
*)
echo "Unsupported GNOME version ${GSVERSION}!"
exit
;;
esac
mkdir -p ${BASEDIR} 2> /dev/null
echo "Installing to ${BASEDIR}/${DIR}..."
if [ "$1" == "--install-from-local" ]; then
# Install from current directory
mkdir -p "${BASEDIR}/${DIR}" 2> /dev/null
rsync -r --exclude '.git' . "${BASEDIR}/${DIR}"
else
# Install from git
which git 2> /dev/null > /dev/null || ( echo Could not find Git ; exit 1 )
cd ${BASEDIR} || ( echo Could not change to ${BASEDIR} ; exit 2 )
if [ -d ${DIR}/.git ]; then
echo "Extension already installed. Updating..."
cd ${DIR} || exit
git pull
else
if [ -d ${DIR} ]; then
echo Found a previous installation.
echo If you are sure you want to replace it, please delete this folder and retry.
exit 4
else
git clone ${URL} ${DIR} || exit 3
fi
fi
fi
echo "Restart GNOME-Shell. For Wayland, logout and login. For X: killall -HUP gnome-shell"