Created
February 9, 2019 20:39
-
-
Save loukwn/49fe3d9c4a809acb2a66c9b0af20029b to your computer and use it in GitHub Desktop.
Install a gnome shell extension from a zip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
username=$(whoami) | |
if [[ $# -eq 0 ]]; then | |
echo "No arguments supplied" | |
else | |
# get the extension uuid | |
ext_name=$(unzip -c $1 metadata.json | grep uuid | cut -d \" -f4) | |
# check if it already exists | |
search_ext=$(ls /home/$username/.local/share/gnome-shell/extensions/ | grep "$ext_name") | |
if [[ "$ext_name" == "$search_ext" ]]; then | |
echo "$ext_name : Already installed" | |
else | |
if [[ ! -z "$ext_name" ]]; then | |
# create the folder in / | |
mkdir -p "/home/$username/.local/share/gnome-shell/extensions/$ext_name" | |
# unzip everything inside | |
unzip -q $1 -d "/home/$username/.local/share/gnome-shell/extensions/$ext_name/" | |
# install the extension | |
gnome-shell-extension-tool -e $ext_name | |
else | |
# error | |
echo "Wrong type of input" | |
fi | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice script!