From 3f405b1ac6d3690fa4c704aa227198a325d2be47 Mon Sep 17 00:00:00 2001 From: Caleb Xu Date: Mon, 21 Jul 2014 20:01:26 -0400 Subject: [PATCH] Add initial start wizard --- pushblast | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pushblast b/pushblast index 3143616..6edd602 100755 --- a/pushblast +++ b/pushblast @@ -17,14 +17,23 @@ fi chmod +x ~/.config/pushblast/lib/pushbullet if [ ! -e ~/.config/pushblast/pushblastrc ] ; then - echo "Config file at ~/.config/pushblast/pushblastrc is missing." - echo "See README.md for info on what to put there." - exit 1 + touch ~/.config/pushblast/pushblastrc + echo "Welcome to PushBlast! Before I get started, I'll need a few things from you regarding your PushBullet account." + echo -e "\nPlease provide your PushBullet API key, also known as an access token. I need this to be able to push stuff: " + read API_KEY + echo -e "\nPlease provide the device name you wish to push to. Device names are case sensitive, so be careful: " + read DEV_NAME + echo -e "\nPlease name this computer. Computer names are shown on the notification so you know where a notification came from." + read COMP_NAME + echo "API_KEY=\"$API_KEY\"" >> ~/.config/pushblast/pushblastrc + echo "DEV_NAME=\"$DEV_NAME\"" >> ~/.config/pushblast/pushblastrc + echo "COMP_NAME=\"$COMP_NAME\"" >> ~/.config/pushblast/pushblastrc + echo -e "\nLooks like we're all good to go. I'll go ahead and run the command you gave." fi source ~/.config/pushblast/pushblastrc -if [ $API_KEY = "" ] ; then +if [[ $API_KEY = "" ]] ; then echo "Invalid API key. Find your access token at https://www.pushbullet.com/account." exit 1 fi @@ -32,7 +41,7 @@ fi touch ~/.config/pushbullet echo "API_KEY=$API_KEY" > ~/.config/pushbullet -if [ $DEV_NAME = "" ] ; then +if [[ $DEV_NAME = "" ]] ; then echo "Invalid target device name. Find your list of devices at https://www.pushbullet.com." exit 1 fi