[PC-BSD Commits] r21079 - pcbsd/current/src-sh/pc-updatemanager
svn at pcbsd.org
svn at pcbsd.org
Mon Jan 21 10:16:27 PST 2013
Author: kris
Date: 2013-01-21 18:16:26 +0000 (Mon, 21 Jan 2013)
New Revision: 21079
Modified:
pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
Log:
Add new feature to pc-update manager! Now it can check for updates to
system packages with pkgng, and then do the said updates if requested.
This will become our single command-line util for doing system / package
updates.
Modified: pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager
===================================================================
--- pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager 2013-01-21 17:52:08 UTC (rev 21078)
+++ pcbsd/current/src-sh/pc-updatemanager/pc-updatemanager 2013-01-21 18:16:26 UTC (rev 21079)
@@ -64,8 +64,10 @@
show_usage() {
echo "$0 - Usage
----
- check - Check for online updates
- install <tag>,<tag2> - Install tagged updates
+ check - Check for system updates
+ install <tag>,<tag2> - Install system updates
+ pkgcheck - Check for updates to packages
+ pkgupdate - Install packages updates
"
exit 1
@@ -661,6 +663,41 @@
return $?
}
+checkup_pkgs() {
+
+ # Checkout the installed pkgs and compare to master list
+ rc_halt "pkg update"
+ pkg upgrade -n >/tmp/.pkgData.$$
+ grep -q "Upgrading" /tmp/.pkgData.$$
+ if [ $? -ne 0 ] ; then
+ echo "All packages are up to date!"
+ rm /tmp/.pkgData.$$
+ return 0
+ fi
+
+ # Display the pkg update data
+ cat /tmp/.pkgData.$$
+ rm /tmp/.pkgData.$$
+ echo ""
+ echo "To start the upgrade run \"${0} pkgupdate\""
+ return 0
+}
+
+update_pkgs()
+{
+ # Start the package update!
+ pkg upgrade -y
+ result=$?
+
+ # Lets now re-extract our overlay data to grab any adjusted port files
+ pc-extractoverlay >/dev/null 2>/dev/null
+
+ if [ $result -ne 0 ] ; then
+ echo "Failed updating..."
+ fi
+ exit $result
+}
+
# Set the program location
# Start by sourcing /etc/profile
@@ -685,10 +722,12 @@
fi
case $1 in
- check) do_check ;;
- install) # First update our available list with latest from server
- ${0} check >/dev/null 2>/dev/null ;
- do_install "${2}" ;;
+ check) do_check ;;
+ pkgcheck) checkup_pkgs ;;
+ pkgupdate) update_pkgs ;;
+ install) # First update our available list with latest from server
+ ${0} check >/dev/null 2>/dev/null ;
+ do_install "${2}" ;;
*) show_usage ;;
esac
More information about the Commits
mailing list