26c26
< # $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh 220059 2011-03-27 16:57:54Z jpaetzel $
---
> # $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh 247734 2013-03-03 23:01:46Z jpaetzel $
47a48,50
> INDEX_PATH="${INDEXFILE}.bz2"
> else
> INDEX_PATH="${INDEXFILE}"
50d52
< INDEX_PATH="${CONFDIR}/${INDEX_FILE}"
60,63c62,66
< local INDEX_FILE
<
< INDEX_FILE="${CDMNT}/packages/INDEX"
< fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0"
---
> if [ "$INSTALLMEDIUM" = "local" ] ; then
> INDEXFILE="${LOCALPATH}/packages/INDEX"
> else
> INDEXFILE="${CDMNT}/packages/INDEX"
> fi
68c71
< if [ -f "${CONFDIR}/INDEX" ]
---
> if [ -f "${INDEXFILE}" ]
70c73
< SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'`
---
> SIZE=`ls -l ${INDEXFILE} | awk '{ print $5 }'`
97,101d99
< get_value_from_cfg ftpHost
< if [ -z "$VAL" ]
< then
< exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
< fi
103,113d100
< FTPHOST="${VAL}"
<
< get_value_from_cfg ftpDir
< if [ -z "$VAL" ]
< then
< exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
< fi
<
< FTPDIR="${VAL}"
< FTPPATH="ftp://${FTPHOST}${FTPDIR}"
<
115,118c102,117
< usb|dvd) get_package_index_by_fs ;;
< ftp) get_package_index_by_ftp "${FTPPATH}" ;;
< sftp) ;;
< *) RES=1 ;;
---
> usb|dvd|local) get_package_index_by_fs ;;
> ftp) get_value_from_cfg ftpHost
> if [ -z "$VAL" ]; then
> exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
> fi
> FTPHOST="${VAL}"
>
> get_value_from_cfg ftpDir
> if [ -z "$VAL" ]; then
> exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
> fi
> FTPDIR="${VAL}"
> FTPPATH="ftp://${FTPHOST}${FTPDIR}"
> get_package_index_by_ftp "${FTPPATH}" ;;
> sftp) ;;
> *) RES=1 ;;
127a127
> echo_log "Building package dep list.. Please wait.."
131c131
< exec 0<"${INDEX_FILE}"
---
> exec 0<"${INDEXFILE}"
259a260
> local PKGPTH
261,262c262,280
< INDEX_FILE="${PKGDIR}/INDEX.deps"
< REGEX="^${PACKAGE}|"
---
> # If we are on a local medium, we can parse the Latest/ directory
> if [ "${INSTALLMEDIUM}" != "ftp" ] ; then
> case "${INSTALLMEDIUM}" in
> usb|dvd) PKGPTH="${CDMNT}/packages" ;;
> *) PKGPTH="${LOCALPATH}/packages" ;;
> esac
>
> # Check the /Latest dir for generic names, then look for specific version in All/
> if [ -e "${PKGPTH}/Latest/${PACKAGE}.${PKGEXT}" ] ; then
> NAME=`ls -al ${PKGPTH}/Latest/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
> else
> NAME=`ls -al ${PKGPTH}/All/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
> fi
> export VAL="${NAME}"
> else
> # Doing remote fetch, we we will look up, but some generic names like
> # "perl" wont work, since we don't know the default version
> INDEX_FILE="${PKGDIR}/INDEX.deps"
> REGEX="^${PACKAGE}|"
264,265c282,283
< LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
< NAME=`echo "${LINE}"|cut -f2 -d'|'`
---
> LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
> NAME=`echo "${LINE}"|cut -f2 -d'|'`
267c285,286
< export VAL="${NAME}"
---
> export VAL="${NAME}"
> fi
273d291
<
337c355
< PACKAGE="${PACKAGE}.tbz"
---
> PACKAGE="${PACKAGE}.${PKGEXT}"
348,360d365
< fetch_package_by_fs()
< {
< CATEGORY="${1}"
< PACKAGE="${2}"
< SAVEDIR="${3}"
<
< PACKAGE="${PACKAGE}.tbz"
< if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
< then
< fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0"
< fi
< };
<
366a372
> # Fetch package, but skip if installing from local media
368c374
< usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
---
> usb|dvd|local) return ;;
372a379,411
>
> bootstrap_pkgng()
> {
> # Check if we need to boot-strap pkgng
> if run_chroot_cmd "which pkg-static" >/dev/null 2>/dev/null
> then
> return
> fi
> local PKGPTH
>
> # Ok, lets boot-strap this sucker
> echo_log "Bootstraping pkgng.."
> fetch_package "Latest" "pkg" "${PKGDLDIR}"
>
> # Figure out real location of "pkg" package
> case "${INSTALLMEDIUM}" in
> usb|dvd|local) PKGPTH="${PKGTMPDIR}/Latest/pkg.${PKGEXT}" ;;
> *) PKGPTH="${PKGTMPDIR}/pkg.${PKGEXT}" ;;
> esac
> rc_halt "pkg -c ${FSMNT} add ${PKGPTH}" ; run_chroot_cmd "pkg2ng"
> }
>
> get_package_location()
> {
> case "${INSTALLMEDIUM}" in
> usb|dvd) rc_halt "mount_nullfs ${CDMNT}/packages ${FSMNT}${PKGTMPDIR}"
> PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;;
> local) rc_halt "mount_nullfs ${LOCALPATH}/packages ${FSMNT}${PKGTMPDIR}"
> PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;;
> *) PKGDLDIR="${FSMNT}${PKGTMPDIR}" ;;
> esac
> export PKGDLDIR
> }
< # $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh 220059 2011-03-27 16:57:54Z jpaetzel $
---
> # $FreeBSD: head/usr.sbin/pc-sysinstall/backend/functions-packages.sh 247734 2013-03-03 23:01:46Z jpaetzel $
47a48,50
> INDEX_PATH="${INDEXFILE}.bz2"
> else
> INDEX_PATH="${INDEXFILE}"
50d52
< INDEX_PATH="${CONFDIR}/${INDEX_FILE}"
60,63c62,66
< local INDEX_FILE
<
< INDEX_FILE="${CDMNT}/packages/INDEX"
< fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0"
---
> if [ "$INSTALLMEDIUM" = "local" ] ; then
> INDEXFILE="${LOCALPATH}/packages/INDEX"
> else
> INDEXFILE="${CDMNT}/packages/INDEX"
> fi
68c71
< if [ -f "${CONFDIR}/INDEX" ]
---
> if [ -f "${INDEXFILE}" ]
70c73
< SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'`
---
> SIZE=`ls -l ${INDEXFILE} | awk '{ print $5 }'`
97,101d99
< get_value_from_cfg ftpHost
< if [ -z "$VAL" ]
< then
< exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
< fi
103,113d100
< FTPHOST="${VAL}"
<
< get_value_from_cfg ftpDir
< if [ -z "$VAL" ]
< then
< exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
< fi
<
< FTPDIR="${VAL}"
< FTPPATH="ftp://${FTPHOST}${FTPDIR}"
<
115,118c102,117
< usb|dvd) get_package_index_by_fs ;;
< ftp) get_package_index_by_ftp "${FTPPATH}" ;;
< sftp) ;;
< *) RES=1 ;;
---
> usb|dvd|local) get_package_index_by_fs ;;
> ftp) get_value_from_cfg ftpHost
> if [ -z "$VAL" ]; then
> exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
> fi
> FTPHOST="${VAL}"
>
> get_value_from_cfg ftpDir
> if [ -z "$VAL" ]; then
> exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
> fi
> FTPDIR="${VAL}"
> FTPPATH="ftp://${FTPHOST}${FTPDIR}"
> get_package_index_by_ftp "${FTPPATH}" ;;
> sftp) ;;
> *) RES=1 ;;
127a127
> echo_log "Building package dep list.. Please wait.."
131c131
< exec 0<"${INDEX_FILE}"
---
> exec 0<"${INDEXFILE}"
259a260
> local PKGPTH
261,262c262,280
< INDEX_FILE="${PKGDIR}/INDEX.deps"
< REGEX="^${PACKAGE}|"
---
> # If we are on a local medium, we can parse the Latest/ directory
> if [ "${INSTALLMEDIUM}" != "ftp" ] ; then
> case "${INSTALLMEDIUM}" in
> usb|dvd) PKGPTH="${CDMNT}/packages" ;;
> *) PKGPTH="${LOCALPATH}/packages" ;;
> esac
>
> # Check the /Latest dir for generic names, then look for specific version in All/
> if [ -e "${PKGPTH}/Latest/${PACKAGE}.${PKGEXT}" ] ; then
> NAME=`ls -al ${PKGPTH}/Latest/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
> else
> NAME=`ls -al ${PKGPTH}/All/${PACKAGE}.${PKGEXT} 2>/dev/null | cut -d '>' -f 2 | rev | cut -f1 -d'/' | rev | tr -s ' '`
> fi
> export VAL="${NAME}"
> else
> # Doing remote fetch, we we will look up, but some generic names like
> # "perl" wont work, since we don't know the default version
> INDEX_FILE="${PKGDIR}/INDEX.deps"
> REGEX="^${PACKAGE}|"
264,265c282,283
< LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
< NAME=`echo "${LINE}"|cut -f2 -d'|'`
---
> LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
> NAME=`echo "${LINE}"|cut -f2 -d'|'`
267c285,286
< export VAL="${NAME}"
---
> export VAL="${NAME}"
> fi
273d291
<
337c355
< PACKAGE="${PACKAGE}.tbz"
---
> PACKAGE="${PACKAGE}.${PKGEXT}"
348,360d365
< fetch_package_by_fs()
< {
< CATEGORY="${1}"
< PACKAGE="${2}"
< SAVEDIR="${3}"
<
< PACKAGE="${PACKAGE}.tbz"
< if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
< then
< fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0"
< fi
< };
<
366a372
> # Fetch package, but skip if installing from local media
368c374
< usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
---
> usb|dvd|local) return ;;
372a379,411
>
> bootstrap_pkgng()
> {
> # Check if we need to boot-strap pkgng
> if run_chroot_cmd "which pkg-static" >/dev/null 2>/dev/null
> then
> return
> fi
> local PKGPTH
>
> # Ok, lets boot-strap this sucker
> echo_log "Bootstraping pkgng.."
> fetch_package "Latest" "pkg" "${PKGDLDIR}"
>
> # Figure out real location of "pkg" package
> case "${INSTALLMEDIUM}" in
> usb|dvd|local) PKGPTH="${PKGTMPDIR}/Latest/pkg.${PKGEXT}" ;;
> *) PKGPTH="${PKGTMPDIR}/pkg.${PKGEXT}" ;;
> esac
> rc_halt "pkg -c ${FSMNT} add ${PKGPTH}" ; run_chroot_cmd "pkg2ng"
> }
>
> get_package_location()
> {
> case "${INSTALLMEDIUM}" in
> usb|dvd) rc_halt "mount_nullfs ${CDMNT}/packages ${FSMNT}${PKGTMPDIR}"
> PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;;
> local) rc_halt "mount_nullfs ${LOCALPATH}/packages ${FSMNT}${PKGTMPDIR}"
> PKGDLDIR="${FSMNT}${PKGTMPDIR}/All" ;;
> *) PKGDLDIR="${FSMNT}${PKGTMPDIR}" ;;
> esac
> export PKGDLDIR
> }