We used pkgadd in solaris, currently we want to replace pkgadd w/ rpm on the linux. However we haven't found the return value for rpm in the man page on linux. How could we deal with it? how could we know that whether rpm does successfully or not?
Here is how we called pkgadd in the c code. As you may know, 0/10/20 are the exit status for pkgadd when it does successfully. When we replace pkgadd w/ rpm, we find that retval=0 no matter successfully or not. How to deal w/ it?
133 /* execute pkgadd to install the package
134 */
135 sprintf(syscmd, "/usr/sbin/pkgadd -a %s -d %s -R %s %s",
136 adminfile,pkgdir,rootdir,pkgname);
137 /*
138 * Use WEXITSTATUS to check the actual return value from
139 * the pkgadd command that is passed to "system".
140 */
141 retval = WEXITSTATUS(system(syscmd));
142 /*
143 * Exit status 0, 10 and 20 of Sun's pkgadd are all successful
144 * installation, so we want to treat them as success cases too.
145 */
146 if ( retval != 0 && retval != 10 && retval != 20 ) {
147 fprintf(stderr,"%s: pkgadd failed (retval=%d)\n",argv[0],retval);
148 exit(-1);
149 }