From 9e9dd5e9845f47622a3c100a9832a2f1c921d7c8 Mon Sep 17 00:00:00 2001 From: Paul Lucas Date: Thu, 1 Dec 2016 18:38:37 -0600 Subject: [PATCH 1/4] tools: adding osx-uninstall script Adding a script for osx-uninstall. Taken from Rod Vagg's Gist and adding to the repo for editing and referencing on the nodejs.org website with uninstall instructions. --- tools/osx-uninstall.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tools/osx-uninstall.sh diff --git a/tools/osx-uninstall.sh b/tools/osx-uninstall.sh new file mode 100644 index 000000000000..c5d70d8a5d74 --- /dev/null +++ b/tools/osx-uninstall.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Added to help for removal of node on OSX +# Referencing issue: https://github.com/nodejs/node/issues/7371 +# Using gist from rvagg: https://github.com/rvagg/io.js/blob/fhemberger-refactor-mac-installer-rebase/tools/osx-pkg/scripts/uninstall.sh + +if [ -z "$DIR_PREFIX" ]; then + DIR_PREFIX=/usr/local +fi + +if [ -f /tmp/nodejs-run-uninstall ]; then + rm -f $DIR_PREFIX/bin/node + rm -f $DIR_PREFIX/bin/npm + rm -rf $DIR_PREFIX/include/node + rm -f $DIR_PREFIX/lib/dtrace/node.d + rm -f $DIR_PREFIX/share/man/man1/node.1 + rm -f $DIR_PREFIX/share/systemtap/tapset/node.stp + rm -f $DIR_PREFIX/share/doc/node/gdbinit + + rm -rf $DIR_PREFIX/lib/node_modules/npm + if [ ! "$(ls -A $DIR_PREFIX/lib/node_modules 2> /dev/null)" ]; then + rm -rf $DIR_PREFIX/lib/node_modules + fi + + rm -f /tmp/nodejs-run-uninstall +fi \ No newline at end of file From de19bc87daafc1c8edca0330df509a26fd6441d0 Mon Sep 17 00:00:00 2001 From: Paul Lucas Date: Tue, 6 Dec 2016 20:57:44 -0800 Subject: [PATCH 2/4] tools: updating osx uninstall Changing code based upon silverwind's review: Removed if condition for a temp uninstall file Added quotes around DIR_PREFIX file paths incase of space --- tools/osx-uninstall.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tools/osx-uninstall.sh b/tools/osx-uninstall.sh index c5d70d8a5d74..6e7816cf3049 100644 --- a/tools/osx-uninstall.sh +++ b/tools/osx-uninstall.sh @@ -8,19 +8,15 @@ if [ -z "$DIR_PREFIX" ]; then DIR_PREFIX=/usr/local fi -if [ -f /tmp/nodejs-run-uninstall ]; then - rm -f $DIR_PREFIX/bin/node - rm -f $DIR_PREFIX/bin/npm - rm -rf $DIR_PREFIX/include/node - rm -f $DIR_PREFIX/lib/dtrace/node.d - rm -f $DIR_PREFIX/share/man/man1/node.1 - rm -f $DIR_PREFIX/share/systemtap/tapset/node.stp - rm -f $DIR_PREFIX/share/doc/node/gdbinit +rm -f "$DIR_PREFIX/bin/node" +rm -f "$DIR_PREFIX/bin/npm" +rm -rf "$DIR_PREFIX/include/node" +rm -f "$DIR_PREFIX/lib/dtrace/node.d" +rm -f "$DIR_PREFIX/share/man/man1/node.1" +rm -f "$DIR_PREFIX/share/systemtap/tapset/node.stp" +rm -f "$DIR_PREFIX/share/doc/node/gdbinit" +rm -rf "$DIR_PREFIX/lib/node_modules/npm" - rm -rf $DIR_PREFIX/lib/node_modules/npm - if [ ! "$(ls -A $DIR_PREFIX/lib/node_modules 2> /dev/null)" ]; then - rm -rf $DIR_PREFIX/lib/node_modules - fi - - rm -f /tmp/nodejs-run-uninstall -fi \ No newline at end of file +if [ ! "$(ls -A "$DIR_PREFIX/lib/node_modules" 2> /dev/null)" ]; then + rm -rf "$DIR_PREFIX/lib/node_modules" +fi From 3045313eecf5d5f8cdf5a0010ba44b0b168e2152 Mon Sep 17 00:00:00 2001 From: Paul Lucas Date: Sun, 25 Dec 2016 09:36:58 -0500 Subject: [PATCH 3/4] tools: updating osx uninstall This is to change the removal of node_modules folder using -df rather than -rf and also remove the OSX .DS_Store in the folder to make sure the empty check is valid if the folder is actually empty. --- tools/osx-uninstall.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/osx-uninstall.sh b/tools/osx-uninstall.sh index 6e7816cf3049..8dd2bd063caf 100644 --- a/tools/osx-uninstall.sh +++ b/tools/osx-uninstall.sh @@ -16,7 +16,8 @@ rm -f "$DIR_PREFIX/share/man/man1/node.1" rm -f "$DIR_PREFIX/share/systemtap/tapset/node.stp" rm -f "$DIR_PREFIX/share/doc/node/gdbinit" rm -rf "$DIR_PREFIX/lib/node_modules/npm" +rm -f "$DIR_PREFIX/lib/node_modules/.DS_Store" if [ ! "$(ls -A "$DIR_PREFIX/lib/node_modules" 2> /dev/null)" ]; then - rm -rf "$DIR_PREFIX/lib/node_modules" + rm -df "$DIR_PREFIX/lib/node_modules" fi From 36f504e41ac3c3e18b3fa43ade6121f24698f528 Mon Sep 17 00:00:00 2001 From: Paul Lucas Date: Tue, 4 Jul 2017 12:49:41 -0700 Subject: [PATCH 4/4] Updated comments and renamed file Renamed to macos-uninstall.sh to match new Apple convention. --- tools/{osx-uninstall.sh => macos-uninstall.sh} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tools/{osx-uninstall.sh => macos-uninstall.sh} (92%) diff --git a/tools/osx-uninstall.sh b/tools/macos-uninstall.sh similarity index 92% rename from tools/osx-uninstall.sh rename to tools/macos-uninstall.sh index 8dd2bd063caf..e18987d20d43 100644 --- a/tools/osx-uninstall.sh +++ b/tools/macos-uninstall.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Added to help for removal of node on OSX +# Remove Node.js installed from tarballs or installer on macOS. # Referencing issue: https://github.com/nodejs/node/issues/7371 # Using gist from rvagg: https://github.com/rvagg/io.js/blob/fhemberger-refactor-mac-installer-rebase/tools/osx-pkg/scripts/uninstall.sh