Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
brew tap | while read tap; do echo "brew tap $tap"; done
brew leaves | while read item;
do
echo "install_package $item '$(brew info $item | /usr/bin/grep 'Built from source with:' | /usr/bin/sed 's/^[ \t]*Built from source with:/ /g; s/\,/ /g')'"
done
echo '[ ! -z $failed_items ] && echo The following items were failed to install: && echo $failed_items'
@donkaban

This comment has been minimized.

Copy link
Owner Author

donkaban commented Nov 21, 2016

backup_brew.sh > restore.sh && chmod -x restore.sh

@kika

This comment has been minimized.

Copy link

kika commented Nov 22, 2016

#L14 - brew leaves instead

@donkaban

This comment has been minimized.

Copy link
Owner Author

donkaban commented Nov 22, 2016

fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.