[PC-BSD Commits] r21226 - in pcbsd/current/src-sh: pc-updatemanager port-files

svn at pcbsd.org svn at pcbsd.org
Mon Jan 28 13:55:11 PST 2013


Author: kris
Date: 2013-01-28 21:55:10 +0000 (Mon, 28 Jan 2013)
New Revision: 21226

Removed:
   pcbsd/current/src-sh/pc-updatemanager/scripts/
Modified:
   pcbsd/current/src-sh/pc-updatemanager/Makefile
   pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
   pcbsd/current/src-sh/port-files/pkg-plist
Log:

Add pc-updatemanager functionality. Now we will use freebsd-update command
when we pull down system updates, and when we change FreeBSD version



Modified: pcbsd/current/src-sh/pc-updatemanager/Makefile
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/Makefile	2013-01-28 20:36:33 UTC (rev 21225)
+++ pcbsd/current/src-sh/pc-updatemanager/Makefile	2013-01-28 21:55:10 UTC (rev 21226)
@@ -39,14 +39,6 @@
 	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/bin/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/bin/ 
 	chmod 755 /usr/local/bin/pc-updatemanager
 
-install_hscripts: first FORCE
-	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/scripts || $(MKDIR) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/
-	-$(INSTALL_DIR) scripts $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/
-
-uninstall_hscripts:  FORCE
-	-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/scripts
-	-$(DEL_DIR) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/
-
 install_conf: first FORCE
 	@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/ 
 	-$(INSTALL_DIR) conf $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager/
@@ -57,9 +49,9 @@
 	-$(DEL_DIR) $(INSTALL_ROOT)/usr/local/share/pcbsd/pc-updatemanager
 
 
-install:  install_scripts install_dochmod install_conf install_hscripts  FORCE
+install:  install_scripts install_dochmod install_conf  FORCE
 
-uninstall: uninstall_scripts uninstall_conf uninstall_hscripts  FORCE
+uninstall: uninstall_scripts uninstall_conf  FORCE
 
 FORCE:
 

Modified: pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-01-28 20:36:33 UTC (rev 21225)
+++ pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager	2013-01-28 21:55:10 UTC (rev 21226)
@@ -79,34 +79,6 @@
 	exit 1
 }
 
-get_free_mb_on_dir() 
-{
-   dfdir="$1"
-
-   if [ ! -d "$dfdir" ] ; then
-      return 1
-   fi
-   
-   # First check if this is a mount point and cycle down until we figure it out
-   while :
-   do
-     mount | grep "on ${dfdir} " >/dev/null 2>/dev/null
-     if [ $? -eq 0 ] ; then
-        partdev=`mount | grep "on ${dfdir} " | head -n 1 | cut -d ' ' -f 1` 
-        break
-     fi
-     dfdir=`dirname ${dfdir}`
-   done
-
-   free=`df -m | grep "^${partdev} " | head -n 1 | awk '{print $4}'`
-   if [ $? -ne 0 -o -z "$free" ] ; then
-      return 1
-   fi
- 
-   echo "$free"
-   return 0
-}
-
 # Run-command, don't halt if command exits with non-0
 rc_nohalt()
 {
@@ -386,282 +358,23 @@
   rc_halt "rm ${DOWNLOADDIR}/${FILENAME}"
 }
 
