Created
September 8, 2016 15:33
-
-
Save sfan5/f42a2fcbdbfc9c78b2e2d04e96648e2d to your computer and use it in GitHub Desktop.
Removes toolchain-wrapper added by recent versions of Buildroot
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 | |
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