How to get running path in %pre script?

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

 



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

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux