RPM Spec File - %define into %pre section

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

 



Hi!
  I´m building a RPM package and I need to check if a user exists before install the package. If user exists, the script will create him in the system. Before I compile then, I´ve  tried to install it, but the following error is displayed. Is this because I´ve putted a %define into the %pre section? How can I define a variable that I can use on the %defattr directive inside %pre section?

--------ERROR-----------
# rpm -ivh noarch/BinName-1.2-4.noarch.rpm
Preparing...                ########################################### [100%]
/var/tmp/rpm-tmp.47444: line 5: syntax error near unexpected token `fi'
/var/tmp/rpm-tmp.47444: line 5: `    fi'
error: %pre(BinName-1.2-4.noarch) scriptlet failed, exit status 2
error:   install: %pre scriptlet failed (2), skipping BinName-1.2-4



------SPEC_FILE---------------
Summary: Bin Summary
Name: BinName
Version: 1.2
Release: 4
Source0: %{name}.sh
Source1: %{name}.conf
License: Commercial
Group: Applications/Databases
BuildArch: noarch

%description
Bin desc

%define oracle_group oinstall
%define script_path /opt/jobs/%{name}

%pre
if ! grep oracle /etc/passwd > /dev/null; then
   useradd -m -g %{oracle_group} oracle
else
   %define oracle_group %(groups oracle |awk -F : '{print $2}' |awk '{print $1}')
fi

%install
mkdir -p %{script_path}
cp -pfv %{name}.sh %{name}.conf %{script_path}

%files
%defattr(0644,oracle,%{oracle_group})
%dir %{script_path}
%attr(0755,oracle,%{oracle_group})%{script_path}/%{name}.sh
%config %{script_path}/%{name}.conf



--
Att.
Bruno Galindro da Costa
bruno.galindro@xxxxxxxxx

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux