From 33dd83509248a052430d794e6ce54c573da927ff Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 10 Aug 2019 01:34:39 -0600 Subject: [PATCH] update mac/linux installer (and package fix) --- package.json | 2 +- usr/share/install.sh | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b017033..2e67013 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ }, "homepage": "https://git.coolaj86.com/coolaj86/telebit.js#readme", "dependencies": { - "@root/request": "^1.3.5", + "@coolaj86/urequest": "^1.3.5", "finalhandler": "^1.1.1", "greenlock": "^2.8.2", "js-yaml": "^3.11.0", diff --git a/usr/share/install.sh b/usr/share/install.sh index 8b90e4f..df4eed0 100644 --- a/usr/share/install.sh +++ b/usr/share/install.sh @@ -242,10 +242,14 @@ my_file="$my_dir.$archive_ext" if [ -f "$HOME/Downloads/$my_file" ]; then my_size=$(($(wc -c < "$HOME/Downloads/$my_file"))) if [ "$my_size" -eq "$size" ]; then - echo "File exists in ~/Downloads, skipping download" + echo "~/Downloads/ exists, skipping download" else echo "Removing corrupt download '~/Downloads/$my_file'" - rm -f "$HOME/Downloads/$my_file" + # change into $HOME because we don't ever want to perform + # a destructive action on a variable we didn't set + pushd "$HOME" + rm -f "Downloads/$my_file" + popd fi fi @@ -261,6 +265,33 @@ if [ ! -f "$HOME/Downloads/$my_file" ]; then fi echo "Unpacking and installing Telebit ..." -echo unarchiver $my_file $my_tmp -echo pushd $my_tmp/$my_dir -echo bash ./setup.sh +unarchiver "$HOME/Downloads/$my_file" "$my_tmp" +echo "extracting '$my_file' to '$my_tmp'" + +# make sure that telebit is not in use +pushd "$my_tmp" > /dev/null + ./bin/node ./bin/npm --scripts-prepend-node-path=true run preinstall +popd > /dev/null + +# move only once there are not likely to be any open files +# (especially important on windows) +pushd "$HOME" > /dev/null + if [ -e ".local/opt/telebit" ]; then + mv ".local/opt/telebit" ".local/opt/telebit-old-$(date "+%s")" + fi + mv "$my_tmp" ".local/opt/telebit" +popd > /dev/null + +# make sure that telebit is not in use +pushd "$HOME/.local/opt/telebit" > /dev/null + ./node_modules/.bin/pathman add "$HOME/.local/opt/telebit/bin-public" > /dev/null + ./bin/node ./bin/npm --scripts-prepend-node-path=true run postinstall +popd > /dev/null + +echo "" +echo "" +echo "" +echo "Open a new terminal and run the following:" +echo "" +printf "\ttelebit init" +echo ""