-
-
Save CzBiX/8608f3520b92a77c79e0 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# Author: CzBiX | |
# URL: https://gist.github.com/CzBiX/8608f3520b92a77c79e0 | |
DEST_PACKAGE="unity" | |
DEST_VERSION="7.3.2+15.10.20151016-0ubuntu1" | |
DEST_FILE="/usr/lib/compiz/libunityshell.so" | |
DEST_FILE_HASH="d1be69f0dc23f8a69441359b9aea27f4" | |
PATCH_DATA="341b76: 909090909090" | |
SUCCESS_MSG="Please log out to make patch work." | |
function failed { | |
echo >&2 $1; | |
exit 1; | |
} | |
[ $(arch) == 'x86_64' ] || failed "only support x86_64." | |
type xxd >/dev/null 2>&1 || failed "xxd not found, please install vim." | |
[ $(apt-cache policy $DEST_PACKAGE | grep Installed | cut -d ' ' -f 4) == $DEST_VERSION ] || failed "$DEST_PACKAGE version not match with '$DEST_VERSION'." | |
[ $(md5sum $DEST_FILE | cut -d ' ' -f 1) == $DEST_FILE_HASH ] || failed "dest file hash not match" | |
echo $PATCH_DATA | sudo xxd -r - $DEST_FILE || failed "patch failed." | |
echo $SUCCESS_MSG |
I was about to suggest setsid unity --replace
for the lazy people among us (me), until (to my surprise) I realized that this seemed to work immediately after running the patch without doing anything at all.
Thank you for this. I really didn't feel like recompiling Unity. I could've, but I'm trying to keep a minimal number of changes from being done to this computer's install.
My one concern with this patch is that someone might release an update to this file on the system (without a fix for this issue, obviously), then somebody else comes along and tries to run this and ends up with a broken libunityshell.so file. Maybe try to verify the hash of that file before you patch it so that this will fail if it gets updated?
@Hitechcomputergeek Thanks your suggest, I think log out should be safer way than unity --replace
. When I use unity --replace
at past, the window will lost decoration at sometimes.
This script will check unity
package version before patch the file, it's should be safe enough. But you are right, check file hash is the safest way to avoid break user's system. I'll update script later.
After running this for a few days (I have rebooted since I installed this), I have noticed that it seems to work sometimes - however, for some reason, now occasionally (for no clear reason) when I click the Files icon, it will open a new Files window - EVEN IF I only have a location/locations open that are inside my home directory. It has also done this for when the Trash is open. Is this a bug in the patch?
Also, I'm not going to revert this for now (the problem above is less annoying than the problem this patch was designed to fix), but I would suggest adding a line to the script to echo information on how to remove this if you need to.
Thanks, worked like charm
Thanks. 322 people will sleep well tonight.