-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #25 - bad eventcmd and fifo paths
- Loading branch information
1 parent
1ab36be
commit 3a40aa8
Showing
1 changed file
with
31 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 |