title: How do i delete a file that is installed from post installation of a rpm and is not needed in the upgrade of it?
body: <p>Following is the first version of rpm spec  </p>
  
  <pre><code>    %post
      if [ "$1" = "1" ];
      then
          touch /usr/bin/item1.txt
          touch /usr/bin/item2.txt
          echo "i am in and this line is written from rpm 1-1"&gt;&gt;/usr/bin/item1.txt
          echo "i am in and this line is written from rpm 1-1"&gt;&gt;/usr/bin/item2.txt
      fi          
      %preun    
      if [ "$1" = "0" ];
      then
          sed -i "/i am in and this line is written from rpm 1-1 /d" /usr/bin/item1.txt
          sed -i "/i am in and this line is written from rpm 1-1 /d" /usr/bin/item2.txt
          rm -rf /usr/bin/item1.txt
          rm -rf /usr/bin/item2.txt
      fi
      if [ "$1" = "1" ];
      then
       # what should be here ?
      fi 
  </code></pre>
  
  <p>The seacond version of rpm spec is as follows   </p>
  
  <pre><code>%post
  if [ "$1" = "1" ];
  then
      touch /usr/bin/item1.txt
      echo "xyz1" &gt;&gt; /usr/bin/item1.txt
      touch /usr/bin/item3.txt
      echo "xyz3" &gt;&gt; /usr/bin/item3.txt
  fi
  
  if [ "$1" = "2" ];
  then
      # what should be here if i want to remove item2.txt file and add item3.txt
  fi
  %preun
  if [ "$1" = "0" ];
  then
  # will i have to remove all the files item1 and item 2 along with item3.txt here 
  fi
  
  if [ "$1" = "1" ];
  then
      ##
  fi
  </code></pre>
  
  <p>i want to simply remove the file item2 which is already intalled in post install script of base rpm and install item3.txt file as part of upgrade. </p>