Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
fixed login theme installer and asset duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Kukkonen committed May 28, 2017
1 parent aeb9a5b commit 0e4be82
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 7 deletions.
1 change: 0 additions & 1 deletion extras/login-gnome-shell/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ that for login shell theme all the changes are taken effect only after the reboo

# Need to know

* Installer is made only for Ubuntu flavor currently as there is no other flavored login themes available.
* This can be changed easily ones there is more login themes available. But until then there is no point to the wizard
to ask more questions.
* Find file named with **must_fix_css_for_login.txt** for browse necessary changes for gnome shell css to fix certain issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<file>assets/calendar-arrow-right.svg</file>
<file>assets/calendar-arrow-left-hover.svg</file>
<file>assets/calendar-arrow-right-active.svg</file>
<file>assets/calendar-arrow-left-hover.svg</file>
<file>assets/calendar-arrow-right-active.svg</file>
<file>assets/calendar-arrow-today.svg</file>
<file>assets/checkbox-off.svg</file>
<file>assets/checkbox.svg</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<file>assets/calendar-arrow-right.svg</file>
<file>assets/calendar-arrow-left-hover.svg</file>
<file>assets/calendar-arrow-right-active.svg</file>
<file>assets/calendar-arrow-left-hover.svg</file>
<file>assets/calendar-arrow-right-active.svg</file>
<file>assets/calendar-arrow-today.svg</file>
<file>assets/checkbox-off.svg</file>
<file>assets/checkbox.svg</file>
Expand Down
16 changes: 14 additions & 2 deletions extras/login-gnome-shell/united-login-theme-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
gnomeShell=/usr/share/gnome-shell
res=$gnomeShell/gnome-shell-theme.gresource

path="";

