improve setup script
This commit is contained in:
parent
4a912fc912
commit
d3ad26c500
3 changed files with 69 additions and 32 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"deploy": "npm run build && rsync -av --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: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'"
|
"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 && ./install.sh;'"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
||||||
|
|
@ -1,45 +1,72 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
|
||||||
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}')
|
is_Raspberry=$(cat /proc/device-tree/model | awk '{print $1}')
|
||||||
if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
|
if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
|
||||||
echo "This script contains drivers for the Raspberry pi and will not work on the current platform."
|
echo "This script contains drivers for the Raspberry pi and will not work on the current platform."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt update
|
# sudo apt update
|
||||||
apt -y install git vim zsh mplayer
|
# sudo apt -y install git vim zsh mplayer
|
||||||
|
update_system() {
|
||||||
|
echo "Updating system"
|
||||||
|
sudo apt update
|
||||||
|
sudo apt dist-upgrade
|
||||||
|
sudo apt upgrade
|
||||||
|
}
|
||||||
|
|
||||||
curl https://get.volta.sh | bash
|
install_volta() {
|
||||||
volta install node
|
echo "Installing node@latest via volta"
|
||||||
cd portal
|
sh -c "wget -qO- https://get.volta.sh | bash"
|
||||||
npm install
|
exec $SHELL
|
||||||
npx prisma generate && npx prisma db push && npx prisma db seed
|
volta install node@latest
|
||||||
cp ./screen.service /lib/systemd/system/
|
}
|
||||||
|
|
||||||
cp ./player.service /lib/systemd/system/
|
install_screen() {
|
||||||
|
echo "Installing screen program"
|
||||||
|
cd portal
|
||||||
|
npm install
|
||||||
|
npx prisma generate && npx prisma db push && npx prisma db seed
|
||||||
|
}
|
||||||
|
|
||||||
git clone https://github.com/waveshare/WM8960-Audio-HAT
|
install_sound_card_drivers() {
|
||||||
cd WM8960-Audio-HAT
|
echo "Installing sound card drivers"
|
||||||
sudo ./install.sh
|
git clone https://github.com/waveshare/WM8960-Audio-HAT
|
||||||
|
cd WM8960-Audio-HAT
|
||||||
|
sudo ./install.sh
|
||||||
|
}
|
||||||
|
|
||||||
systemctl daemon-reload
|
setup_daemons() {
|
||||||
systemctl enable player
|
echo "Setting up daemons"
|
||||||
systemctl enable screen
|
sudo cp ./screen.service /lib/systemd/system/
|
||||||
systemctl enable wm8960-soundcard.service
|
sudo cp ./player.service /lib/systemd/system/
|
||||||
systemctl start player
|
systemctl daemon-reload
|
||||||
systemctl start screen
|
systemctl enable player
|
||||||
systemctl start wm8960-soundcard
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
install_all() {
|
||||||
|
update_system
|
||||||
|
install_volta
|
||||||
|
install_screen
|
||||||
|
# install_sound_card_drivers
|
||||||
|
# setup_daemons
|
||||||
|
# install_ohmyzsh
|
||||||
|
# sudo reboot
|
||||||
|
}
|
||||||
|
|
||||||
|
install_all
|
||||||
|
|
||||||
echo "------------------------------------------------------"
|
echo "------------------------------------------------------"
|
||||||
echo "The Black Portal listening device has been provisioned."
|
echo "The Black Portal listening device has been setup."
|
||||||
echo "Reboot this raspberry pi now in order for things to work"
|
echo "This raspberry pi now rebooting in order to apply changes"
|
||||||
echo "------------------------------------------------------"
|
echo "------------------------------------------------------"
|
||||||
|
|
@ -10,6 +10,7 @@ Running mplayer, soundcard library, lcd graphics library, and custom python code
|
||||||
## Bill of Materials
|
## 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
|
- 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 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
|
- 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
|
- 1602 LCD screen - https://www.waveshare.com/lcd1602-i2c-module-blue.htm?sku=30496
|
||||||
|
|
@ -30,11 +31,18 @@ Running mplayer, soundcard library, lcd graphics library, and custom python code
|
||||||
|
|
||||||
## Pre work
|
## 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.
|
You will need a micro SD card reader and computer to complete the next step.
|
||||||
2. Boot the pi.
|
|
||||||
|
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
|
## Setup instructions
|
||||||
|
|
||||||
|
Running the setup script from the command line
|
||||||
|
|
||||||
### Using node and npm
|
### Using node and npm
|
||||||
|
|
||||||
If you have node and npm installed, you can run this command from inside this repository:
|
If you have node and npm installed, you can run this command from inside this repository:
|
||||||
|
|
@ -43,6 +51,8 @@ If you have node and npm installed, you can run this command from inside this re
|
||||||
npm run setup:listener
|
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.
|
If you'd like to install node and npm try installing https://volta.sh and then running volta install node@latest.
|
||||||
|
|
||||||
### Using the terminal
|
### Using the terminal
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue