2010-07-13 23:47:12 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#-
|
|
|
|
# Copyright (c) 2010 iXsystems, Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
# Functions which runs commands on the system
|
|
|
|
|
|
|
|
. ${BACKEND}/functions.sh
|
|
|
|
. ${BACKEND}/functions-parse.sh
|
|
|
|
. ${BACKEND}/functions-ftp.sh
|
|
|
|
|
|
|
|
|
2010-08-19 06:01:25 +00:00
|
|
|
get_package_index_by_ftp()
|
2010-07-13 23:47:12 +00:00
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
local INDEX_FILE
|
|
|
|
local FTP_SERVER
|
|
|
|
|
|
|
|
FTP_SERVER="${1}"
|
|
|
|
INDEX_FILE="INDEX"
|
|
|
|
USE_BZIP2=0
|
|
|
|
|
|
|
|
if [ -f "/usr/bin/bzip2" ]
|
|
|
|
then
|
|
|
|
INDEX_FILE="${INDEX_FILE}.bz2"
|
|
|
|
USE_BZIP2=1
|
2013-03-03 23:01:46 +00:00
|
|
|
INDEX_PATH="${INDEXFILE}.bz2"
|
|
|
|
else
|
|
|
|
INDEX_PATH="${INDEXFILE}"
|
2010-08-24 06:11:46 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1"
|
|
|
|
if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ]
|
|
|
|
then
|
|
|
|
bzip2 -d "${INDEX_PATH}"
|
|
|
|
fi
|
2010-08-19 06:01:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get_package_index_by_fs()
|
|
|
|
{
|
2013-03-03 23:01:46 +00:00
|
|
|
if [ "$INSTALLMEDIUM" = "local" ] ; then
|
|
|
|
INDEXFILE="${LOCALPATH}/packages/INDEX"
|
|
|
|
else
|
|
|
|
INDEXFILE="${CDMNT}/packages/INDEX"
|
|
|
|
fi
|
2010-08-19 06:01:25 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-19 06:02:31 +00:00
|
|
|
get_package_index_size()
|
|
|
|
{
|
2013-03-03 23:01:46 +00:00
|
|
|
if [ -f "${INDEXFILE}" ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
2013-03-03 23:01:46 +00:00
|
|
|
SIZE=`ls -l ${INDEXFILE} | awk '{ print $5 }'`
|
2010-08-24 06:11:46 +00:00
|
|
|
else
|
|
|
|
get_ftp_mirror
|
|
|
|
FTPHOST="${VAL}"
|
|
|
|
|
|
|
|
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
|
|
|
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
|
|
|
|
|
|
|
fetch -s "${FTPPATH}/INDEX.bz2"
|
|
|
|
fi
|
2010-08-19 06:02:31 +00:00
|
|
|
};
|
|
|
|
|
2010-08-19 06:01:25 +00:00
|
|
|
get_package_index()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
RES=0
|
|
|
|
|
|
|
|
if [ -z "${INSTALLMODE}" ]
|
|
|
|
then
|
|
|
|
get_ftp_mirror
|
|
|
|
FTPHOST="${VAL}"
|
|
|
|
|
|
|
|
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
|
|
|
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
|
|
|
|
|
|
|
get_package_index_by_ftp "${FTPPATH}"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
case "${INSTALLMEDIUM}" in
|
2013-03-03 23:01:46 +00:00
|
|
|
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 ;;
|
2010-08-24 06:11:46 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
return ${RES}
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
|
|
|
parse_package_index()
|
|
|
|
{
|
2013-03-03 23:01:46 +00:00
|
|
|
echo_log "Building package dep list.. Please wait.."
|
2010-08-24 06:11:46 +00:00
|
|
|
INDEX_FILE="${PKGDIR}/INDEX"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
exec 3<&0
|
2013-03-03 23:01:46 +00:00
|
|
|
exec 0<"${INDEXFILE}"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
while read -r line
|
|
|
|
do
|
|
|
|
PKGNAME=""
|
|
|
|
CATEGORY=""
|
|
|
|
PACKAGE=""
|
|
|
|
DESC=""
|
|
|
|
DEPS=""
|
|
|
|
i=0
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
SAVE_IFS="${IFS}"
|
|
|
|
IFS="|"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
for part in ${line}
|
|
|
|
do
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ ${i} -eq 0 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
PKGNAME="${part}"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
elif [ ${i} -eq 1 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
PACKAGE=`basename "${part}"`
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
elif [ ${i} -eq 3 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
DESC="${part}"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
elif [ ${i} -eq 6 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
CATEGORY=`echo "${part}" | cut -f1 -d' '`
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
elif [ ${i} -eq 8 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
DEPS="${part}"
|
|
|
|
fi
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
i=$((i+1))
|
|
|
|
done
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
echo "${CATEGORY}|${PACKAGE}|${DESC}" >> "${INDEX_FILE}.parsed"
|
|
|
|
echo "${PACKAGE}|${PKGNAME}|${DEPS}" >> "${INDEX_FILE}.deps"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
IFS="${SAVE_IFS}"
|
|
|
|
done
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
exec 0<&3
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
|
|
|
show_package_file()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
PKGFILE="${1}"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
echo "Available Packages:"
|
2010-08-19 06:01:25 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
exec 3<&0
|
|
|
|
exec 0<"${PKGFILE}"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
while read -r line
|
|
|
|
do
|
|
|
|
CATEGORY=`echo "${line}" | cut -f1 -d'|'`
|
|
|
|
PACKAGE=`echo "${line}" | cut -f2 -d'|'`
|
|
|
|
DESC=`echo "${line}" | cut -f3 -d'|'`
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
echo "${CATEGORY}/${PACKAGE}:${DESC}"
|
|
|
|
done
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
exec 0<&3
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
|
|
|
show_packages_by_category()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
CATEGORY="${1}"
|
|
|
|
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
|
|
|
TMPFILE="/tmp/.pkg.cat"
|
2010-07-13 23:47:12 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
grep "^${CATEGORY}|" "${INDEX_FILE}" > "${TMPFILE}"
|
|
|
|
show_package_file "${TMPFILE}"
|
|
|
|
rm "${TMPFILE}"
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
|
|
|
show_package_by_name()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
CATEGORY="${1}"
|
|
|
|
PACKAGE="${2}"
|
|
|
|
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
|
|
|
TMPFILE="/tmp/.pkg.cat.pak"
|
|
|
|
|
|
|
|
grep "^${CATEGORY}|${PACKAGE}" "${INDEX_FILE}" > "${TMPFILE}"
|
|
|
|
show_package_file "${TMPFILE}"
|
|
|
|
rm "${TMPFILE}"
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
2010-07-13 23:47:12 +00:00
|
|
|
|
|
|
|
show_packages()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
show_package_file "${PKGDIR}/INDEX.parsed"
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get_package_dependencies()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
PACKAGE="${1}"
|
|
|
|
LONG="${2:-0}"
|
|
|
|
RES=0
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
|
|
|
REGEX="^${PACKAGE}|"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
if [ ${LONG} -ne 0 ]
|
2010-08-24 06:11:46 +00:00
|
|
|
then
|
|
|
|
REGEX="^.*|${PACKAGE}|"
|
|
|
|
fi
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
|
|
|
DEPS=`echo "${LINE}"|cut -f3 -d'|'`
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
export VAL="${DEPS}"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
if [ -z "${VAL}" ]
|
|
|
|
then
|
|
|
|
RES=1
|
|
|
|
fi
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
return ${RES}
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get_package_name()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
PACKAGE="${1}"
|
|
|
|
RES=0
|
2013-03-03 23:01:46 +00:00
|
|
|
local PKGPTH
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2013-03-03 23:01:46 +00:00
|
|
|
# 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}|"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2013-03-03 23:01:46 +00:00
|
|
|
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
|
|
|
NAME=`echo "${LINE}"|cut -f2 -d'|'`
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2013-03-03 23:01:46 +00:00
|
|
|
export VAL="${NAME}"
|
|
|
|
fi
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
if [ -z "${VAL}" ]
|
|
|
|
then
|
|
|
|
RES=1
|
|
|
|
fi
|
|
|
|
return ${RES}
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get_package_short_name()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
PACKAGE="${1}"
|
|
|
|
RES=0
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
|
|
|
REGEX="^.*|${PACKAGE}|"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
|
|
|
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
export VAL="${NAME}"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
if [ -z "${VAL}" ]
|
|
|
|
then
|
|
|
|
RES=1
|
|
|
|
fi
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
return ${RES}
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
get_package_category()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
PACKAGE="${1}"
|
|
|
|
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
|
|
|
RES=0
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
LINE=`grep "|${PACKAGE}|" "${INDEX_FILE}" 2>/dev/null`
|
|
|
|
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2011-03-27 16:57:54 +00:00
|
|
|
export VAL="${NAME}"
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
if [ -z "${VAL}" ]
|
|
|
|
then
|
|
|
|
RES=1
|
|
|
|
fi
|
2010-08-19 05:59:27 +00:00
|
|
|
|
2010-08-24 06:11:46 +00:00
|
|
|
return ${RES}
|
2010-08-19 05:59:27 +00:00
|
|
|
};
|
|
|
|
|
2010-08-19 06:01:25 +00:00
|
|
|
fetch_package_by_ftp()
|
2010-08-19 05:59:27 +00:00
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
CATEGORY="${1}"
|
|
|
|
PACKAGE="${2}"
|
|
|
|
SAVEDIR="${3}"
|
|
|
|
|
|
|
|
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}"
|
|
|
|
|
2013-03-03 23:01:46 +00:00
|
|
|
PACKAGE="${PACKAGE}.${PKGEXT}"
|
2010-08-24 06:11:46 +00:00
|
|
|
FTP_SERVER="ftp://${FTPHOST}${FTPDIR}"
|
|
|
|
|
|
|
|
if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
|
|
|
|
then
|
|
|
|
PKGPATH="${CATEGORY}/${PACKAGE}"
|
|
|
|
FTP_PATH="${FTP_HOST}/packages/${PKGPATH}"
|
|
|
|
fetch_file "${FTP_PATH}" "${SAVEDIR}/" "0"
|
|
|
|
fi
|
2010-08-19 06:01:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fetch_package()
|
|
|
|
{
|
2010-08-24 06:11:46 +00:00
|
|
|
CATEGORY="${1}"
|
|
|
|
PACKAGE="${2}"
|
|
|
|
SAVEDIR="${3}"
|
|
|
|
|
2013-03-03 23:01:46 +00:00
|
|
|
# Fetch package, but skip if installing from local media
|
2010-08-24 06:11:46 +00:00
|
|
|
case "${INSTALLMEDIUM}" in
|
2013-03-03 23:01:46 +00:00
|
|
|
usb|dvd|local) return ;;
|
2010-09-08 20:10:24 +00:00
|
|
|
ftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
|
|
|
|
sftp) ;;
|
2010-08-24 06:11:46 +00:00
|
|
|
esac
|
2010-08-19 06:01:25 +00:00
|
|
|
};
|
2013-03-03 23:01:46 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|