-# Make sure we have free space in necessary places for system upgrade
-sanity_check_disk_space()
-{
-   free=`get_free_mb_on_dir "/usr"`
-   if [ $? -eq 0 -a $(is_num "$free") ] ; then
-     #echo "Free Space on /usr: $free"
-     if [ $free -lt 2000 ] ; then
-       exit_err "Less than 2GB free on /usr, please clear some additional space to continue!"
-     fi
-   else
-     exit_err "Could not determine free space on /usr"
-   fi
+start_major_fbsd_update() {
+  local rel=`echo $1 | sed 's|fbsd-||g'`
 
-   free=`get_free_mb_on_dir "/"`
-   if [ $? -eq 0 -a $(is_num "$free") ] ; then
-     #echo "Free Space on /: $free"
-     if [ $free -lt 1000 ] ; then
-       exit_err "Less than 1GB free on /, please clear some additional space to continue!"
-     fi
-   else
-     exit_err "Could not determine free space on /"
-   fi
+  # Download update files from freebsd-update
+  freebsd-update -r "$rel" upgrade
+  if [ $? -ne 0 ] ; then
+     exit_err "Failed running \"freebsd-update -r $rel upgrade\"..."
+  fi
 
-   free=`get_free_mb_on_dir "/boot"`
-   if [ $? -eq 0 -a $(is_num "$free") ] ; then
-     #echo "Free Space on /boot: $free"
-     if [ $free -lt 512 ] ; then
-       exit_err "Less than 512MB free on /boot, please clear some additional space to continue!"
-     fi
-   else
-     exit_err "Could not determine free space on /boot"
-   fi
+  # Now install files
+  freebsd-update install
+  if [ $? -ne 0 ] ; then
+     exit_err "Failed running \"freebsd-update install\"..."
+  fi
 
-   free=`get_free_mb_on_dir "/usr/local"`
-   if [ $? -eq 0 -a $(is_num "$free") ] ; then
-     #echo "Free Space on /usr/local: $free"
-     if [ $free -lt 6000 ] ; then
-       exit_err "Less than 6GB free on /usr/local, please clear some additional space to continue!"
-     fi
-   else
-     exit_err "Could not determine free space on /usr/local"
-   fi
-
 }
 
-start_major_update() {
- 	up="`echo $1 | sed 's|release-||g'`"
-
-	# Make sure we have disk space enough to do the upgrade
-	sanity_check_disk_space
-
-	# Create the stage directory for this update
- 	STAGEDIR="${DOWNLOADDIR}/${up}" 
-	if [ ! -e "${STAGEDIR}" ] ; then
-	  mkdir -p ${STAGEDIR}
-	fi
-	
-	# Save the upgrade version
-	echo "$up" > ${STAGEDIR}/sys-ver
-
-	# Do the download portion now
-	download_major_update
-
-	# Start staging the files for updating
-	stage_files_major_update
-
-	# Notify User
-  	if [ -z "$PCFETCHGUI" ] ; then
-          echo "The system update downloaded successfully!"
-          echo ""
-          echo "Please reboot your system to begin the upgrade process."
-	
-	else
-          echo "READYREBOOT"
-	fi
-
-}
-
-stage_files_major_update() {
-	# First confirm we have some critical files
-	if [ ! -e "${STAGEDIR}/xtra-data/upgrade-excludes" ] ; then
-	  exit_err "Missing upgrade-excludes!"
-	fi
-	if [ ! -e "${STAGEDIR}/xtra-data/upgrade-merges" ] ; then
-	  exit_err "Missing upgrade-merges!"
-	fi
-
-  	if [ ! -z "$PCFETCHGUI" ] ; then
-          echo "DONEDOWNLOAD"
-        fi
-
-	# Remove comments from the files
-	cat ${STAGEDIR}/xtra-data/upgrade-excludes | grep -v "^#" > ${STAGEDIR}/xtra-data/upgrade-excludes.new
-	mv ${STAGEDIR}/xtra-data/upgrade-excludes.new ${STAGEDIR}/xtra-data/upgrade-excludes
-	cat ${STAGEDIR}/xtra-data/upgrade-merges | grep -v "^#" > ${STAGEDIR}/xtra-data/upgrade-merges.new
-	mv ${STAGEDIR}/xtra-data/upgrade-merges.new ${STAGEDIR}/xtra-data/upgrade-merges
-
-	# Check if we have a master system file listing and save it
-	if [ -e "/var/db/pc-metapkgmanager/pkgsets/pcbsd/system-file.list" ] 
-	then
-	  cp /var/db/pc-metapkgmanager/pkgsets/pcbsd/system-file.list ${STAGEDIR}/xtra-data/system-file.list.old
-	fi
-
-        # Rename the stagedir
-	if [ -e "$MUSTAGEDIR" ] ; then rm -rf "$MUSTAGEDIR" ; fi
-	rc_halt "mv ${STAGEDIR} ${MUSTAGEDIR}"
-	STAGEDIR="$MUSTAGEDIR"
-	
-	# Copy over the rc scripts
-	if [ ! -e "/etc/rc.backup" ] ; then
-	  rc_halt "cp /etc/rc /etc/rc.backup"
-	fi
-	rc_halt "cp ${PROGDIR}/scripts/mu-rc /etc/rc"
-
-	# Copy over the update scripts
-	rc_halt "cp ${PROGDIR}/scripts/mu-stage1 ${STAGEDIR}/doupdate.sh"
-	rc_halt "cp ${PROGDIR}/scripts/mu-rc ${STAGEDIR}/"
-	rc_halt "cp ${PROGDIR}/scripts/mu-stage1 ${STAGEDIR}/"
-	rc_halt "cp ${PROGDIR}/scripts/mu-stage2 ${STAGEDIR}/"
-}
-
-download_major_update() {
-
-	# Set the mirror location for this major update
-	MIRRORDIR="${MIRRORURL}/${up}/`uname -m`/netinstall"
-        MIRRORDIR="`echo ${MIRRORDIR} | sed -e 's|://|:::|g' | sed -e 's|//|/|g' | sed -e 's|:::|://|g'`"       
-	echo "STARTINGUPDATE: $up"
-
-	# Download the files in dList
-  	if [ -z "$PCFETCHGUI" ] ; then
-          echo "Downloading Master Files..."
-	else
-          echo "MASTERFILECOUNT: 5"
-	fi
-	dList="PCBSD.txz PCBSD.txz.count PCBSD.txz.md5 xtra-data.txz xtra-data.txz.md5"
-	for dFile in $dList
-	do
-
-	  # See if we have the file already
-	  if [ -e "${STAGEDIR}/${dFile}" -a -e "${STAGEDIR}/${dFile}.md5" ] ; then
-	    # File checksum is good, we can skip
-	    if [ "`md5 -q ${STAGEDIR}/$dFile`" = "`cat ${STAGEDIR}/${dFile}.md5`" ] ; then
-	      continue
-	    fi
-	  fi
-
-	  # Download the file
-	  get_file "${MIRRORDIR}/$dFile" "${STAGEDIR}/$dFile" 3
-	  if [ $? -ne 0 ] ; then
-	    rm ${STAGEDIR}/$dFile >/dev/null 2>/dev/null
-            echo "FAILED: ${up}" >${TRIGGERFILE}
-            exit_err "Failed to download: ${MIRRORDIR}/${dFile}"
-	  fi
-	done
-
-	# Verify the md5 sums of .txz files
-	mList="PCBSD.txz xtra-data.txz"
-	for dFile in $mList
-	do
-	  echo "$dFile" | grep "\.txz" >/dev/null 2>/dev/null
-	  if [ $? -ne 0 ] ; then continue ; fi
-	  if [ "`md5 -q ${STAGEDIR}/$dFile`" != "`cat ${STAGEDIR}/${dFile}.md5`" ] ; then
-	    exit_err "File $dFile failed the checksum"
-	  fi
-	done
-
-	# Extract xtra-data
-	cd ${STAGEDIR}
-	mkdir xtra-data >/dev/null 2>/dev/null
-	cd xtra-data
-	tar xvjf "${STAGEDIR}/xtra-data.txz" >/dev/null 2>/dev/null
-	if [ $? -ne 0 ] ; then
-	  exit_err "Failed reading xtra-data for update"
-	fi
-
-	# Get list of pkgs we need to fetch
-	generate_pkg_fetch_list "$STAGEDIR"
-
-  	if [ -z "$PCFETCHGUI" ] ; then
-          echo "Downloading Packages..."
-	else
-          echo "PKGFILECOUNT: $DLPKGCOUNT"
-	fi
-	mkdir "${STAGEDIR}/packages" >/dev/null 2>/dev/null
-	for dFile in $DLPKGLIST
-	do
-	  # See if we have the file already
-	  if [ -e "${STAGEDIR}/packages/${dFile}.txz" -a -e "${STAGEDIR}/packages/${dFile}.txz.sha256" ] ; then
-	    # File checksum is good, we can skip
-	    if [ "`sha256 -q ${STAGEDIR}/packages/${dFile}.txz`" = "`cat ${STAGEDIR}/packages/${dFile}.txz.sha256`" ] ; then
-  	      if [ ! -z "$PCFETCHGUI" ] ; then
-	        echo "FETCH: ${STAGEDIR}/packages/$dFile OK"
-	        echo "FETCH: ${STAGEDIR}/packages/${dFile}.sha256 OK"
-              fi
-	      continue
-	    fi
-	  fi
-
-	  # Download the file
-	  get_file "${MIRRORDIR}/metapackages/${PKGSET}/packages/${dFile}.txz" "${STAGEDIR}/packages/${dFile}.txz" 3
- 	  if [ $? -ne 0 ] ; then
-             echo "FAILED: ${dFile}.txz" >${TRIGGERFILE}
-             exit_err "Failed to download: ${STAGEDIR}/packages/${dFile}.txz"
- 	  fi
-
-	  # Download the sha256 file
-	  get_file "${MIRRORDIR}/metapackages/${PKGSET}/packages/${dFile}.txz.sha256" "${STAGEDIR}/packages/${dFile}.txz.sha256" 3
- 	  if [ $? -ne 0 ] ; then
-             echo "FAILED: ${dFile}.txz.sha256" >${TRIGGERFILE}
-             exit_err "Failed to download: ${STAGEDIR}/packages/${dFile}.txz.sha256"
- 	  fi
-
-	  # Confirm the sha256
-	  if [ "`sha256 -q ${STAGEDIR}/packages/${dFile}.txz`" !=  "`cat ${STAGEDIR}/packages/${dFile}.txz.sha256`" ] ; then
-            echo "FAILED: ${dFile}.txz" >${TRIGGERFILE}
-            exit_err "Checksum failed for: ${STAGEDIR}/packages/${dFile}.txz"
-	  fi
-	done
-
-}
-
-generate_pkg_fetch_list() {
-	local STAGEDIR="$1"
-	hNV="NO"
-  	
- 	# First get a list of meta-pkgs that are installed
-	local mIns="base-system"
-	pc-metapkgmanager list | grep "^Meta Package:" | sed 's|Meta Package: ||g' | grep -v "base-system" >${STAGEDIR}/.mPkgs.$$
-	while read mL
-	do
-	  pc-metapkgmanager status "$mL" 2>/dev/null | grep "is installed" >/dev/null 2>/dev/null	
-	  if [ $? -eq 0 ] ; then
-	    if [ "$mL" = "NVIDIA" ]; then hNV="YES" ; fi
-	    mIns="$mIns $mL"
-	  fi
-
-	done < ${STAGEDIR}/.mPkgs.$$
-	rm ${STAGEDIR}/.mPkgs.$$
-
-	# Check if we have different nvidia version installed
-	if [ "$hNV" = "NO" -a -e "/boot/modules/nvidia.ko" ] ; then
-	    mIns="$mIns NVIDIA"
-	fi
-
-	XPKGSET="${PKGSET}"
-	if [ ! -d "${STAGEDIR}/xtra-data/${PKGSET}" ] ; then
-	   if [ -e "${STAGEDIR}/xtra-data/base-ports" ] ; then
-	      XPKGSET="base-ports"
-	   else
-              exit_err "Cannot locate meta-data information!"
-	   fi
-	fi
-
-	# Now get a list of pkgs these meta-pkgs require
-        DLPKGLIST=""
-	for mP in $mIns
-	do
-	  if [ ! -e "${STAGEDIR}/xtra-data/${XPKGSET}/$mP/full-pkg-list" ] ; then
-	    continue;
-	  fi
-	  cat "${STAGEDIR}/xtra-data/${XPKGSET}/$mP/full-pkg-list" >> ${STAGEDIR}/.pList.$$
-	done
-	
-	sort ${STAGEDIR}/.pList.$$ | uniq > ${STAGEDIR}/.pList2.$$
-	mv ${STAGEDIR}/.pList2.$$ ${STAGEDIR}/.pList.$$
-
-        DLPKGCOUNT=0
-	while read pL
-	do
-          DLPKGLIST="$DLPKGLIST ${pL}"
-          DLPKGCOUNT="`expr $DLPKGCOUNT + 1`"
-	done < ${STAGEDIR}/.pList.$$
-	rm ${STAGEDIR}/.pList.$$
-	  
-}
-
 do_install() {
         # Make sure we are root and have specified updates to install
 	if [ `id -u` != "0" ] ; then exit_err "Must be run as root!" ; fi

Modified: pcbsd/current/src-sh/port-files/pkg-plist
===================================================================
--- pcbsd/current/src-sh/port-files/pkg-plist	2013-01-28 20:36:33 UTC (rev 21225)
+++ pcbsd/current/src-sh/port-files/pkg-plist	2013-01-28 21:55:10 UTC (rev 21226)
@@ -115,9 +115,6 @@
 share/pcbsd/de-profiles/kde.profile
 share/pcbsd/de-profiles/gnome.profile
 share/pcbsd/de-profiles/xfce.profile
-share/pcbsd/pc-updatemanager/scripts/mu-rc
-share/pcbsd/pc-updatemanager/scripts/mu-stage2
-share/pcbsd/pc-updatemanager/scripts/mu-stage1
 share/pcbsd/pc-updatemanager/conf/sysupdate.conf
 share/pcbsd/pc-updatemanager/conf/security.key
 share/pcbsd/metaconf/prune-files
@@ -228,7 +225,6 @@
 @dirrm share/pcbsd/pc-thinclient
 @dirrm share/pcbsd/de-profiles
 @dirrm share/pcbsd/pc-updatemanager/conf
- at dirrm share/pcbsd/pc-updatemanager/scripts
 @dirrm share/pcbsd/pc-updatemanager
 @dirrm share/pcbsd/pc-xdgutil
 @dirrm share/pcbsd/metaconf



More information about the Commits mailing list