Created
July 13, 2015 20:04
-
-
Save rubyconvict/f5fa94960700e62c71ac 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
# http://stackoverflow.com/a/29490456 | |
#!/bin/bash | |
# Uninstall node.js | |
# | |
# Options: | |
# | |
# -d Actually delete files, otherwise the script just _prints_ a command to delete. | |
# -p Installation prefix. Default /usr/local | |
# -f BOM file. Default /var/db/receipts/org.nodejs.pkg.bom | |
CMD="echo sudo rm -fr" | |
BOM_FILE="/var/db/receipts/org.nodejs.pkg.bom" | |
PREFIX="/usr/local" | |
while getopts "dp:f:" arg; do | |
case $arg in | |
d) | |
CMD="sudo rm -fr" | |
;; | |
p) | |
PREFIX=$arg | |
;; | |
f) | |
BOM_FILE=$arg | |
;; | |
esac | |
done | |
lsbom -f -l -s -pf ${BOM_FILE} \ | |
| while read i; do | |
$CMD ${PREFIX}/${i} | |
done | |
$CMD ${PREFIX}/lib/node \ | |
${PREFIX}/lib/node_modules \ | |
${BOM_FILE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment