Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

No, you cannot have interactive postinstall scripts in RPMs. This is deliberate.

Many times RPMs are installed on an unattended system. If the install were to hang until someone came along, it could be stuck there for ages.

share|improve this answer
    
You mean it is not technically possible? –  Jim Apr 5 '12 at 11:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.