mirror of
https://github.com/kevinveenbirkenbach/cli-gnome-extension-manager.git
synced 2024-11-22 16:31:03 +01:00
Compare commits
4 Commits
46e8a481ca
...
639b09e9a4
Author | SHA1 | Date | |
---|---|---|---|
639b09e9a4 | |||
d211d53264 | |||
5ef2d65f88 | |||
7857bb099b |
@ -1,49 +1,52 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# @param $1 enable|disable
|
# @param $1 enable|disable
|
||||||
# @param $2 extension name
|
# @param $2 extension name
|
||||||
# @param $3 repository path [optional]
|
# @param $3 repository path [optional]
|
||||||
|
|
||||||
action_type="$1"
|
action_type="$1"
|
||||||
extension_name="$2"
|
extension_name="$2"
|
||||||
extension_repository_path="$3"
|
extension_repository_path="$3"
|
||||||
extension_folder="$HOME/.local/share/gnome-shell/extensions/$extension_repository_path/"
|
extension_folder="$HOME/.local/share/gnome-shell/extensions/$extension_name/"
|
||||||
echo "Install GNOME extension \"$extension_name\"..."
|
|
||||||
if [ "$action_type" == "enable" ];
|
|
||||||
then
|
|
||||||
if [ -z "$extension_repository_path" ];
|
|
||||||
then
|
|
||||||
if [ -d "$extension_folder" ];
|
|
||||||
then
|
|
||||||
if [ -d "$extension_folder"".git" ];
|
|
||||||
then
|
|
||||||
echo "Pulling changes from git..." &&
|
|
||||||
(cd "$extension_folder" && git pull) || exit 1
|
|
||||||
else
|
|
||||||
echo "No git repository. Extension will not be updated."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Install..." &&
|
|
||||||
git clone "$extension_repository_path" "$extension_folder" || exit 1
|
|
||||||
fi
|
|
||||||
if [ -f "$extension_folder""Makefile" ];
|
|
||||||
then
|
|
||||||
|
|
||||||
tmp_extension_folder="/tmp/$extension_repository_path"
|
echo "=== GNOME Extension Installer ==="
|
||||||
mv "$extension_folder" "$tmp_extension_folder"
|
|
||||||
echo "Compilling extension.."
|
|
||||||
(cd "$tmp_extension_folder" && make install) || exit 1 "Compilation with failed."
|
|
||||||
|
|
||||||
echo "Cleaning up tmp-extension folder..."&&
|
echo "Installing GNOME extension \"$extension_name\"..."
|
||||||
rm -fr "$tmp_extension_folder" || exit 1
|
|
||||||
|
|
||||||
else
|
if [ "$action_type" == "enable" ]; then
|
||||||
echo "No Makefile found. Skipping compilation..."
|
if [ ! -z "$extension_repository_path" ]; then
|
||||||
fi
|
echo "Generating extension based on $3"
|
||||||
|
if [ -d "$extension_folder" ]; then
|
||||||
|
if [ -d "$extension_folder.git" ]; then
|
||||||
|
echo "Pulling changes from git..."
|
||||||
|
(cd "$extension_folder" && git pull) || exit 1
|
||||||
|
else
|
||||||
|
echo "No git repository. Extension will not be updated."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Cloning repository..."
|
||||||
|
git clone "$extension_repository_path" "$extension_folder" || exit 1
|
||||||
fi
|
fi
|
||||||
echo "enable GNOME extension \"$extension_name\"..." &&
|
|
||||||
gnome-extensions enable "$extension_name" || exit 1
|
if [ -f "$extension_folder/Makefile" ]; then
|
||||||
|
tmp_extension_folder="/tmp/$extension_name"
|
||||||
|
mv "$extension_folder" "$tmp_extension_folder"
|
||||||
|
echo "Compiling extension..."
|
||||||
|
(cd "$tmp_extension_folder" && make install) || exit 1 "Compilation failed."
|
||||||
|
echo "Cleaning up temporary extension folder..."
|
||||||
|
rm -fr "$tmp_extension_folder" || exit 1
|
||||||
|
else
|
||||||
|
echo "No Makefile found. Skipping compilation..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Enabling GNOME extension \"$extension_name\"..."
|
||||||
|
gnome-extensions enable "$extension_name" || exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$action_type" == "disable" ];
|
|
||||||
then
|
if [ "$action_type" == "disable" ]; then
|
||||||
echo "disable GNOME extension \"$extension_name\"..." &&
|
echo "Disabling GNOME extension \"$extension_name\"..."
|
||||||
gnome-extensions disable "$extension_name" || exit 1
|
gnome-extensions disable "$extension_name" || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Installation complete."
|
||||||
|
Loading…
Reference in New Issue
Block a user