Changes between Version 12 and Version 13 of RpmHowToPackagers


Ignore:
Timestamp:
Aug 24, 2011, 11:32:22 PM (13 years ago)
Author:
dmik
Comment:

Added CUBE information

Legend:

Unmodified
Added
Removed
Modified
  • RpmHowToPackagers

    v12 v13  
    124124}}}
    125125
     126=== CONFIG.SYS changes ===
     127It is sometimes necessary to modify the CONFIG.SYS file during installation, even when using RPM. One of the examples is when your package installs a device driver that needs to be loaded at boot time or when a global environment variable needs to be set. This can be done from the {{{%post}}} section using the special macro {{{%cube}}} which is based on the CUBE tool.
     128
     129For example, this snippet will add a DEVICE= line to CONFIG.SYS after the first DEVICE= line (or to the bottom if there are no DEVICE= statements), add an environment variable (using the same logic) and back up the old CONFIG.SYS file as CONFIG.SYS.YUM. Note that the backup file name is only specified in the __first__ {{{%cube}}} statement since you only need to create the backup file __once__ -- before you start any modifications.
     130{{{
     131%post
     132%cube {ADDLINE "DEVICE=%UNIXROOT%\usr\%{_lib}\mydrv.sys" (AFTER "DEVICE="} %{os2_config_sys} %{os2_config_sys}.yum >nul
     133%cube {ADDLINE "SET MYENVVAR=myvalue" (AFTER "SET "} %{os2_config_sys} >nul
     134echo; echo "NOTE:"
     135echo; echo "The file '%{os2_config_sys}' has been changed. You need to reboot your"
     136echo "computer in order to activate these changes."
     137echo
     138}}}
     139
     140Here is the corresponding uninstallation snippet that will undo changes made by the above code. You should always perform symmetric uninstallation steps to make sure that all changes your package does to CONFIG.SYS are rolled back when the package is uninstalled from the system.
     141{{{
     142%postun
     143%cube {DELLINE "SET MYENVVAR="} %{os2_config_sys} >nul
     144%cube {DELLINE "DEVICE=%UNIXROOT%\usr\%{_lib}\mydrv.sys"} %{os2_config_sys} >nul
     145echo; echo "NOTE:"
     146echo; echo "The file '%{os2_config_sys}' has been changed. You need to reboot your"
     147echo "computer in order to activate these changes."
     148echo
     149}}}
     150
     151The complete CUBE documentation is available here: http://www3.sympatico.ca/gjarviseng/cube/cube.html