aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/osm/osm.api.changeset.create
blob: ab9fe85a1c5dce271e2ee582dd1d54928fd6a037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

set -e

read -e -p 'Type comment: ' -r comment </dev/tty
if [ -z $OSM_USER_PASSWD ]; then
  read -e -p 'Type USER:PASSWD: ' -r OSM_USER_PASSWD </dev/tty
fi

info="<osm>
        <changeset>
          <tag k='comment' v='$comment'/>
          <tag k='created_by' v='bash script'/>
          <tag k='bot' v='yes'/>
        </changeset>
      </osm>
     "

changeset_id=$(echo $info |\
               curl -u $OSM_USER_PASSWD --upload-file - $OSM_API/changeset/create |\
               tail -1)

echo >/dev/tty
echo "changeset created, check $OSM_SERVER/changeset/$changeset_id" >/dev/tty
echo $changeset_id | tee /tmp/changeset && echo copied to /tmp/changeset