mirror of
https://github.com/munki/munki.git
synced 2026-01-06 06:29:56 -06:00
Added support for installer_item_size to makecatalogitem for all package types.
Added support for installed_size to makecatalogitem for some package types: simple bundle packages and some flat packages. Need to do mpkgs and test dist and other flat styles. New version of getmanifest.py that properly generates HTTP headers. git-svn-id: http://munki.googlecode.com/svn/trunk@28 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
@@ -11,7 +11,6 @@ http://webserver/cgi-bin/getmanifest.py?arbitrarystring
|
||||
|
||||
arbitrarystring could be the hostname, a UUID, a username...
|
||||
|
||||
You can call this from the client with getcatalog.py
|
||||
This could be extended to do wildcard matching, or to
|
||||
read another file that mapped hostnames/strings to catalog
|
||||
files
|
||||
@@ -21,10 +20,8 @@ import os
|
||||
import socket
|
||||
import sys
|
||||
import cgi
|
||||
|
||||
print "Content-type: text/plain"
|
||||
print
|
||||
|
||||
import time
|
||||
|
||||
hostname = ""
|
||||
if 'QUERY_STRING' in os.environ:
|
||||
hostname = os.environ['QUERY_STRING']
|
||||
@@ -38,15 +35,30 @@ if hostname == "":
|
||||
hostname = lookup[0]
|
||||
except:
|
||||
hostname = ip
|
||||
|
||||
# path to manifests: this is the local file path, not the web-relative
|
||||
# path. Must be readable by whatever process is running the CGI
|
||||
manifestdir = "/Library/WebServer/Documents/swrepo/catalogs"
|
||||
|
||||
# the manifestdir is a local path to wherever you keep the master catalogs;
|
||||
# must be readable by the webserver process
|
||||
manifestdir = "/Library/WebServer/Documents/repo/catalogs"
|
||||
|
||||
manifest = os.path.join(manifestdir, hostname)
|
||||
if os.path.exists(manifest):
|
||||
statinfo = os.stat(manifest)
|
||||
modtime = statinfo.st_mtime
|
||||
inode = statinfo.st_ino
|
||||
size = statinfo.st_size
|
||||
print "Content-type: text/plain"
|
||||
print "Content-length: %s" % size
|
||||
print "Last-modified:", time.strftime("%a, %d %b %Y %H:%M:%S GMT",time.gmtime(modtime))
|
||||
# Generate ETag the same way Apache does on OS X...
|
||||
print "ETag:", '"%s-%s-%s"' % (hex(int(inode))[2:], hex(int(size))[2:], hex(int(modtime))[2:])
|
||||
print
|
||||
|
||||
f = open(manifest, mode='r', buffering=1)
|
||||
if f:
|
||||
for line in f.readlines():
|
||||
print line
|
||||
print line.rstrip('\n')
|
||||
f.close()
|
||||
else:
|
||||
print "Content-type: text/plain"
|
||||
print "Content-length: 0"
|
||||
print
|
||||
|
||||
Reference in New Issue
Block a user