Shao-Hua, RPM's are not interactive. Don't put something in the scripts which requires user interaction. Cheers, Kurt On Fri, Mar 04, 2011 at 04:24:19AM +0000, Yang, Shao-Hua (Yang shaohua,HPSW-BTO-R&D-SH) wrote: > How to get running path in %pre script? > > I have a spec like the below: > > %define installPath /opt/discagnt > %define certFileName demo.cert > ......... > %pre echo "starting to install.." > if [ -f ${"PWD"}/%cert_file ] > then > echo "The cert file exists!" > else > echo "please input the path for cert file : " > exec 6<&0 0</dev/tty > read cert_path > exec 0<&6 6<&- > if [ -f $cert_path/% ] > then > echo "The specified file $cert_path/%cert_file exists" > cp $cert_path/%cert_file %installPath > else > echo "The specified file $cert_path/%cert_file doesn't exist!" > exit 1 > fi > fi > > for example, if I run rpm like: > > #pwd /tmp > #ls test.cert test.rmp > #rpm -i test.rmp > please input the path for cert file : > > So, obviously, the script in %pre cann't locate the test.cert, I did some test, I found ${"PWD"} is / rather than /tmp > I want to get the current path ( /tmp) which the test.rmp located, Can somebody help me out about this issue? > > thanks in advance! _______________________________________________ Rpm-list mailing list Rpm-list@xxxxxxxxxxxxx http://lists.rpm.org/mailman/listinfo/rpm-list