Is it possible to get input from a user during an rpm installation?
I have a script that works by itself (taking input from a user and doing actions) but when run as part of the post install of an rpm (i.e. added in the %post
section of an rpm spec) then it does not work.
Should it be possible? This is the part:
%post
import()
{
echo "Do you want to import file?"
select INPUT in "Y" "N"; do
case $INPUT in
Y ) echo "You selected to import file";break;;
N ) echo "Exiting";exit 0;break;;
esac
done
read -p "Please file path: " FILE
if [ -d "$FILE" ]; then
cp $FILE/myFile /opt/tmp/
echo "Done!"
else
echo "No File Path."
done=0
while [ $done = 0 ]
do
echo "Do you want to abort"
select INPUT in "Y" "N";
do
case $INPUT in
Y )
echo "Aborting"
done=1
break
;;
N )
echo "You selected to import"
# break
#;;
read -p "Please provide the directory : " FILE
if [ -d "$FILE" ]; then
cp $FILE/myFile /opt/tmp
echo "Done"
done=1
else
echo "Aborting."
fi
break
;;
esac
done
done
fi
}
import
exit 0
During installation it directly jumps to the aborting inside the second case statement.
Why? What am I doing wrong here?