RPi-Distro / raspi-config

Configuration tool for the Raspberry Pi
Other
570 stars 209 forks source link

do_hostname should error propogate errors #191

Closed KalleDK closed 2 years ago

KalleDK commented 2 years ago

A way to help with #113 unless the solution is to move the root check to before the nonint switch

XECDesign commented 2 years ago

It would be nicer to catch specific errors rather than just set -e the whole function. I'm not seeing much in there that can go wrong. It doesn't check that the input is valid and the sed command looks questionable, but in general it shouldn't fail.

Unless, it's the same issue as in #113, where it's not being run as root. In which case I think the solution should be to move that check further up in the script.

KalleDK commented 2 years ago

I ran into it because the script was run by the wrong user, but didn't have an error. So if move the root check is the solution, then I'm all happy :)

XECDesign commented 2 years ago

Actually this change would break quite a lot of use cases, so I've had to revert it.

Instead, we'll assume nonint users know what they're doing. This is an internal and undocumented feature for which we do no offer support.