From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- tools/osm/osm.api.changeset.commit | 80 -------------------------------------- 1 file changed, 80 deletions(-) delete mode 100755 tools/osm/osm.api.changeset.commit (limited to 'tools/osm/osm.api.changeset.commit') diff --git a/tools/osm/osm.api.changeset.commit b/tools/osm/osm.api.changeset.commit deleted file mode 100755 index 6b67833..0000000 --- a/tools/osm/osm.api.changeset.commit +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -set -e -shopt -s lastpipe - -OSM_SERVER=https://api.openstreetmap.org -OSM_TEST_SERVER=https://master.apis.dev.openstreetmap.org -if [[ $@ =~ '--serious' ]]; then - SERVER=$OSM_SERVER -else - SERVER=$OSM_TEST_SERVER -fi - -OSM_API=${SERVER}/api/0.6 -FILE=${@//--serious/} - -# Prompt for comment and User:Password -if [[ ! -t 0 ]]; then - comment=$(cat) -else - read -e -p 'Type comment: ' -r comment " $SOURCE)}" - - curl ${OSM_API}/changeset/create \ - --user ${OSM_USER_PASSWD} \ - --upload-file - \ - --silent \ - < - - ${SOURCE_TAG} - - - - - -EOF -} - -# Return http code after uploading a file -uploade_file_to_changeset() { - curl -X POST $OSM_API/changeset/${changeset_id}/upload \ - --user ${OSM_USER_PASSWD} -i \ - --upload-file - \ - --silent -o /dev/null -w "%{http_code}" -} - -close_changeset() { - curl -X PUT ${OSM_API}/changeset/${changeset_id}/close \ - --user ${OSM_USER_PASSWD} -i \ - --silent -o /dev/null -w "%{http_code}" -} - -# Create changeset with given information -changeset_id=$(create_changeset) - -# Print created changeset id -echo "Changeset created, check ${SERVER}/changeset/${changeset_id}" >/dev/tty -echo ${changeset_id} - -# Upload OSC file to Changeset -sed -Ee "/<(node|way|relation)/ s/>/ changeset=\"${changeset_id}\">/" $FILE |\ -uploade_file_to_changeset | if [[ $(cat) == '200' ]]; then - echo Upload file $FILE to changeset ${changeset_id} >/dev/tty -else - exit 1 -fi - -# Close Changeset -close_changeset | if [[ $(cat) == '200' ]]; then - echo Changeset ${changeset_id} closed >/dev/tty -else - exit 1 -fi -- cgit v1.2.3-70-g09d2