Skip to content

Commit

Permalink
Fixed #25 - bad eventcmd and fifo paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kylejohnson committed Jul 27, 2021
1 parent 1ab36be commit 3a40aa8
Showing 1 changed file with 31 additions and 17 deletions.
48 changes: 31 additions & 17 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,40 @@
set -euo pipefail

tls_fingerprint=`openssl s_client -connect tuner.pandora.com:443 < /dev/null 2> /dev/null | openssl x509 -noout -fingerprint | tr -d ':' | cut -d'=' -f2`
event_command=${PWD}/eventcmd.sh
fifo=${PWD}/ctl
configdir=~/.config/pianobar
repo='https://github.com/kylejohnson/Patiobar.git'
clone_path="$HOME/Patiobar"
event_command=${clone_path}/eventcmd.sh
fifo=${clone_path}/ctl
configdir=~/.config/pianobar

if ! which npm &> /dev/null; then
echo "npm is not installed!"
echo "Installing NPM is beyond the scope of this installer as methods vary by distro, OS and preference."
echo "Note that NPM is usually installed with Node.js."
echo "https://nodejs.org/en/download/ is a decent place to start."
exit 1;
exit 1
fi

# Don't clone if already in the repo
if [ ! -d .git ]; then
if git clone "${repo}"; then
cd Patiobar
if [ ! -d $clone_path ]; then
echo "Cloning $repo in to $clone_path"
if git clone "${repo}" "${clone_path}"; then
cd "${clone_path}"
else
echo "Could not clone ${repo}"
exit 1
fi
else
echo "$repo already exists at $clone_path. Moving on."
fi

# Don't run npm install if it has already ran
if [ ! -d node_modules ]; then
echo -n 'Running `npm install`... '
if npm install > /dev/null 2>&1; then
echo "success"
else
echo "failure"
fi
# Install node packages
echo -n 'Installing node packages... '
if npm install > /dev/null 2>&1; then
echo "success"
else
echo "failure"
exit 1
fi

# Don't create fifo if it already exists
Expand All @@ -42,13 +45,17 @@ if [ ! -p "${fifo}" ]; then
echo "success"
else
echo "failure"
exit 1
fi
else
echo "Control file already exists. Moving on."
fi

echo -n "Creating default ~/.config/pianobar/config file... "

if mkdir -p "${configdir}"; then
if ! [ -f "${configdir}/config" ]; then
if cat << EOF >> "${configdir}/config"; then
echo -n "Creating default ~/.config/pianobar/config file... "
if cat << EOF >> "${configdir}/config"; then
user = [email protected]
password = password
#autostart_station = 123456
Expand All @@ -58,10 +65,17 @@ fifo = ${fifo}
tls_fingerprint = ${tls_fingerprint}
EOF
echo "success"
echo "You will need to edit ${configdir}/config with your Pandora username and password."
else
echo "failure"
exit 1
fi
else
echo "${configdir}/config already exists"
echo "You will need to manually update that file."
exit
fi
else
echo "Failed to create $configdir."
exit 1
fi

0 comments on commit 3a40aa8

Please sign in to comment.