Skip to content

Instantly share code, notes, and snippets.

@mschmulen
Created January 3, 2014 19:05
Show Gist options
  • Save mschmulen/8244259 to your computer and use it in GitHub Desktop.
Save mschmulen/8244259 to your computer and use it in GitHub Desktop.
uninstall strongloop suite
#!/bin/sh
(( ${#} > 0 )) || {
echo 'The uninstaller is now trying to remove StrongLoop Suite'
echo 'Press Control-C to quit or Enter to continue the script with sudo: '
read
echo 'Re-running the script with sudo.'
echo 'You may be prompted for a password for the sudo command.'
sudo ${0} sudo
exit $?
}
# This will need to be executed as an Admin (maybe just use sudo).
# Verify the bom exists, otherwise don't do anything
[ -e /var/db/receipts/org.nodejs.pkg.bom ] || {
echo 'StrongLoop Suite is not installed. Nothing to do.'
exit 0
}
# Loop through all the files in the bom for community node
echo Uninstalling node...
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
# Remove each file listed in the bom.
rm /usr/local/${i}
done
# Loop through all the files in the bom for strongloop
echo Uninstalling node modules...
lsbom -f -l -s -pf /var/db/receipts/com.strongloop.node.node_modules.pkg.bom \
| while read i; do
# Remove each file listed in the bom.
rm /usr/local/lib/node_modules/${i} || echo "Fail to remove $i"
done
echo Uninstalling scripts...
lsbom -f -l -s -pf /var/db/receipts/com.strongloop.node.bin.pkg.bom \
| while read i; do
# Remove each file listed in the bom.
rm /usr/local/bin/${i} || echo "Fail to remove $i"
done
echo Uninstalling samples/sdks/docs...
lsbom -f -l -s -pf /var/db/receipts/com.strongloop.node.strongloop.pkg.bom \
| while read i; do
# Remove each file listed in the bom.
rm /usr/local/share/strongloop-suite/strongloop/${i} || echo "Fail to remove $i"
done
# Remove directories related to node.js and strongloop.
rm -rf /usr/local/lib/node \
/usr/local/lib/node_modules/slc \
/usr/local/lib/node_modules/loopback-cli \
/usr/local/share/strongloop-suite \
/var/db/receipts/org.nodejs.* \
/var/db/receipts/com.strongloop.* \
echo StrongLoop Suite is now uninstalled.
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment