Compare commits

..

No commits in common. "639b09e9a4a6f7f9fde98edcd508bcfc36587350" and "46e8a481cacfd6601546e14afb8c9f996518bc5c" have entirely different histories.

View File

@ -1,52 +1,49 @@
#!/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_name/" extension_folder="$HOME/.local/share/gnome-shell/extensions/$extension_repository_path/"
echo "Install GNOME extension \"$extension_name\"..."
echo "=== GNOME Extension Installer ===" if [ "$action_type" == "enable" ];
then
echo "Installing GNOME extension \"$extension_name\"..." if [ -z "$extension_repository_path" ];
then
if [ "$action_type" == "enable" ]; then if [ -d "$extension_folder" ];
if [ ! -z "$extension_repository_path" ]; then then
echo "Generating extension based on $3" if [ -d "$extension_folder"".git" ];
if [ -d "$extension_folder" ]; then then
if [ -d "$extension_folder.git" ]; then echo "Pulling changes from git..." &&
echo "Pulling changes from git..."
(cd "$extension_folder" && git pull) || exit 1 (cd "$extension_folder" && git pull) || exit 1
else else
echo "No git repository. Extension will not be updated." echo "No git repository. Extension will not be updated."
fi fi
else else
echo "Cloning repository..." echo "Install..." &&
git clone "$extension_repository_path" "$extension_folder" || exit 1 git clone "$extension_repository_path" "$extension_folder" || exit 1
fi fi
if [ -f "$extension_folder""Makefile" ];
then
if [ -f "$extension_folder/Makefile" ]; then tmp_extension_folder="/tmp/$extension_repository_path"
tmp_extension_folder="/tmp/$extension_name"
mv "$extension_folder" "$tmp_extension_folder" mv "$extension_folder" "$tmp_extension_folder"
echo "Compiling extension..." echo "Compilling extension.."
(cd "$tmp_extension_folder" && make install) || exit 1 "Compilation failed." (cd "$tmp_extension_folder" && make install) || exit 1 "Compilation with failed."
echo "Cleaning up temporary extension folder..."
echo "Cleaning up tmp-extension folder..."&&
rm -fr "$tmp_extension_folder" || exit 1 rm -fr "$tmp_extension_folder" || exit 1
else else
echo "No Makefile found. Skipping compilation..." echo "No Makefile found. Skipping compilation..."
fi fi
fi fi
echo "enable GNOME extension \"$extension_name\"..." &&
echo "Enabling GNOME extension \"$extension_name\"..."
gnome-extensions enable "$extension_name" || exit 1 gnome-extensions enable "$extension_name" || exit 1
fi fi
if [ "$action_type" == "disable" ];
if [ "$action_type" == "disable" ]; then then
echo "Disabling GNOME extension \"$extension_name\"..." echo "disable GNOME extension \"$extension_name\"..." &&
gnome-extensions disable "$extension_name" || exit 1 gnome-extensions disable "$extension_name" || exit 1
fi fi
echo "Installation complete."