Add one-command install script and stability fixes

- Add install.sh for automated setup
- Add all component files (wrapper, service, config, verify)
- Add stability fixes section (WiFi PowerSave disable + Watchdog)
- Update README with new installation instructions
This commit is contained in:
Geert Rademakers
2026-02-17 23:17:38 +01:00
parent 0c078771a0
commit 9529f1b0e1
8 changed files with 406 additions and 5 deletions

113
README.md
View File

@@ -4,8 +4,9 @@
> **Repo Structure:**
```
├── README.md ← This file
├── install.sh ← 🚀 ONE-COMMAND INSTALL (NEW!)
├── 01-prerequisites.md
├── 02-deploy.sh ← One-command setup
├── 02-deploy.sh ← Manual deploy script
├── 03-darkice-wrapper.sh ← USB wait + DarkIce launcher
├── 04-sonos-aux.service ← Systemd unit (Pi OS compatible)
├── darkice.cfg.example ← Your config template
@@ -14,12 +15,40 @@
***
## Quick Deploy (New Pi)
## 🚀 One-Command Installation (Recommended)
**Just run this on your Pi Zero 2:**
```bash
git clone <your-gitea-repo>
cd record-player-sonos-aux
curl -fsSL https://git.geertrademakers.nl/master/sonos-aux-recordplayer-pi/raw/branch/master/install.sh | bash
```
Or with wget:
```bash
wget -qO- https://git.geertrademakers.nl/master/sonos-aux-recordplayer-pi/raw/branch/master/install.sh | bash
```
**What it does:**
- ✅ Installs all prerequisites (darkice, icecast2, alsa-utils)
- ✅ Clones/updates the repository
- ✅ Configures USB audio as card 0 (fixes disconnections!)
- ✅ Deploys all files and systemd service
- ✅ Sets up Icecast2
- ✅ Enables auto-start on boot
**After installation:**
1. Edit config: `nano /home/pi/darkice.cfg` (change password!)
2. Reboot: `sudo reboot`
3. Verify: `journalctl -u sonos-aux.service -f`
---
## Quick Deploy (Manual - Alternative Method)
```bash
git clone https://git.geertrademakers.nl/master/sonos-aux-recordplayer-pi.git
cd sonos-aux-recordplayer-pi
chmod +x *.sh
sudo ./02-deploy.sh
sudo ./install.sh
```
**Full guide below**
@@ -187,6 +216,80 @@ curl -s http://localhost:8000/status-json.xsl | grep -o 'http[^<]*'
1. Add Sonos radio station: `http://<pi-ip>:8000/rapi.mp3`
2. Works with any Sonos speaker/group!
## 🔧 Stability Fixes (Recommended for 24/7)
Raspberry Pi Zero W/2W often loses WiFi due to power management. These steps ensure rock-solid uptime.
### 1. Disable WiFi PowerSave (systemd service)
```bash
sudo nano /etc/systemd/system/wifi-powermanagement-off.service
```
```ini
[Unit]
Description=Disable WiFi Power Management
After=network.target
[Service]
Type=oneshot
ExecStart=/sbin/iwconfig wlan0 power off
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
```
```bash
sudo systemctl daemon-reload
sudo systemctl enable wifi-powermanagement-off
sudo systemctl start wifi-powermanagement-off
```
**Verify:** `iwconfig` should show `Power Management:off` [web:27][web:28]
### 2. Hardware Watchdog (Network + Load Monitoring)
```bash
sudo apt install watchdog -y
sudo nano /etc/watchdog.conf
```
**Replace with this optimal config:**
```ini
watchdog-device = /dev/watchdog
interval = 20
retry-timeout = 180
ping = 192.168.1.1 # Your UniFi gateway
ping = 1.1.1.1 # Cloudflare backup
ping-count = 3
realtime = yes
priority = 50
max-load-1 = 24
max-load-5 = 0
max-load-15 = 0
```
```bash
sudo systemctl enable watchdog
sudo systemctl start watchdog
```
**Test safely:** `sudo systemctl status watchdog` + `sudo journalctl -u watchdog -f`
### 3. Verify Everything
After reboot:
```bash
iwconfig # Power Management:off
systemctl status watchdog # active (running)
journalctl -u watchdog -n20 # Recent heartbeats
```
This combo prevents WiFi dropouts + auto-recovers from hangs/freezes while keeping your Sonos AUX stream running 24/7.
**Reference:** [Watchdog Service for Raspberry Pi](https://xavier.arnaus.net/blog/watchdog-service-for-raspberry-pi-machines)
## 🛠️ Troubleshooting
| Issue | Fix |