From 7ea1076ab32613d6bb55197889fd63c7b53dfbf0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 30 Sep 2008 01:59:51 +0200 Subject: [PATCH] Do not require on install/remove commands to specify path to templates directory, or full name to template files. Now you do: $ pkgfs.sh install perl-5.10.0 Removed the item from TODO, which was suggested by milosn@freenode. --HG-- extra : convert_revision : 55e41b27a940ed7d67ade5c185cbbfeb4d82c20a --- README | 7 +++++-- pkgfs.sh | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README b/README index d76954b67f..3afd283ecc 100644 --- a/README +++ b/README @@ -20,7 +20,10 @@ If PKGFS_CONFIG_FILE is not set or specified from the command line with the Once that you read the "pkgfs.conf" file and configured it, you can start installing packages by using the command: - $ pkgfs.sh -c pkgfs.conf install templates/glib-2.18.1.tmpl + $ pkgfs.sh -c pkgfs.conf install glib-2.18.1 + +Please note that it's assumed that PKGFS_TEMPLATESDIR is properly defined +and actually contains valid template files. While installing your first package, if pkgfs couldn't find the Xstow program specified at the configuration file with PKGFS_XSTOW_CMD, the Xstow package @@ -55,7 +58,7 @@ and to unstow an already installed (stowned) package: You can also print some stuff about any template, e.g: - $ pkgfs.sh info templates/glib-2.18.1.tmpl + $ pkgfs.sh info glib-2.18.1 To list installed (stowned) packages, use this: diff --git a/pkgfs.sh b/pkgfs.sh index 80c80f6b61..3fbf242b1f 100755 --- a/pkgfs.sh +++ b/pkgfs.sh @@ -29,7 +29,6 @@ #- # # TODO -# - milosn says: "pkgfs.sh -c pkgfs.conf build glib" work # - Multiple distfiles in a package. # - Multiple URLs to download source distribution files. # - Support GNU/BSD-makefile style source distribution files. @@ -97,6 +96,9 @@ check_path() eval local orig="$1" case "$orig" in + $PKGFS_TEMPLATESDIR) + orig="$PKGFS_TEMPLATESDIR/$orig" + ;; /) ;; /*) @@ -122,13 +124,13 @@ run_file() info_tmpl() { local tmpl="$1" - if [ -z "$tmpl" -o ! -f "$tmpl" ]; then - echo -n "*** ERROR: invalid template file '$tmpl'," + if [ -z "$tmpl" -o ! -f "$PKGFS_TEMPLATESDIR/$tmpl.tmpl" ]; then + echo -n "*** ERROR: invalid template file '$tmpl'" echo ", aborting ***" exit 1 fi - run_file ${tmpl} + run_file ${PKGFS_TEMPLATESDIR}/${tmpl}.tmpl echo " pkgfs template definitions:" echo @@ -201,12 +203,18 @@ check_config_vars() exit 1 fi - if [ -z "$PKGFS_DEPSDIR" ]; then + if [ ! -d "$PKGFS_DEPSDIR" ]; then echo -n "**** ERROR: PKGFS_DEPSDIR not set in configuration " echo "file, aborting ***" exit 1 fi + if [ ! -d "$PKGFS_TEMPLATESDIR" ]; then + echo -n "*** ERROR: PKGFS_TEMPLATESDIR cannot be read" + echo ", aborting ***" + exit 1 + fi + local PKGFS_VARS="PKGFS_MASTERDIR PKGFS_DESTDIR PKGFS_BUILDDIR \ PKGFS_SRC_DISTDIR" @@ -603,7 +611,7 @@ install_dependency_tmpl() check_installed_tmpl $i [ "$?" -eq 0 ] && continue echo ">>> Installing dependency: $i" - install_tmpl "${PKGFS_TEMPLATESDIR}/${i%%-deps.db}.tmpl" + install_tmpl "${i%-deps.db}" done deps_list= @@ -678,7 +686,7 @@ check_installed_tmpl() install_tmpl() { - cur_tmpl="$1" + cur_tmpl="$PKGFS_TEMPLATESDIR/$1.tmpl" if [ -z "$cur_tmpl" -o ! -f "$cur_tmpl" ]; then echo -n "*** ERROR: invalid template file '$cur_tmpl'," echo " aborting ***"