Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sfan5
Created September 8, 2016 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfan5/f42a2fcbdbfc9c78b2e2d04e96648e2d to your computer and use it in GitHub Desktop.
Save sfan5/f42a2fcbdbfc9c78b2e2d04e96648e2d to your computer and use it in GitHub Desktop.
Removes toolchain-wrapper added by recent versions of Buildroot
#!/bin/bash
if [ ! -f toolchain-wrapper ]; then
echo "Not a bin folder or wrapper already removed"
exit 1
fi
echo ":: Replacing symlinks to toolchain-wrapper"
for file in *; do
[ ! -L $file ] && continue
[ ! "$(readlink $file)" == "toolchain-wrapper" ] && continue
if [ -f $file.br_real ]; then
rm $file
mv -v $file.br_real $file
else
echo "Real version of $file doesn't exist, skipping."
fi
done
echo ":: Fixing broken symlinks"
for file in *; do
[ ! -L $file ] && continue
link="$(readlink $file)"
grep -vq '\.br_real$' <<<$link && continue
link=${link%.br_real}
ln -svf $link $file
done
echo ":: Deleting toolchain-wrapper"
rm -v toolchain-wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment