[PATCH] live-image: ask for sudo permissions instead of exiting

Colin Ian King colin.king at canonical.com
Thu Jun 18 11:19:50 UTC 2020


On 18/06/2020 00:43, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  live-image/fwts-frontend-text | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text
> index 7fe4533f..4c397438 100755
> --- a/live-image/fwts-frontend-text
> +++ b/live-image/fwts-frontend-text
> @@ -31,7 +31,8 @@ FWTS_TIME=`date +%H%M`
>  #
>  if [ $EUID -ne 0 ]; then
>  	echo "`basename $0`: must be executed with sudo"
> -	exit 1
> +	SELF="$(readlink -f "${BASH_SOURCE[0]}")"
> +	exec sudo -- "$BASH" -- "$SELF" "$@"
>  fi
>  
>  #
> 
How does this work for distros that don't support sudo?

Colin



More information about the fwts-devel mailing list