RE: Why are my binary files going into the bin/ folder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> However, when I install the rpm on the destination computer the
> binaries are put in the /bin/ folder
>
> Why aren’t they going into the /opt/ folder like I wanted?

effectively, because you aren't putting them in /opt, you are putting them
in %{buildroot}/bin.  Once the build is done and the package is
distributed, the %{buildroot} part goes away, and you are left with /bin.

I've posted some helpful packaging links in the past, and I'm sure many
others have as well if you'd like a better understanding.

As for the test of it:

> Summary: XXXX Trading Platform
> %define version 0.0.2

you can just define the version with the Version: entry below, this is
redundant.

> Name: XXXX
> Version: %{version}
> Release: 0
> Copyright: commercial
> Group: Applications/Financial
a common way of doing Source: is %{name}-%{version}.tar  It can save you
changes when you update versions later.
> Source: XXXX-0.0.2.tar
> #BuildRoot: /home/pkrauss/tempoutput/%{name}
> BuildRoot: /opt/%{name}
>
> %description
> XXXX Trading Platform
>
> %prep
> %setup -q
>
> %build
>
> %install

#so if you want the below to exist in  /opt/%{name} when installed
implement like this (also you should clean up the directory #before you
start install, and in the %clean section):

#Clean the build root
rm -rf $RPM_BUILD_ROOT
# make your desired directory structure, the -p creates each level, the
last bit creates all three subdirectories
# you can do them each on their own if you'd really like
mkdir -p $RPM_BUILD_ROOT/opt/%{name}/{bin,scripts,conf}
cp ./binary1 $RPM_BUILD_ROOT/opt/%{name}/bin
cp ./binary2 $RPM_BUILD_ROOT/opt/%{name}/bin
cp ./config1.xml $RPM_BUILD_ROOT/opt/%{name}/conf
cp ./library1.so $RPM_BUILD_ROOT/opt/%{name}/bin

> [ -d $RPM_BUILD_ROOT ] || mkdir $RPM_BUILD_ROOT
> [ -d $RPM_BUILD_ROOT/bin ] || mkdir $RPM_BUILD_ROOT/bin
> [ -d $RPM_BUILD_ROOT/scripts ] || mkdir $RPM_BUILD_ROOT/scripts
> [ -d $RPM_BUILD_ROOT/conf ] || mkdir $RPM_BUILD_ROOT/conf
> cp ./binary1 $RPM_BUILD_ROOT/bin
> cp ./binary2 $RPM_BUILD_ROOT/bin
> cp ./config1.xml $RPM_BUILD_ROOT/conf
> cp ./library1.so $RPM_BUILD_ROOT/bin
>
> %clean
#like i said before, you should cleanup here:
rm -rf $RPM_BUILD_ROOT
>
>
> %files
#you'll want to list the fill path here:
/opt/%{name}/bin/binary1
/opt/%{name}/bin/binary2
/opt/%{name}/conf/config.xml
/opt/%{name}/bin/library1.so

> /bin/binary1
> /bin/binary2
> /conf/config.xml
> /bin/library1.so


enjoy

-greg_______________________________________________Rpm-list mailing listRpm-list@xxxxxxxxxxxxxxxxx://lists.rpm.org/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux