Changeset 3305db9


Ignore:
Timestamp:
05/06/14 08:27:11 (11 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1
Children:
eee006a
Parents:
2c5afdb
Message:

Remove all the old pc-metapkg / pbi_ bits from pc-updatemanager

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pc-updatemanager/pc-updatemanager

    r2c5afdb r3305db9  
    443443  # Clear any old summary files 
    444444  rm /root/.failed-pkgs 2>/dev/null 
    445   rm /root/.failed-meta 2>/dev/null 
    446   rm /root/.failed-pbi 2>/dev/null 
    447445  rm /root/.failed-freebsd 2>/dev/null 
    448446  rm /root/.failed-grub 2>/dev/null 
     
    474472     exit 1 
    475473  fi 
    476  
    477   # Remove all PBIs 
    478   clear 
    479   echo "Removing PBIs..." 
    480   while read line 
    481   do 
    482     pbi=`echo $line | cut -d ' ' -f 1` 
    483     user=`echo $line | cut -d ' ' -f 2` 
    484  
    485     echo "Removing: ${pbi}" 
    486     if [ "$user" != "root" ] ; then 
    487       su $user -c "pbi_icon del-desktop $pbi" >/dev/null 2>/dev/null 
    488       su $user -c "pbi_icon del-menu $pbi" >/dev/null 2>/dev/null 
    489       su $user -c "pbi_icon del-mime $pbi" >/dev/null 2>/dev/null 
    490       su $user -c "pbi_icon del-pathlnk $pbi" >/dev/null 2>/dev/null 
    491       su $user -c "pbi_delete $pbi" >/dev/null 2>/dev/null 
    492       result=$? 
    493     else 
    494       pbi_icon del-desktop $pbi >/dev/null 2>/dev/null 
    495       pbi_icon del-menu $pbi >/dev/null 2>/dev/null 
    496       pbi_icon del-mime $pbi >/dev/null 2>/dev/null 
    497       pbi_icon del-pathlnk $pbi >/dev/null 2>/dev/null 
    498       pbi_delete $pbi >/dev/null 2>/dev/null 
    499       result=$? 
    500     fi 
    501     if [ $result -ne 0 ] ; then 
    502        echo "Warning: Failed to remove: $pbi" 
    503        sleep 5 
    504     fi 
    505   done < /root/pcbsd-pbi-before-update 
    506   echo "Done!" 
    507474 
    508475  # Start the package cleanup process 
     
    668635  if [ "$SYSTYPE" = "desktop" ] ; then 
    669636    echo "Installing desktop packages..." 
    670     ${PKG_CMD} install -y pcbsd-base 
     637    ${PKG_CMD} install -y misc/pcbsd-base 
    671638    if [ $? -ne 0 ] ; then 
    672639       PKGSTATUS=1 
     
    680647  else 
    681648    echo "Installing server packages..." 
    682     ${PKG_STATIC} install -y trueos-base 
     649    ${PKG_STATIC} install -y misc/trueos-base 
    683650    if [ $? -ne 0 ] ; then 
    684651       PKGSTATUS=1 
     
    692659  fi 
    693660 
    694   # Start pbid, so that by the time meta-packages are done, we have a full index 
    695   rm /var/db/pbi/index/* 
    696   /usr/local/etc/rc.d/pbid start >/dev/null 2>/dev/null 
    697  
    698   clear 
    699   echo "Re-Installing meta-packages" 
    700   while read newmeta 
    701   do 
    702     pkgDeps="`pc-metapkgmanager pkgdeps $newmeta`" 
    703     for i in $pkgDeps 
    704     do 
    705       ${PKG_CMD} info -e ${i} 
    706       if [ $? -eq 0 ] ; then continue ; fi 
    707  
    708       ${PKG_CMD} install -y ${i} 
    709       if [ $? -ne 0 ] ; then 
    710          METASTATUS=1 
    711          echo "$newmeta" >> /root/.failed-meta 
    712          echo "Warning: Failed to re-install meta-package: $newmeta (${i})" 
    713          echo "Press ENTER to continue" 
    714          read tmp 
    715       fi 
    716     done 
    717   done < /root/pcbsd-meta-before-update 
    718  
    719661  # Now lets try re-installing any user-installed packages 
    720662  clear 
    721   echo "Re-Installing user-installed packages" 
     663  echo "Re-Installing packages" 
    722664  while read userpkg 
    723665  do 
     
    732674       echo "${userpkg}" >> /root/.failed-user-pkgs 
    733675    fi 
    734   done < /root/pcbsd-userpkgs-before-update 
     676  done < /root/pcbsd-pkg-before-update 
    735677 
    736678  cd / 
     
    738680  # Now lets do the overlay extraction (This cleans up the fake pcbsd.conf) 
    739681  pc-extractoverlay ports 
    740  
    741   # Now lets re-load any PBI files 
    742   clear 
    743   echo "Re-Installing PBIs" 
    744   while read line 
    745   do 
    746     newpbi=`echo $line | cut -d ' ' -f 1` 
    747     user=`echo $line | cut -d ' ' -f 2` 
    748     shortpbi="`echo $newpbi | rev | cut -d '-' -f 3- | rev`" 
    749  
    750     # Re-install the PBI as user or root depending on how it was installed 
    751     if [ "$user" != "root" ] ; then 
    752       su $user -c "pbi_add -r $shortpbi" 
    753       result=$? 
    754     else 
    755       pbi_add -r $shortpbi 
    756       result=$? 
    757     fi 
    758     if [ $result -ne 0 ] ; then 
    759        PBISTATUS=1 
    760        echo "$shortpbi" >> /root/.failed-pbi 
    761        echo "Warning: Failed to re-install PBI: $shortpbi" 
    762        echo "Press ENTER to continue" 
    763        read tmp 
    764     else 
    765        # Re-add menu / desktop stuff 
    766        if [ "$user" != "root" ] ; then 
    767          su $user -c "pbi_icon add-pathlnk $shortpbi" >/dev/null 2>/dev/null 
    768          su $user -c "pbi_icon add-desktop $shortpbi" >/dev/null 2>/dev/null 
    769          su $user -c "pbi_icon add-menu $shortpbi" >/dev/null 2>/dev/null 
    770          su $user -c "pbi_icon add-mime $shortpbi" >/dev/null 2>/dev/null 
    771        else 
    772          pbi_icon add-pathlnk $shortpbi >/dev/null 2>/dev/null 
    773          pbi_icon add-desktop $shortpbi >/dev/null 2>/dev/null 
    774          pbi_icon add-menu $shortpbi >/dev/null 2>/dev/null 
    775          pbi_icon add-mime $shortpbi >/dev/null 2>/dev/null 
    776        fi 
    777     fi 
    778   done < /root/pcbsd-pbi-before-update 
    779682 
    780683  # Last but not least, lets make sure to re-stamp GRUB in case any loader.conf.pcbsd modules changed 
     
    815718  fi 
    816719 
    817   if [ $METASTATUS -eq 0 ] ; then 
    818     echo "   META: All meta-packages updated successfully!" >> /root/pcbsd-update-summary 
    819   else 
    820     echo "   META: The following meta-packages failed to install:" >> /root/pcbsd-update-summary 
    821     cat /root/.failed-meta >> /root/pcbsd-update-summary 
    822   fi 
    823  
    824   if [ $PBISTATUS -eq 0 ] ; then 
    825     echo "    PBI: All PBIs updated successfully!" >> /root/pcbsd-update-summary 
    826   else 
    827     echo "    PBI: The following PBIs failed to install:" >> /root/pcbsd-update-summary 
    828     cat /root/.failed-pbi >> /root/pcbsd-update-summary 
    829   fi 
    830  
    831720  if [ $GRUBSTATUS -eq 0 ] ; then 
    832721    echo "   GRUB: The GRUB boot-loader menus re-built successfully!" >> /root/pcbsd-update-summary 
     
    839728  echo "Old system information: " >> /root/pcbsd-update-summary 
    840729  echo "/root/pcbsd-pkg-before-update" >> /root/pcbsd-update-summary 
    841   echo "/root/pcbsd-pbi-before-update" >> /root/pcbsd-update-summary 
    842   echo "/root/pcbsd-meta-before-update" >> /root/pcbsd-update-summary 
    843730 
    844731  echo "" >> /root/pcbsd-update-summary 
     
    849736  rm /root/.failed-pkgs 2>/dev/null 
    850737  rm /root/.failed-user-pkgs 2>/dev/null 
    851   rm /root/.failed-meta 2>/dev/null 
    852   rm /root/.failed-pbi 2>/dev/null 
    853738  rm /root/.failed-grub 2>/dev/null 
    854739  rm /root/.failed-freebsd 2>/dev/null 
     
    924809  fi 
    925810 
    926   # Now lets build some lists of what is present on this system now 
    927   ${PKG_CMD} info > /root/pcbsd-pkg-before-update 
    928   pbi_info > /root/pcbsd-pbi-before-update.tmp 
    929   pc-metapkgmanager list-installed > /root/pcbsd-meta-before-update 
    930  
    931   # Figure out which user had installed which PBIs and save this list 
    932   while read line 
    933   do 
    934      insBy=`pbi_info -v $line | grep "InstalledBy:" | cut -d ' ' -f 2` 
    935      if [ -z "$insBy" ] ; then 
    936         echo "Unable to get UserName for installed PBI: $line" 
    937         continue 
    938      fi 
    939      echo "$line $insBy" >> /root/pcbsd-pbi-before-update 
    940   done < /root/pcbsd-pbi-before-update.tmp 
    941   touch /root/pcbsd-pbi-before-update 
    942   rm /root/pcbsd-pbi-before-update.tmp 
    943  
    944   # Figure out a list of user-installed packages to try and re-install on the updated system 
    945   echo "Building a list of user-installed packages... Please wait..." 
    946   local mPkgFile="/tmp/.mPkgDList.$$" 
    947   local mOriginFile="/tmp/.mPkgOList.$$" 
    948   rm $mPkgFile 2>/dev/null 
    949   echo "ports-mgmt/pkg" >> ${mPkgFile} 
    950   if [ -e "/usr/local/bin/pc-softwaremanager" ] ; then 
    951      echo "pcbsd-base" >> ${mPkgFile} 
    952   else 
    953      echo "trueos-base" >> ${mPkgFile} 
    954   fi 
    955   while read mpkg 
    956   do 
    957      pc-metapkgmanager pkgdeps $mpkg >/dev/null 2>/dev/null 
    958      if [ $? -ne 0 ] ; then continue ; fi 
    959      pc-metapkgmanager pkgdeps $mpkg >> $mPkgFile 
    960   done < /root/pcbsd-meta-before-update 
    961  
    962   # Now sort out the list of depends for our meta-pkgs 
    963   while read mpkg 
    964   do 
    965      #echo "Finding package dependencies of ${mpkg}.." 
    966      pkg query '%o' $mpkg >> ${mOriginFile} 
    967      get_dep_origins "$mpkg" "$mOriginFile" 
    968   done < ${mPkgFile} 
    969   rm ${mPkgFile} 
    970  
    971   echo "Building list of user-installed packages..." 
    972   # Sort the origins file 
    973   cat ${mOriginFile} | sort | uniq > ${mOriginFile}.new 
    974   mv ${mOriginFile}.new ${mOriginFile} 
    975  
    976811  # Build a list of *all* package origins 
    977   ${PKG_CMD} query -a '%o' | sort > ${mOriginFile}.system 
    978  
    979   # Save a list of packages that the user installed from elsewhere than our meta-packages 
    980   diff ${mOriginFile} ${mOriginFile}.system | grep '>' | awk '{print $2}' > /root/pcbsd-userpkgs-before-update 
    981   rm ${mOriginFile}.system 
    982   rm ${mOriginFile} 
     812  ${PKG_CMD} query -a '%o' | grep -v "misc/pcbsd-base" \ 
     813        | grep -v "misc/trueos-base" | grep -v "ports-mgmt/pkg" \ 
     814        | sort > /root/pcbsd-pkg-before-update 
    983815 
    984816  # Now install the updated kernel 
Note: See TracChangeset for help on using the changeset viewer.