[Gambas-user] Update ide Package module for shared libraries, Make installation packages to have preinst and postinst scripts
Brian G
brian at westwoodsvcs.com
Tue Feb 25 02:07:00 CET 2020
Since with Gambas shared libraries we can not use the dh_mkshlib as it also changes system paths etc
I would like to add the following code to generate preinst and postinst scripts for preserving older versions of shared libraries
This change is from the package.module in the ide , there could be some imposed rules for these script regarding how they process the shared libraries.
This would be done to preserve applications that use older versions of the libraries. Linux shared libraries do allow this and usually create a link to the most current as a default version.
This is from the Debian build, But can be added for the others as well.
I am including a testexec library which contains the created scripts as examples
Case Project.TYPE_LIBRARY
Dim PrePostFiles As File
PrePostFiles = Open sPackagePath &/ "debian/preinst" For Create
Print #PrePostFiles, "#!/usr/bin/gbs" & System.version
Print #PrePostFiles, "print \"Gambas Running Pre Install Shared Library Process\""
Print #PrePostFiles, "if not exist(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "\") then quit 0" ' never installed before
Print #PrePostFiles, "print \"Gambas Running Pre Install Shared Library Process Checking for .lib\""
Print #PrePostFiles, "If Not Exist(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\") then mkdir \"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\""
Print #PrePostFiles, "print \"Gambas Running Pre Install Shared Library Process Checking each file LIKE:" & $sName & "*\""
Print #PrePostFiles, "For each i as string in dir(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "\",\"" & $sName & "*\",gb.file)"
Print #PrePostFiles, "Print \"Gambas Pre Install Moving : \" ; i"
Print #PrePostFiles, "Move \"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "\" &/ i To \"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\" &/ i"
Print #PrePostFiles, "Next"
Print #PrePostFiles, "print \"Gambas Ending Pre Install Shared Library Process\""
Close #PrePostFiles
Chmod sPackagePath &/ "debian/preinst" To "rwxr-xr-x"
PrePostFiles = Open sPackagePath &/ "debian/postinst" For Create
Print #PrePostFiles, "#!/usr/bin/gbs" & System.version
Print #PrePostFiles, "print \"Gambas Running Post Install Shared Library Process\""
Print #PrePostFiles, "if not exist(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\") then quit 0" ' never installed before
Print #PrePostFiles, "For Each i As String In Dir(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\")"
Print #PrePostFiles, "Print \"Gambas Post Install Chking Lib: \";i"
Print #PrePostFiles, "If Not Exist(\"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "\" &/ i) Then"
Print #PrePostFiles, "Print \"Gambas Post Install Making Available Lib: \";i"
Print #PrePostFiles, " Move \"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\" &/ i To \"/usr/lib/gambas" & System.version &/ LCase($sVendor) & "/\" &/ i"
Print #PrePostFiles, "Else"
Print #PrePostFiles, " Kill \"/usr/lib/gambas" & System.version &/ LCase($sVendor) &/ ".lib\" &/ i"
Print #PrePostFiles, " Print\"Gambas Post Install :\"; i ; \" - Newer version same level installed\""
Print #PrePostFiles, "Endif"
Print #PrePostFiles, "next"
Close #PrePostFiles
Chmod sPackagePath &/ "debian/postinst" To "rwxr-xr-x"
Print #hFile, "src/"; $sName; "/"; $sLibraryName; ".gambas usr/lib/gambas" & System.Version; "/"; LCase($sVendor)
Case Project.TYPE_NORMAL
.........
Thank You
Brian G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200224/1ca71ce5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: westwood-testexec_4.14.7-0ubuntu1_all.deb
Type: application/x-deb
Size: 2664 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200224/1ca71ce5/attachment-0001.bin>
More information about the User
mailing list