Last active
December 21, 2016 19:29
-
-
Save user890104/a8afb3d61cfeed451195ae50003099f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
BIN_NAME=shairport-sync | |
BIN_SRC=/usr/bin | |
BINARY="${BIN_SRC}/${BIN_NAME}" | |
PATCH_DIR=/tmp/shairport-patch | |
PATCH_BIN="${PATCH_DIR}/${BIN_NAME}" | |
PATCH_NAME="${PATCH_DIR}/string" | |
if [ ! -f "${BINARY}" ] | |
then | |
echo binary not found | |
exit 1 | |
fi | |
OFFSET=$(strings -t d /usr/bin/shairport-sync | grep -F 'AirPort4,107' | awk '{ print $1 }') | |
if [ -z "${OFFSET}" ] | |
then | |
echo substring not found | |
exit 1 | |
fi | |
mkdir -p "${PATCH_DIR}" | |
echo -n ShairportSyn > "${PATCH_NAME}" | |
cp -p "${BINARY}" "${PATCH_BIN}" | |
dd if="${PATCH_NAME}" of="${PATCH_BIN}" obs=1 seek="$[${OFFSET} + 3]" conv=notrunc | |
mv "${BINARY}" "${BINARY}.bak" | |
mv "${PATCH_BIN}" "${BINARY}" | |
rm -rf "${PATCH_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment