From 67477231ce35b8c875217ce8bdae799e4cd4075c Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sat, 13 Mar 2021 16:47:36 +0800 Subject: update --- tools/osm/osm.api.changeset.commit | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tools/osm/osm.api.changeset.commit') diff --git a/tools/osm/osm.api.changeset.commit b/tools/osm/osm.api.changeset.commit index 20ec2f0..a16da63 100755 --- a/tools/osm/osm.api.changeset.commit +++ b/tools/osm/osm.api.changeset.commit @@ -39,6 +39,14 @@ create_changeset() { EOF } +# Return http code after uploading a file +uploade_file_to_changeset() { + curl $OSM_API/changeset/${changeset_id}/upload \ + --user ${OSM_USER_PASSWD} -i \ + --upload-file - \ + --silent -o /dev/null -w "%{http_code}" +} + # Create changeset with given information changeset_id=$(create_changeset) @@ -49,8 +57,7 @@ echo ${changeset_id} # Upload OSC file to Changeset sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\ -tee /dev/tty | \ -curl -X POST --user ${OSM_USER_PASSWD} -i --upload-file - $OSM_API/changeset/${changeset_id}/upload +uploade_file_to_changeset | if [[ $(cat) != '200' ]]; then exit 1; fi # Close Changeset curl -X PUT --user ${OSM_USER_PASSWD} -i ${OSM_API}/changeset/${changeset_id}/close -- cgit v1.2.3-70-g09d2