[osm-tile-server] 56/117: Using normal scripts where possible
Ruben Undheim
rubund-guest at moszumanska.debian.org
Tue Nov 3 23:18:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
rubund-guest pushed a commit to branch master
in repository osm-tile-server.
commit 9a3149372754c1d3580a720afa6a274c17838076
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date: Fri Sep 4 18:58:18 2015 +0200
Using normal scripts where possible
---
Makefile | 0
debian/osm-tile-server-base.dirs | 1 +
debian/osm-tile-server-base.install | 1 +
debian/osm-tile-server-base.postinst | 17 ++++++-------
scripts/Makefile | 3 +++
scripts/osm-tile-server-download | 11 +++++++++
scripts/osm-tile-server-import | 3 +++
scripts/osm-tile-server-process | 4 ++-
scripts/osm-tile-server-status | 10 ++++++++
src/Makefile | 15 +++---------
src/osm-tile-server-download.c | 31 ------------------------
src/osm-tile-server-status.c | 47 ------------------------------------
12 files changed, 44 insertions(+), 99 deletions(-)
diff --git a/Makefile b/Makefile
old mode 100644
new mode 100755
diff --git a/debian/osm-tile-server-base.dirs b/debian/osm-tile-server-base.dirs
index 6b67c29..5dbaef0 100644
--- a/debian/osm-tile-server-base.dirs
+++ b/debian/osm-tile-server-base.dirs
@@ -1 +1,2 @@
/var/cache/osm-tile-server-base
+/var/lib/osm-tile-server-base
diff --git a/debian/osm-tile-server-base.install b/debian/osm-tile-server-base.install
index 186c185..d929822 100644
--- a/debian/osm-tile-server-base.install
+++ b/debian/osm-tile-server-base.install
@@ -1,3 +1,4 @@
usr/bin/*
+usr/lib/osm-tile-server-base/*
samples usr/share/osm-tile-server-base/
etc/osm-tile-server.conf /etc/
diff --git a/debian/osm-tile-server-base.postinst b/debian/osm-tile-server-base.postinst
index ae08f88..e3a4275 100644
--- a/debian/osm-tile-server-base.postinst
+++ b/debian/osm-tile-server-base.postinst
@@ -86,14 +86,13 @@ case "$1" in
sed -i 's/^DBNAME=""/DBNAME="'${DBNAME}'"/' /etc/osm-tile-server.conf
- chown $DBUSER:$DBUSER /usr/bin/osm-tile-server-import
- chmod 4554 /usr/bin/osm-tile-server-import
- chown $DBUSER:$DBUSER /usr/bin/osm-tile-server-download
- chmod 4554 /usr/bin/osm-tile-server-download
- chown $DBUSER:$DBUSER /usr/bin/osm-tile-server-status
- chmod 4554 /usr/bin/osm-tile-server-status
+ chown $DBUSER:$DBUSER /usr/lib/osm-tile-server-base/bin/osm-tile-server-import
+ chmod 4554 /usr/lib/osm-tile-server-base/bin/osm-tile-server-import
chown $DBUSER:$DBUSER /var/cache/osm-tile-server-base
+ chown $DBUSER:$DBUSER /var/lib/osm-tile-server-base
+ chmod 2775 /var/cache/osm-tile-server-base
+ chmod 2775 /var/lib/osm-tile-server-base
if [ "$IMPORTSAMPLE" = "true" ] ; then
@@ -101,13 +100,13 @@ case "$1" in
fi
if [ "$ACTIONNOW" = "true" ] ; then
- su $DBUSER -c "echo \"TODO\" > /var/cache/osm-tile-server-base/status.txt"
+ su $DBUSER -c "echo \"TODO\" > /var/lib/osm-tile-server-base/status.txt"
if [ "$PROCESSNOW" = "Now; will take some time" ] ; then
osm-tile-server-process
- su $DBUSER -c "echo \"DONE\" > /var/cache/osm-tile-server-base/status.txt"
+ su $DBUSER -c "echo \"DONE\" > /var/lib/osm-tile-server-base/status.txt"
fi
else
- su $DBUSER -c "echo \"\" > /var/cache/osm-tile-server-base/status.txt"
+ su $DBUSER -c "echo \"\" > /var/lib/osm-tile-server-base/status.txt"
fi
;;
diff --git a/scripts/Makefile b/scripts/Makefile
index 15c3248..8b52d71 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -3,3 +3,6 @@ default:
install:
mkdir -p ${DESTDIR}/usr/bin
install osm-tile-server-process ${DESTDIR}/usr/bin/
+ install osm-tile-server-status ${DESTDIR}/usr/bin/
+ install osm-tile-server-download ${DESTDIR}/usr/bin/
+ install osm-tile-server-import ${DESTDIR}/usr/bin/
diff --git a/scripts/osm-tile-server-download b/scripts/osm-tile-server-download
new file mode 100755
index 0000000..79e64eb
--- /dev/null
+++ b/scripts/osm-tile-server-download
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+FILENAME="downloaded.osm.pbf"
+URL="http://download.geofabrik.de/europe/norway-latest.osm.pbf"
+COMMAND="wget -O /var/cache/osm-tile-server-base/${FILENAME} ${URL}"
+echo "The following command will be run to download:\n\n"
+echo " ${COMMAND}\n\n"
+
+$COMMAND
+
+
diff --git a/scripts/osm-tile-server-import b/scripts/osm-tile-server-import
new file mode 100755
index 0000000..ad0541b
--- /dev/null
+++ b/scripts/osm-tile-server-import
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/usr/lib/osm-tile-server-base/bin/osm-tile-server-import $*
diff --git a/scripts/osm-tile-server-process b/scripts/osm-tile-server-process
index 1b5bd55..87451cf 100755
--- a/scripts/osm-tile-server-process
+++ b/scripts/osm-tile-server-process
@@ -1,5 +1,7 @@
#!/bin/bash
+umask 002
+
failed(){
echo "Failed"
osm-tile-server-status todo
@@ -11,7 +13,7 @@ trap failed SIGTERM
set -e
set +e
-cat /var/cache/osm-tile-server-base/status.txt | grep -q TODO
+cat /var/lib/osm-tile-server-base/status.txt | grep -q TODO
RET=$?
set -e
if [ "$RET" = "0" ] ; then
diff --git a/scripts/osm-tile-server-status b/scripts/osm-tile-server-status
new file mode 100755
index 0000000..713ca9a
--- /dev/null
+++ b/scripts/osm-tile-server-status
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ "$1" = "done" ] ; then
+ echo "DONE" > /var/lib/osm-tile-server-base/status.txt
+elif [ "$1" = "inprogress" ] ; then
+ echo "INPROGRESS" > /var/lib/osm-tile-server-base/status.txt
+elif [ "$1" = "todo" ] ; then
+ echo "TODO" > /var/lib/osm-tile-server-base/status.txt
+fi
+
diff --git a/src/Makefile b/src/Makefile
index 8cdc9d2..800fa28 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,21 +1,14 @@
-default: osm-tile-server-import osm-tile-server-download osm-tile-server-status
+default: osm-tile-server-import
install: default
- mkdir -p ${DESTDIR}/usr/bin
- install osm-tile-server-import ${DESTDIR}/usr/bin/
- install osm-tile-server-download ${DESTDIR}/usr/bin/
- install osm-tile-server-status ${DESTDIR}/usr/bin/
+ mkdir -p ${DESTDIR}/usr/lib/osm-tile-server-base/bin
+ install osm-tile-server-import ${DESTDIR}/usr/lib/osm-tile-server-base/bin/
osm-tile-server-import: osm-tile-server-import.o parse-settings.o
${CC} ${LDFLAGS} -o osm-tile-server-import osm-tile-server-import.o parse-settings.o
-osm-tile-server-download: osm-tile-server-download.o parse-settings.o
- ${CC} ${LDFLAGS} -o osm-tile-server-download osm-tile-server-download.o parse-settings.o
-
-osm-tile-server-status: osm-tile-server-status.o parse-settings.o
- ${CC} ${LDFLAGS} -o osm-tile-server-status osm-tile-server-status.o parse-settings.o
clean:
- ${RM} *.o osm-tile-server-import osm-tile-server-download osm-tile-server-status
+ ${RM} *.o osm-tile-server-import
diff --git a/src/osm-tile-server-download.c b/src/osm-tile-server-download.c
deleted file mode 100644
index 8c68f6e..0000000
--- a/src/osm-tile-server-download.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "parse-settings.h"
-
-
-int main(int argc, char **argv)
-{
- char command[256];
- char *area;
-
- if(argc != 2){
- fprintf(stderr,"Usage: %s <area/country>\n",argv[0]);
- return -1;
- }
- area = argv[1];
-
- parse_settings();
-
- char *filename = "downloaded.osm.pbf";
- char *url = "http://download.geofabrik.de/europe/norway-latest.osm.pbf";
- snprintf(command,255,"wget -O /var/cache/osm-tile-server-base/%s %s ",filename,url);
- printf("The following command will be run to download:\n\n");
- printf(" %s\n\n",command);
- system(command);
-
- return 0;
-
-}
-
diff --git a/src/osm-tile-server-status.c b/src/osm-tile-server-status.c
deleted file mode 100644
index 1d0c0d1..0000000
--- a/src/osm-tile-server-status.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "parse-settings.h"
-
-int main(int argc, char **argv)
-{
- char command[256];
- char *cmd;
-
- if(argc != 2){
- fprintf(stderr,"Usage: %s <command>\n",argv[0]);
- return -1;
- }
-
- parse_settings();
-
- cmd = argv[1];
-
- FILE *wfile;
-
- if(strncmp(cmd,"done",4) == 0) {
- wfile = fopen("/var/cache/osm-tile-server-base/status.txt","w");
- fprintf(wfile,"DONE");
- fclose(wfile);
- }
- else if(strncmp(cmd,"inprogress",10) == 0) {
- wfile = fopen("/var/cache/osm-tile-server-base/status.txt","w");
- fprintf(wfile,"INPROGRESS");
- fclose(wfile);
- }
- else if(strncmp(cmd,"todo",4) == 0) {
- wfile = fopen("/var/cache/osm-tile-server-base/status.txt","w");
- fprintf(wfile,"TODO");
- fclose(wfile);
- }
-
- //snprintf(command,255,"osm2pgsql --slim -d %s --cache-strategy sparse -C 100 --hstore -S /usr/share/osm2pgsql/default.style %s",dbname,pbffile);
- //printf("Importing to database with this command:\n\n");
- //printf(" %s\n\n",command);
- //system(command);
-
- return 0;
-
-}
-
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm-tile-server.git
More information about the Pkg-grass-devel
mailing list