Closed Spagett1 closed 1 year ago
Maybe instead of trying to guess, we should just stop if user isn't root, and instruct him/her to elevate with whatever the user has?
Just adding something like this would be enough and we could get rid of any sudo, doas etc.
if [[ $(id -u) -ne 0 ]] ; then echo "This script must be run as root!" ; exit 1 ; fi
As far as your commit goes,I don't see any problem on incorporating it, just wondering if adding checks for any implementation of sudo that might appear is worth , instead of... just stopping if user doesn't have enough privileges to run it?
Honestly that is how i would do it, i just made this patch to keep in the style of the current formula, i would do
if [ $(id -u) -ne 0 ] ; then echo "This script must be run as root!" ; exit 1 ; fi
Instead though (no need for the double []) for posix compliancey with shells like dash.
Honestly that is how i would do it, i just made this patch to keep in the style of the current formula, i would do
if [ $(id -u) -ne 0 ] ; then echo "This script must be run as root!" ; exit 1 ; fi
Instead though (no need for the double []) for posix compliancey with shells like dash.
If there's an assumption we can make, is that any Pinephone user will know well how to elevate as root :) Thanks for the help!
Since distros running sxmo have doas installed some users (me included) have removed sudo, this patch adds a quick check to the flashall script which checks if sudo exists and otherwise runs doas if its not found.