Skip to content

Instantly share code, notes, and snippets.

@donkaban
Last active November 22, 2016 06:05
Show Gist options
  • Save donkaban/55c279eac11197b6822ae77d8aaf8c12 to your computer and use it in GitHub Desktop.
Save donkaban/55c279eac11197b6822ae77d8aaf8c12 to your computer and use it in GitHub Desktop.

Revisions

  1. Kirill A. Shabordin revised this gist Nov 22, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion backup_brew.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ echo '}'

    brew tap | while read tap; do echo "brew tap $tap"; done

    brew list | while read item;
    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
  2. Kirill A. Shabordin created this gist Nov 21, 2016.
    19 changes: 19 additions & 0 deletions backup_brew.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/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 list | 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'