Hi!<br>   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?<br>
<br>--------ERROR-----------<br><i># rpm -ivh noarch/BinName-1.2-4.noarch.rpm<br>Preparing...                ########################################### [100%]<br>/var/tmp/rpm-tmp.47444: line 5: syntax error near unexpected token `fi'<br>
/var/tmp/rpm-tmp.47444: line 5: `    fi'<br>error: %pre(BinName-1.2-4.noarch) scriptlet failed, exit status 2<br>error:   install: %pre scriptlet failed (2), skipping BinName-1.2-4</i><br><br><br>------SPEC_FILE---------------<br>
Summary: Bin Summary<br>Name: BinName<br>Version: 1.2<br>Release: 4<br>Source0: %{name}.sh<br>Source1: %{name}.conf<br>License: Commercial<br>Group: Applications/Databases<br>BuildArch: noarch<br><br>%description<br>Bin desc<br>
<br>%define oracle_group oinstall<br>%define script_path /opt/jobs/%{name}<br><br>%pre<br>if ! grep oracle /etc/passwd > /dev/null; then<br>    useradd -m -g %{oracle_group} oracle<br>else<br> <b>   %define oracle_group %(groups oracle |awk -F : '{print $2}' |awk '{print $1}')</b><br>
fi<br><br>%install<br>mkdir -p %{script_path}<br>cp -pfv %{name}.sh %{name}.conf %{script_path}<br><br>%files<br>%defattr(0644,oracle,%{oracle_group})<br>%dir %{script_path}<br>%attr(0755,oracle,%{oracle_group})%{script_path}/%{name}.sh<br>
%config %{script_path}/%{name}.conf<br><br><br><br>-- <br>Att.<br>Bruno Galindro da Costa<br><a href="mailto:bruno.galindro@gmail.com">bruno.galindro@gmail.com</a><br><br>