Add a puppet version
This commit is contained in:
parent
d3ad26c500
commit
16e4a7198b
4 changed files with 169 additions and 0 deletions
82
setup/listener puppet/install.sh
Normal file
82
setup/listener puppet/install.sh
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
is_Raspberry=$(cat /proc/device-tree/model | awk '{print $1}')
|
||||
if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
|
||||
echo "This script contains drivers for the Raspberry pi and will not work on the current platform."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# sudo apt update
|
||||
# sudo apt -y install git vim zsh mplayer
|
||||
update_system() {
|
||||
echo "Updating system"
|
||||
sudo apt update
|
||||
sudo apt dist-upgrade
|
||||
sudo apt upgrade
|
||||
}
|
||||
|
||||
install_volta() {
|
||||
echo "Installing node@latest via volta"
|
||||
sh -c "wget -qO- https://get.volta.sh | bash"
|
||||
exec $SHELL
|
||||
volta install node@latest
|
||||
}
|
||||
|
||||
install_screen() {
|
||||
echo "Installing screen program"
|
||||
cd portal
|
||||
/home/grace/.volta/bin/npm install
|
||||
/home/grace/.volta/bin/npx prisma generate && /home/grace/.volta/bin/npx prisma db push && /home/grace/.volta/bin/node/npx prisma db seed
|
||||
}
|
||||
|
||||
install_sound_card_drivers() {
|
||||
echo "Installing sound card drivers"
|
||||
git clone https://github.com/waveshare/WM8960-Audio-HAT
|
||||
cd WM8960-Audio-HAT
|
||||
sudo ./install.sh
|
||||
}
|
||||
|
||||
configure_sound() {
|
||||
amixer -c 0 set 'Speaker' 100%
|
||||
amixer -c 0 set 'Speaker AC' 100%
|
||||
amixer -c 0 set 'Speaker DC' 100%
|
||||
amixer -c 0 set 'Speaker Playback ZC' 100%
|
||||
sudo alsactl store
|
||||
}
|
||||
|
||||
setup_daemons() {
|
||||
echo "Setting up daemons"
|
||||
sudo cp ./screen.service /lib/systemd/system/
|
||||
sudo cp ./player.service /lib/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable player
|
||||
systemctl enable screen
|
||||
systemctl enable wm8960-soundcard.service
|
||||
systemctl start player
|
||||
systemctl start screen
|
||||
systemctl start wm8960-soundcard
|
||||
}
|
||||
|
||||
install_ohmyzsh() {
|
||||
echo "Installing oh my zsh"
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
echo TERM=xterm > ~/.zshrc
|
||||
}
|
||||
|
||||
|
||||
|
||||
install_all() {
|
||||
update_system
|
||||
install_volta
|
||||
install_screen
|
||||
install_sound_card_drivers
|
||||
configure_sound
|
||||
setup_daemons
|
||||
install_ohmyzsh
|
||||
sudo reboot
|
||||
}
|
||||
|
||||
install_all
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "The Black Portal listening device has been setup."
|
||||
echo "This raspberry pi now rebooting in order to apply changes"
|
||||
echo "------------------------------------------------------"
|
||||
11
setup/listener puppet/player.service
Normal file
11
setup/listener puppet/player.service
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Listenign Service
|
||||
[Service]
|
||||
User=grace
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
WorkingDirectory=/home/grace
|
||||
ExecStart=mplayer building.wav
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
64
setup/listener puppet/readme.md
Normal file
64
setup/listener puppet/readme.md
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# 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
|
||||
- 32GB Micro SD card - https://www.waveshare.com/raspberry-pi-sd-card.htm.
|
||||
- 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
|
||||
|
||||
You will need a micro SD card reader and computer to complete the next step.
|
||||
|
||||
1. Download the raspberry pi imager from [raspberrypi.com/software](https://www.raspberrypi.com/software).
|
||||
2. Install raspian lite 64 bit for raspi zero 2.
|
||||
A. Make sure to configure user and wifi and turn on ssh services when you install.
|
||||
B. If you don't already have an ssh key, make one with `ssh-keygen -t ed25519 -C "your_email@example.com"` and then copy it with `cat ~/.ssh/id_ed25519.pub` and paste it into the ssh service in the services section of the imager.
|
||||
3. Boot the pi.
|
||||
|
||||
## Setup instructions
|
||||
|
||||
Running the setup script from the command line
|
||||
|
||||
### Using node and npm
|
||||
|
||||
If you have node and npm installed, you can run this command from inside this repository:
|
||||
|
||||
```
|
||||
npm run setup:listener
|
||||
```
|
||||
|
||||
Type "yes" when prompted to continue connecting and the press enter.
|
||||
|
||||
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'
|
||||
```
|
||||
12
setup/listener puppet/screen.service
Normal file
12
setup/listener puppet/screen.service
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Screen Service
|
||||
[Service]
|
||||
User=root
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
WorkingDirectory=/home/grace
|
||||
ExecStart=/home/grace/.volta/bin/node /home/grace/portal/build/screen.js
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Add table
Reference in a new issue