diff --git a/package.json b/package.json index fec0392..9b21f96 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,9 @@ "main": "index.js", "scripts": { "build": "tsc", - "deploy:broadcaster": "rsync -avx rsync -a --exclude-from='exclude.txt' ./ grace@broadcaster.local:portal", - "deploy:listener": "npm run build && rsync -avx rsync -a --exclude-from='exclude.txt' ./ grace@listener.local:portal" + "deploy": "npm run build && rsync -av --exclude-from='exclude.txt' ./ grace@listener.local:portal", + "setup:broadcaster": "rsync -av --exclude-from='exclude.txt' ./ grace@broadcaster.local:portal", + "setup:listener": "rsync -av --exclude-from='exclude.txt' ./ grace@listener.local:portal && ssh grace@listener.local -t 'cd portal/setup/listener && chmod +x install.sh && sudo ./install.sh; bash -l'" }, "repository": { "type": "git", diff --git a/installation/broadcaster/darkice.cfg b/setup/broadcaster/darkice.cfg similarity index 100% rename from installation/broadcaster/darkice.cfg rename to setup/broadcaster/darkice.cfg diff --git a/installation/broadcaster/darkice.service b/setup/broadcaster/darkice.service similarity index 100% rename from installation/broadcaster/darkice.service rename to setup/broadcaster/darkice.service diff --git a/installation/broadcaster/install.sh b/setup/broadcaster/install.sh similarity index 100% rename from installation/broadcaster/install.sh rename to setup/broadcaster/install.sh diff --git a/installation/broadcaster/readme.md b/setup/broadcaster/readme.md similarity index 100% rename from installation/broadcaster/readme.md rename to setup/broadcaster/readme.md diff --git a/installation/listener/install.sh b/setup/listener/install.sh similarity index 74% rename from installation/listener/install.sh rename to setup/listener/install.sh index 32268a2..6602311 100644 --- a/installation/listener/install.sh +++ b/setup/listener/install.sh @@ -1,41 +1,31 @@ #!/bin/bash if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root (use sudo)" 1>&2 + echo "This script must be run as root. Try again with \n sudo ./install.sh" 1>&2 exit 1 fi is_Raspberry=$(cat /proc/device-tree/model | awk '{print $1}') if [ "x${is_Raspberry}" != "xRaspberry" ] ; then - echo "Sorry, this only works on raspberry pi" + echo "This script contains drivers for the Raspberry pi and will not work on the current platform." exit 1 fi -ver="1.0" - - -# we create a dir with this version to ensure that 'dkms remove' won't delete -# the sources during kernel updates -marker="0.0.0" - apt update apt -y install git vim zsh mplayer -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" - curl https://get.volta.sh | bash volta install node -git clone git@git.featherboaz.com:boazsender/portal.git cd portal npm install npx prisma generate && npx prisma db push && npx prisma db seed cp ./screen.service /lib/systemd/system/ -cp player.service /lib/systemd/system/ +cp ./player.service /lib/systemd/system/ git clone https://github.com/waveshare/WM8960-Audio-HAT cd WM8960-Audio-HAT -sh ./install.sh +sudo ./install.sh systemctl daemon-reload systemctl enable player @@ -45,6 +35,10 @@ systemctl start player systemctl start screen systemctl start wm8960-soundcard + +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + + echo "------------------------------------------------------" echo "The Black Portal listening device has been provisioned." echo "Reboot this raspberry pi now in order for things to work" diff --git a/installation/listener/player.service b/setup/listener/player.service similarity index 100% rename from installation/listener/player.service rename to setup/listener/player.service diff --git a/setup/listener/readme.md b/setup/listener/readme.md new file mode 100644 index 0000000..6f04d73 --- /dev/null +++ b/setup/listener/readme.md @@ -0,0 +1,54 @@ +# Listener software (Mplayer + drivers) + +## Summary + +User: grace +Hostname: listener.local +Password: emergence +Running mplayer, soundcard library, lcd graphics library, and custom python code for text printing logic. + +## Bill of Materials + +- Raspberry pi zero 2 wh - https://www.waveshare.com/product/raspberry-pi/boards-kits/raspberry-pi-zero-2-w-cat/raspberry-pi-zero-2-w.htm?sku=21038 +- Waveshare UPS with 1000mah battery - https://www.waveshare.com/ups-hat-c.htm +- Waveshare sound card hat with speakers- https://www.waveshare.com/wm8960-audio-hat.htm +- 1602 LCD screen - https://www.waveshare.com/lcd1602-i2c-module-blue.htm?sku=30496 +- Jumper wires - https://www.waveshare.com/product/accessories/adapters-cables-antennas/jumper-wires/jumper-wire-1-pin-2.54-pitch-200mm.htm +- mini HDMI to hdmi cable - https://hosatech.com/products/video/hdmi/hdmc-400/ +- micro USB male to usb a femail adapter - https://www.amazon.com/dp/B01C6032G0 +- Keyboard with usb a cable - https://www.amazon.com/AmazonBasics-Matte-Keyboard-QWERTY-Layout/dp/B07WJ5D3H4/ + +## Hardware assembly + +- Solder header to the pi if not pre-soldered +- Plug the battery into the UPS board +- Screw the UPS to the pi +- Screw a next level of standoffs to the pi +- Put the audio hat on the pi's headers, and screw it to the standoffs +- Plug in the speakers +- Plug the jumper wires into the screen and the pi according to the [screen-wiring.png](screen-wiring.png) file (via https://peppe8o.com/1602-lcd-raspberry-pi-display/). + +## Pre work + +1. Install raspian lite 64 for raspi zero. Make sure to configure user and wifi and turn on ssh services when you install. +2. Boot the pi. + +## Setup instructions + +### Using node and npm + +If you have node and npm installed, you can run this command from inside this repository: + +``` +npm run setup:listener +``` + +If you'd like to install node and npm try installing https://volta.sh and then running volta install node@latest. + +### Using the terminal + +If you do not have node and npm installed you can run this command from inside this repository: + +``` +rsync -av --exclude-from='exclude.txt' ./ grace@listener.local:portal && ssh grace@listener.local -t 'cd portal/setup/listener && chmod +x install.sh && sudo ./install.sh; bash -l' +``` diff --git a/installation/listener/screen.service b/setup/listener/screen.service similarity index 100% rename from installation/listener/screen.service rename to setup/listener/screen.service