[resolved] creating rpm for two different hardware systems

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[resolved] creating rpm for two different hardware systems

Postby nsh12345 » Mar 31st, '20, 15:58

Hello,

I am trying to build rpm that will be installed in two different hardware devices.
For each hardware , there are different files and commands that need to be done, I want the rpm to auto-detect the hw according to its main-board type.
The changes are in install, post and files sections.
I am trying to set one global variable that will check the main board at the beginning and all the other sections use this variable in if statements to determine what to install.
I am aware that variables are normally not passed between sections , but I like think there is a workaround.

What I tried:
Set the variable from pre section with %global , the value doesn't pass to other section.
Set macro at the beginning of the spec file to read the main board (cat /sys/devices/virtual/dmi/id/board_name) but it appears empty in the other sections.

Thanks,
Last edited by nsh12345 on Apr 3rd, '20, 09:41, edited 1 time in total.
nsh12345
 
Posts: 12
Joined: Sep 20th, '19, 20:35

Re: creating rpm for two different hardware systems

Postby doktor5000 » Apr 1st, '20, 17:59

What you are trying to do, sounds like you want to do at install-time of the package when the various %post scripts are being executed, where the hardware of the target system differs. But a %global macro or something defined in %pre is expanded during build-time of the package, you cannot query the target hardware there.
Does that make sense to you ?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 15673
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: creating rpm for two different hardware systems

Postby nsh12345 » Apr 2nd, '20, 12:24

Thank you
Yes, you are right
Anything before post is showing me the hardware of the buildsystem I am using.
But this way , I have to add all the files for both systems instead of separating them as I want.
nsh12345
 
Posts: 12
Joined: Sep 20th, '19, 20:35

Re: creating rpm for two different hardware systems

Postby doktor5000 » Apr 2nd, '20, 17:36

Yes, you would have to add all files for all target systems to the package, and then distinguish during installation time.
Or you can distinguish during build-time and produce separate sub-packages, but you would need to know all variables and queries beforehand.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 15673
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: [resolved] creating rpm for two different hardware syste

Postby nsh12345 » Apr 3rd, '20, 09:41

Thank you , this answers my question.
nsh12345
 
Posts: 12
Joined: Sep 20th, '19, 20:35


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest