Fix permissions of deb structure in postinst script

This commit is contained in:
rdb 2010-01-02 15:28:48 +00:00
parent 4c7c0b4b68
commit f94344fb70
2 changed files with 15 additions and 0 deletions

View File

@ -292,6 +292,12 @@ class Installer:
print >>controlfile, "Description: %s" % self.fullname
print >>controlfile, "Depends: libc6, libgcc1, libstdc++6, libx11-6"
controlfile.close()
postinst = open(Filename(tempdir, "postinst").toOsSpecific(), "w")
print >>postinst, "#!/bin/sh"
print >>postinst, "chmod -R 777 /usr/share/%s" % self.shortname.lower()
print >>postinst, "chmod -R 555 /usr/share/%s/hosts" % self.shortname.lower()
postinst.close()
os.chmod(Filename(tempdir, "postinst").toOsSpecific(), 0755)
postrmfile = open(Filename(tempdir, "postrm").toOsSpecific(), "w")
print >>postrmfile, "#!/bin/sh"
print >>postrmfile, "rm -rf /usr/share/%s" % self.shortname.lower()
@ -313,13 +319,16 @@ class Installer:
# Create a control.tar.gz file in memory
controlfile = Filename(tempdir, "control")
postinstfile = Filename(tempdir, "postinst")
postrmfile = Filename(tempdir, "postrm")
controltargz = CachedFile()
controltarfile = tarfile.TarFile.gzopen("control.tar.gz", "w", controltargz, 9)
controltarfile.add(controlfile.toOsSpecific(), "control")
controltarfile.add(postinstfile.toOsSpecific(), "postinst")
controltarfile.add(postrmfile.toOsSpecific(), "postrm")
controltarfile.close()
controlfile.unlink()
postinstfile.unlink()
postrmfile.unlink()
# Create the data.tar.gz file in the temporary directory

View File

@ -202,6 +202,12 @@ if version == '' and deploy_mode == 'installer':
if not outputDir:
print '\nYou must name the output directory with the -o parameter.\n'
sys.exit(1)
if not outputDir.exists():
print '\nThe specified output directory does not exist!\n'
sys.exit(1)
elif not outputDir.isDirectory():
print '\nThe specified output directory is a file!\n'
sys.exit(1)
if deploy_mode == 'standalone':
s = Standalone(appFilename, tokens)