Browse Source

Fix permissions of deb structure in postinst script

rdb 16 năm trước cách đây
mục cha
commit
f94344fb70

+ 9 - 0
direct/src/p3d/DeploymentTools.py

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

+ 6 - 0
direct/src/p3d/pdeploy.py

@@ -202,6 +202,12 @@ if version == '' and deploy_mode == 'installer':
 if not outputDir:
 if not outputDir:
     print '\nYou must name the output directory with the -o parameter.\n'
     print '\nYou must name the output directory with the -o parameter.\n'
     sys.exit(1)
     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':
 if deploy_mode == 'standalone':
     s = Standalone(appFilename, tokens)
     s = Standalone(appFilename, tokens)