please advice why I get the error "error: License field must be present in package: (main package)"

I need to create rpm file ,

I only have the spec file under SPECS

and the test.sh script under SOURCES

what’s wrong here?

 [root@linux /usr/src/redhat]# ls


the spec file:

Summary: An example tool. To show a simple rpm build of the tool.
Name: test.sh
Version: 6.2
Release: 2
Group: Development/Debuggers

 #  rpm -ba my_spec.spec
 error: License field must be present in package: (main package)
 # ls ../SOURCES/
  • By the looks of it I've solved your initial question. However as you've found, you've run into a new problem. I'm afraid writing spec files is a lot more complicated than the example you've provided, but perfectly doable. I've yet to find a decent example of packaging a simple bash script but something like this fedora guide is better than nothing. Just strip out the build commands & requirements.
    – Pricey
    Apr 12, 2011 at 15:24
  • but I have linux red-hat not fedora , second can you please give the correct spec file?
    – yael
    Apr 12, 2011 at 15:26
  • Both RHEL and Fedora use the same rpm technology and the tutorial is valid. (That doesn't mean you can install fedora rpms in redhat or vica verca!) This forum thread here (see post 3) is an example of packaging a bash script but I haven't tried or checked it myself.
    – Pricey
    Apr 13, 2011 at 8:26

1 Answer 1


Wild shot in the dark... have you tried adding something like:

License: OtherLicense

before %description?

  • OK I add this but now I get: error: Bad file: /root/rpmbuild/SOURCES/test.sh: No such file or directory RPM build errors: Bad file: /root/rpmbuild/SOURCES/test.sh: No such file or directory
    – yael
    Apr 12, 2011 at 15:19
  • 1
    Awesome, looks like that's solved the problem you're asking about originally, going to add a further comment to your question.
    – Pricey
    Apr 12, 2011 at 15:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .