From 939b54787e06e54c80722b2406ba8f42d09ac0ca Mon Sep 17 00:00:00 2001 From: Nicholas Hubbard Date: Tue, 5 Apr 2016 15:52:10 -0400 Subject: [PATCH] Update installation script. - (possibly?) Fix issue that sha256sum does not work. - Add shebang for good reasons. - Fix continuing even after an error happens. --- install.sh | 52 +++++++++------------------------------------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/install.sh b/install.sh index 9a2a5e89..14250b38 100644 --- a/install.sh +++ b/install.sh @@ -14,57 +14,23 @@ # This is an installer script for MagicMirror2. It works well enough # that it can detect if you have Node installed, run a binary script # and then download and run MagicMirror2. -sudo apt-get install curl wget build-essential unzip +sudo apt-get install curl wget build-essential unzip || exit ARM=$(uname -m) # Determine which Pi is running. NODE_LATEST="v5.10.0" # Set the latest version here. -6L_HASH="019a257faa5eebf6304686dfeffdbcb4c22f0547aa366f6e563aad39ab1b1ab1" # Set the armv6l hash here. -7L_HASH="3f7524d3db60175c2323bb2a0a13ad1ca7d47d4ede6f42834b6b8425be70e0a2" # Set the armv7l hash here. -8_HASH="df88803bda234b32240906b620315c8f6d6200332047a88cb0ec83009cf25dd5" # Set the arm64 hash here. DOWNLOAD_URL="https://nodejs.org/dist/latest/node-$NODE_LATEST-linux-$ARM.tar.gz" # Construct the download URL. -wget $DOWNLOAD_URL # Download the file given. -if [ $ARM = "armv6l" ]; then - if [ -f "node-$NODE_LATEST-linux-armv6l.tar.gz"]; then - COMMAND256="sha256sum node-$NODE_LATEST-linux-armv6l.tar.gz" - if [ $($COMMAND256) = "019a257faa5eebf6304686dfeffdbcb4c22f0547aa366f6e563aad39ab1b1ab1" ]; then - echo "Node.js was downloaded and verified successfully." - else - echo "Node.js was downloaded, but verification failed. Make sure sha256sum works." - exit 1 - fi - fi -elif [ $ARM = "armv7l" ]; then - if [ -f "node-$NODE_LATEST-linux-armv7l.tar.gz" ]; then - COMMAND256="sha256sum node-$NODE_LATEST-linux-armv7l.tar.gz" - if [ $($COMMAND256) = "3f7524d3db60175c2323bb2a0a13ad1ca7d47d4ede6f42834b6b8425be70e0a2" ]; then - echo "Node.js was downloaded and verified successfully." - else - echo "Node.js was downloaded, but verification failed. Make sure sha256sum works." - exit 1 - fi - fi -elif [ $ARM = "arm64" ]; then - if [ -f "node-$NODE_LATEST-linux-arm64.tar.gz" ]; then - COMMAND256="sha256sum node-$NODE_LATEST-linux-arm64.tar.gz" - if [ $($COMMAND256) = "df88803bda234b32240906b620315c8f6d6200332047a88cb0ec83009cf25dd5" ]; then - echo "Node.js was downloaded and verified successfully." - else - echo "Node.js was downloaded, but verification failed. Make sure sha256sum works." - exit 1 - fi - fi -fi -tar xvf node-$NODE_LATEST-linux-$ARM.tar.gz -cd node* -sudo cp -R * /usr/local -cd .. -rm -rf node* +wget $DOWNLOAD_URL || exit # Download the file given. +tar xvf node-$NODE_LATEST-linux-$ARM.tar.gz || exit +cd node* || exit +sudo cp -R * /usr/local || exit +cd .. || exit +rm -rf node* || exit # Run Node checks to make sure Node works properly. -curl -sL https://deb.nodesource.com/test | bash - +(curl -sL https://deb.nodesource.com/test | bash -) || exit npm config set loglevel info if [ ! -f package.json ]; then wget https://github.com/nhubbard/MagicMirror/archive/v2-beta.zip unzip v2-beta.zip cd MagicMirror-2-beta fi -npm install +npm install || exit echo "We're ready! Run `npm start` from the MagicMirror-2-beta directory (not over SSH) and enjoy MagicMirror2!"