# ================================================
APPNAME=`basename "$0"`
-MYVERSION=2.2.2+toward_2.2.3_20130119200821
+MYVERSION=2.2.2+toward_2.2.3_20130119205828
PREFIX=${PREFIX:-/usr/local}
CONFFILE=${PREFIX}/etc/${APPNAME}.conf
create_backup_pkg ()
{
- local pkgname dstdir backup_pkg
+ local pkgname dstdir pkgname_ptn backup_pkg
pkgname=$1
dstdir=$2
rm -rf "${TMPDIR}"/package.tmp
mkdir "${TMPDIR}"/package.tmp
if ( cd "${TMPDIR}"/package.tmp && pkg_create_b "$pkgname" )
then
+ pkgname_ptn=`str_escape_regexp "$pkgname"`
backup_pkg=`ls "${TMPDIR}"/package.tmp | \
- grep -m 1 -E "^`str_escape_regexp \"$pkgname\"`\.(txz|tbz|tgz|tar)$"` || :
+ grep -m 1 -E "^${pkgname_ptn}\.(txz|tbz|tgz|tar)$"` || :
fi
if [ -z "$backup_pkg" ]
then
env ${MAKE_ENVS} make config-conditional ${MAKE_ARGS}
pkg=`pkg_info_qO "$origin"`
[ -z "$pkg" ] || echo $pkg > $target_dir/installed_version
- pkg_new=`(cd "${PORTSDIR}/$origin" && env ${MAKE_ENVS} make package-name ${MAKE_ARGS})`
+ pkg_new=`env ${MAKE_ENVS} make package-name ${MAKE_ARGS}`
pkgtag=$pkg
[ -n "$pkgtag" ] || pkgtag=$pkg_new
if [ -z "$pkgtag" ]
[ "$load_pkgtoolsconf" = undef -o ! -e "${DBDIR}/COMPLETE_IMPORT_PKGTOOLS_CONF" ] || echo "WARNING: -p, -P or -Q option is specified but ignored by following the previous settings." >&2
# Check whether the temporal database is newer than the ports tree
-if [ "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
+if [ `id -u` -eq 0 -a "${PORTS_INDEX_DB}" -nt "${DBDIR}"/MYVERSION ]
then
if [ $supress_obsolete_db_clean = no ]
then
then
DBVERSION=`cat "${DBDIR}"/MYVERSION 2> /dev/null || :`
# Reserved for compatibility check
-else
+elif [ `id -u` -eq 0 ]
+then
mkdir -p "${DBDIR}"
echo ${MYVERSION} > ${DBDIR}/MYVERSION
fi
srcnode=`basename "${DBDIR}"`
savefile=`realpath "$savedir"`/${APPNAME}_`date +%Y%m%d_%H%M%S`.tar.gz
echo "Starting to save the temporal database as [$savefile]..."
- ( cd "$srcdir" && tar czf "$savefile" "$srcnode" )
+ tar czf "$savefile" -C "$srcdir" "$srcnode"
echo "Done"
exit
;;
srcdir=`dirname "${DBDIR}"`
srcnode=`basename "${DBDIR}"`
[ -d "$srcdir" ] || mkdir -p "$srcdir"
- ( cd "$srcdir" && tar xzf "$loadfile" )
+ tar xzf "$loadfile" -C "$srcdir"
echo "Done"
exit
;;