Skip to content
This repository
Browse code

Improve pc-sysinstall for pkgng 1.2.x, when doing installations from

local media, we can avoid doing a "pkg install", since it does unnecessary
steps of copying the media from DVD -> DISK -> INSTALL. Instead we will
do a 'pkg rquery' to get the filename of the requested package, and
install it with 'pkg add' which will stream from the DVD/USB directly.
  • Loading branch information...
commit bdf4cac226140796d2a590ef97da3a539d1a1a82 1 parent 48087a0
Kris Moore authored December 10, 2013
22  src-sh/pc-sysinstall/backend/functions-installpackages.sh
@@ -61,6 +61,13 @@ install_packages()
61 61
   # Install PKGNG into the chroot
62 62
   bootstrap_pkgng
63 63
 
  64
+  # Update the repo database
  65
+  echo "Updating pkgng database"
  66
+  case "${INSTALLMEDIUM}" in
  67
+    usb|dvd|local) run_chroot_cmd "pkg -R /mnt/repo-installer update -f" ;;
  68
+                *) run_chroot_cmd "pkg update -f" ;;
  69
+  esac
  70
+
64 71
   # Lets start by cleaning up the string and getting it ready to parse
65 72
   get_value_from_cfg_with_spaces installPackages
66 73
   PACKAGES="${VAL}"
@@ -71,7 +78,20 @@ install_packages()
71 78
 
72 79
     # When doing a pkg install, if on local media, use a pkg.conf from /dist/
73 80
     if [ "${INSTALLMEDIUM}" != "ftp" ] ; then
74  
-      PKGADD="pkg -R /mnt/repo-installer install -y ${PKGNAME}"
  81
+      # Get the package file-name
  82
+      PKGFILENAME=""
  83
+      PKGFILENAME=`chroot ${FSMNT} pkg -R /mnt/repo-installer rquery '%n-%v' ${PKGNAME}`
  84
+      if [ -z "$PKGFILENAME" ] ; then
  85
+         echo_log "Warning: No such package in repo: ${PKGNAME}"
  86
+	 sleep 2
  87
+         continue
  88
+      fi
  89
+      if [ ! -e "${FSMNT}/mnt/All/${PKGFILENAME}.txz" ] ; then
  90
+         echo_log "Warning: No such package file in repo: ${PKGFILENAME}"
  91
+	 sleep 2
  92
+         continue
  93
+      fi
  94
+      PKGADD="pkg add /mnt/All/${PKGFILENAME}.txz"
75 95
     else
76 96
       # Doing a network install, use the default pkg.conf
77 97
       PKGADD="pkg install -y ${PKGNAME}"

0 notes on commit bdf4cac

Please sign in to comment.
Something went wrong with that request. Please try again.