function showHelp {
echo "Usage. united-login-installer [ -iu ] [ variant ]. E.g. united-login-installer -i
Used to install UNITED Gnome login theme. Can be also used to uninstall login themes.
Expand All @@ -19,6 +21,10 @@ function exists {
if [ ! -d $1 ]; then echo "Directory \"$1\" does not exist, exiting" && exit 1; fi;
}

function checkStatus {
status=$?;
if [ "$status" -gt 0 ]; then echo "Failure in execution! Exiting with code: $status" && exit $status; fi
}

function install {
echo "Installing $1 login theme...";
Expand Down Expand Up @@ -48,9 +54,11 @@ function install {

echo "Compiling gnome-shell-theme.gresource.xml...";
$compile gnome-shell-theme.gresource.xml
checkStatus

echo "Copying compiled gnome shell theme to $gnomeShell";
sudo cp gnome-shell-theme.gresource $gnomeShell;
checkStatus

rm -f gnome-shell-theme.gresource;

Expand Down Expand Up @@ -83,9 +91,12 @@ function reboot {
echo "Press alt + F2 and then type r to restart gnome shell. This makes login theme party available.";
}

path=`echo $0 | rev | cut -d \/ -f 2- | rev`;
if [ "$path" != "." ]; then cd $path; fi;

test ${#1} -eq 0 && showHelp && exit 1;

if [[ "$1" == "-h" || "$1" == "--help" || "$i" == "?" ]]; then showHelp && exit 1; fi;
if [[ "$1" == "-h" || "$1" == "--help" || "$1" == "?" ]]; then showHelp && exit 1; fi;

if [[ "$1" != "-"* && "$1" != "?" ]]; then showHelp && exit 1; fi;

Expand All @@ -101,17 +112,18 @@ case $mode in
echo "What variant you would like to use?";

read variant;
echo "variant $variant"
if [ ! -d `pwd`/$variant ]; then echo "Variant `pwd`/$variant does not exist!" && variant=""; fi;

done;
fi;
install $variant;
checkStatus
reboot;
;;
u)
echo "Uninstalling...";
uninstall;
checkStatus
reboot;
break
;;
Expand Down
134 changes: 134 additions & 0 deletions src/login-gnome-shell/united-login-theme-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
#!/bin/bash

# Used to install / unistall UNITED Gnome login theme.
# Currently only for Ubuntu variant.

gnomeShell=/usr/share/gnome-shell
res=$gnomeShell/gnome-shell-theme.gresource

function showHelp {
echo "Usage. united-login-installer [ -iu ] [ variant ]. E.g. united-login-installer -i
Used to install UNITED Gnome login theme. Can be also used to uninstall login themes.
-i = Install
-u = Uninstall
-h | --help | ? = Help
variant = Variation of login theme. E.g ubuntu, opensuse or fedora.";
}

function exists {
if [ ! -d $1 ]; then echo "Directory \"$1\" does not exist, exiting" && exit 1; fi;
}

function checkStatus {
status=$?;
if [ "$status" -gt 0 ]; then echo "Failure in execution, exiting with status $status" && exit $status; fi;
}

function install {
echo "Installing $1 login theme...";
# If back up resource is found uninstall old before.
if [ -f $res.bak ]; then
uninstall;
fi;
variation=$1;

exists "$gnomeShell";

echo "Asking sudo rights to move original theme as back up.";
echo "mv $res $res.bak";

sudo mv $res $res.bak

echo "Checking does $variation folder exist in current directory.";
exists "`pwd`/$variation";

echo "Find compile command";
compile=`which glib-compile-resources`

test ${#compile} -eq 0 && echo "Compile command not found, exiting" && exist 1;
echo "Compile command found: $compile...";

cd "`pwd`/$variation";

echo "Compiling gnome-shell-theme.gresource.xml...";
echo "$? fooooooooooooooooooooooooooooooooo"
$compile gnome-shell-theme.gresource.xml
echo "$? fooooooooooooooooooooooooooooooooo"
checkStatus;

echo "Copying compiled gnome shell theme to $gnomeShell";
sudo cp gnome-shell-theme.gresource $gnomeShell;

echo "$? fooooooooooooooooooooooooooooooooo"
if [ "$status" -gt 0 ]; then echo "Failure in execution, exiting with status $status" && exit $status; fi;

rm -f gnome-shell-theme.gresource;

echo "Completed!";
}

function uninstall {
test ! -f $res.bak && echo "Back up file does not exists, cannot proceed unistall, exiting" && exit 1;

echo "Uninstalling current theme and restoring previous theme...";
echo "Asking sudo rights to restore.";
sudo rm -f $res;
sudo mv $res.bak $res

echo "Completed!";
}

function reboot {
echo "Do you wish to reboot now, changes take affect after reboot? (y/N)";
read allowReboot;
if [ "$allowReboot" == "y" ]; then
rebootCommand=`which reboot`;
test ${#rebootCommand} -eq 0 && echo "Reboot command not found, exiting" && exist 1;

echo "Reboot command found: $rebootCommand";

sudo $rebootCommand now;
fi;

echo "Press alt + F2 and then type r to restart gnome shell. This makes login theme party available.";
}

test ${#1} -eq 0 && showHelp && exit 1;

if [[ "$1" == "-h" || "$1" == "--help" || "$1" == "?" ]]; then showHelp && exit 1; fi;

if [[ "$1" != "-"* && "$1" != "?" ]]; then showHelp && exit 1; fi;

mode=${1:1:1};

case $mode in
i)
echo "Installing...";
variant="$2";
if [ "$variant" == "" ]; then
while [ "$variant" == "" ]; do

echo "What variant you would like to use?";

read variant;
if [ ! -d `pwd`/$variant ]; then echo "Variant `pwd`/$variant does not exist!" && variant=""; fi;

done;
fi;
install $variant;
checkStatus;
reboot;
;;
u)
echo "Uninstalling...";
uninstall;
checkStatus;
reboot;
break
;;
*)
showHelp;
;;
esac

exit 0;

0 comments on commit 0e4be82

Please sign in to comment.