RasPi is a great platform -- but doesn't have any power management as bought. And, running a Linux kernel means that files are open almost all the time. Turning off power is risky.
Per Jeremy Cook it's pretty easy to do this. I bought switches like he suggested, rated at 12v but the leds light up with 5v just fine. These switches have a built-in resistor on the LED, so the wiring to the switch is just 3 wires: ground, gpio3, and led-signal.
- A momentary switch between header pins 5 and ground
- An LED between (arbitrarily) pin 10 (gpio 15) and ground (with resistor, as needed)
- This in
/boot/config.txtwhere the "gpio15" line matches your chosen wiring
[all] # shutdown via button dtoverlay=gpio-shutdown # led on gpio15 gpio=15=op,dh
and wonder-of-wonders -- IT WORKS!