Skip to content

Instantly share code, notes, and snippets.

@CzBiX
Last active November 5, 2017 05:52
Show Gist options
  • Save CzBiX/8608f3520b92a77c79e0 to your computer and use it in GitHub Desktop.
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
@ankurk91
Copy link

ankurk91 commented Feb 1, 2016

Thanks, worked like charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment