Page MenuHomeFreeBSD
Authored By
bapt
Jun 5 2014, 10:37 AM
Size
957 B
Referenced Files
None
Subscribers
None
#!/bin/sh
fget()
{
fetch -q --no-verify-peer -o - "https://bugs.freebsd.org/bugzilla/jsonrpc.cgi?method=Bug.attachments&params=[{\"ids\": [\"$1\"]}]"
}
patch=$1
res=$(fget $patch)
error=$(echo $res | jshon -e error -t)
if [ $error = "object" ]; then
echo $res | jshon -e error -e message
exit 1
fi
nbattach=$(echo $res | jshon -e result -e bugs -e $patch -l)
if [ $nbattach -eq 0 ]; then
echo "No attachement found for #$patch"
exit 1
fi
i=0
while [ $i -lt $nbattach ]; do
obsolete=$(echo $res | jshon -e result -e bugs -e $patch -e $i -e is_obsolete)
if [ $obsolete -eq 1 ]; then
continue
fi
filename=$(echo $res | jshon -e result -e bugs -e $patch -e $i -e file_name -u)
data=$(echo $res | jshon -e result -e bugs -e $patch -e $i -e data -u)
echo "Creating $filename"
echo "${data}==" | b64decode -r > $filename
i=$(($i + 1))
done

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
204
Default Alt Text
file (957 B)

Event Timeline