]> git.openstreetmap.org Git - chef.git/commitdiff
Cleanup planet-mirror redirect script + add missing deps
authorGrant Slater <git@firefishy.com>
Thu, 1 Jan 2015 23:51:07 +0000 (23:51 +0000)
committerGrant Slater <git@firefishy.com>
Thu, 1 Jan 2015 23:51:07 +0000 (23:51 +0000)
cookbooks/planet/recipes/dump.rb
cookbooks/planet/templates/default/planet-mirror-redirect-update.erb

index 7aca0844211b5e9ce82b6b9c96a65af96b39f05b..63092565adc49fa3c2ed68645f24e403ad64f796 100644 (file)
@@ -42,6 +42,10 @@ package "libosmpbf-dev"
 package "libprotobuf-dev"
 package "osmpbf-bin"
 
 package "libprotobuf-dev"
 package "osmpbf-bin"
 
+# Add planet-mirror-redirect-update dependencies
+package "php5-cli"
+package "php5-curl"
+
 directory "/opt/planet-dump-ng" do
   owner "root"
   group "root"
 directory "/opt/planet-dump-ng" do
   owner "root"
   group "root"
index 1f37ecd234cb994546c93b4442c216220a3b0125..c673998e66916e40997ebb694ecb03f00fdf7bee 100644 (file)
@@ -11,7 +11,7 @@ $_YEAR = date('Y');
 $_PLANET_FOLDER = '<%= node[:planet][:dump][:xml_directory] %>/'.$_YEAR.'/';
 $_PLANET_REGEX = "/^(planet|changesets)\-\d{6}(\-nolt)?\.osm\.(bz2|gz)$/";
 $_MIRROR = 'http://ftp.heanet.ie/mirrors/openstreetmap.org/planet/'.$_YEAR.'/';
 $_PLANET_FOLDER = '<%= node[:planet][:dump][:xml_directory] %>/'.$_YEAR.'/';
 $_PLANET_REGEX = "/^(planet|changesets)\-\d{6}(\-nolt)?\.osm\.(bz2|gz)$/";
 $_MIRROR = 'http://ftp.heanet.ie/mirrors/openstreetmap.org/planet/'.$_YEAR.'/';
-$_PLANET_HTACCESS = $_PLANET_FOLDER.'../../.htaccess';
+$_PLANET_HTACCESS = realpath($_PLANET_FOLDER.'../..').'/.htaccess';
 
 function _MIRROR_FILE_SIZE($url) {
        $ch = @curl_init();
 
 function _MIRROR_FILE_SIZE($url) {
        $ch = @curl_init();
@@ -24,7 +24,7 @@ function _MIRROR_FILE_SIZE($url) {
        return ($curl_result['download_content_length']);
 }                      
 
        return ($curl_result['download_content_length']);
 }                      
 
-if (posix_getuid() !== fileowner($_PLANET_HTACCESS)) die('User ID of process does not match .htaccess owner'."\n");
+if (!is_writable($_PLANET_HTACCESS)) die('File '.$_PLANET_HTACCESS.' is not writable by current user.'."\n");
 
 if (is_dir($_PLANET_FOLDER)) {
        $htaccess_contents = file_get_contents($_PLANET_HTACCESS);
 
 if (is_dir($_PLANET_FOLDER)) {
        $htaccess_contents = file_get_contents($_PLANET_HTACCESS);
@@ -53,4 +53,3 @@ if (is_dir($_PLANET_FOLDER)) {
                fclose($htaccess_handle);
        }
 }
                fclose($htaccess_handle);
        }
 }
-?>