Correzione percorsi, creazione altre cartelle necessarie.

This commit is contained in:
Emiliano Vavassori 2022-03-19 23:15:31 +01:00
parent 29984163c3
commit ef7202a7c6
1 changed files with 8 additions and 11 deletions

View File

@ -68,7 +68,7 @@ class Build(object):
#buildtarballs.extend([ x for x in self.__tarballs__ if ('helppack_'+ lang) in x ])
# Creating a subfolder
os.makedirs(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppImage'), exist_ok = True)
os.makedirs(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir'), exist_ok = True)
# And then cd to the appname folder.
os.chdir(os.path.join(self.__builddir__, self.__appname__))
@ -77,18 +77,19 @@ class Build(object):
subprocess.run("tar xzf ../%s" % archive, shell=True)
# At this point, let's decompress the deb packages
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppImage'))
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir'))
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True)
# Changing desktop file
subprocess.run("find . -iname startcenter.desktop -exec cp {} . \;", shell=True)
subprocess.run("sed -i -e 's|Name=.*|Name=%s|g' startcenter.desktop" % self.__appname__, shell=True)
subprocess.run("find . -name startcenter.png -path '*hicolor*48x48*' -exec cp {} \;", shell=True)
binaryname = subprocess.check_output("awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'", shell=True).strip('\n')
subprocess.run("rm -f usr/bin/%s" % binaryname, shell=True)
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppImage', 'usr', 'bin'))
binaryname = subprocess.check_output("awk 'BEGIN { FS = \"=\" } /^Exec/ { print $2; exit }' startcenter.desktop | awk '{ print $1 }'", shell=True).decode('utf-8').strip('\n')
os.makedirs(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir', 'usr', 'bin'))
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir', 'usr', 'bin'))
subprocess.run("find ../../opt -name soffice -path '*programm*' -exec ln -s {} %si \;" % binaryname, shell=True)
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppImage'))
os.chdir(os.path.join(self.__builddir__, self.__appname__, self.__appname__ + '.AppDir'))
# Download AppRun from github
apprunurl = "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-{arch}".format(arch = self.__arch__)
@ -109,11 +110,7 @@ class Build(object):
# Copying built image to final directory
subprocess.run("find . -iname '*.AppImage' -exec cp {} %s \;" % outdir, shell = True)
os.chdir('/tmp')
def __del__(self):
"""Destructor for the class."""
# Cleanup
del self.__builddir__
del self.__builddir__
if __name__ == '__main__':