Re: [Tails-dev] [Tails-project] boot tails iso with grub

Poista viesti

Vastaa
Lähettäjä: linux-service
Päiväys:  
Vastaanottaja: The Tails public development discussion list
Aihe: Re: [Tails-dev] [Tails-project] boot tails iso with grub
Ok, but i am not able you get the correct jq code to retrieve the url.

The - character is making some problems,,,


guy

Op 12/01/19 om 16:34 schreef intrigeri:
> linux-service:
>> so if i:
>> #!/bin/bash
>> url=`curl
>> 'https://tails.boum.org/install/v2/Tails/amd64/stable/latest.json' | awk
>> -F'"' '{ for(i=1; i<=NF; i++) { if($i ~ /^http/) print $i } } '`
>> wget $url
>> i always get the latest iso?
> That's the idea :)
>
> Now, "parsing" JSON this way feels super fragile. If you have to stick
> to shell, I recommend using jq(1) to extract the info you want.
>
> But really, switching to Python / Ruby / etc. would be nicer (and then
> you won't have to deal with the "shell programming is hard" problem,
> which your example script shows — e.g. missing quotes may lead to
> arbitrary code execution as root on all your users' systems, if our
> latest.json ever had malicious content).
>
> Cheers,