From 6078567275c0323da59496163285b5093ff4f0f3 Mon Sep 17 00:00:00 2001 From: jlam Date: Mon, 8 Sep 2003 04:49:05 +0000 Subject: Substitute for various program paths used by the linkfarm(1) and pkg_view(1) shell scripts. --- pkgtools/pkg_install/files/configure | 567 ++++++++++++++++++++++++- pkgtools/pkg_install/files/configure.ac | 19 +- pkgtools/pkg_install/files/view/linkfarm.sh | 221 ---------- pkgtools/pkg_install/files/view/linkfarm.sh.in | 225 ++++++++++ pkgtools/pkg_install/files/view/pkg_view.sh | 268 ------------ pkgtools/pkg_install/files/view/pkg_view.sh.in | 272 ++++++++++++ 6 files changed, 1080 insertions(+), 492 deletions(-) delete mode 100644 pkgtools/pkg_install/files/view/linkfarm.sh create mode 100644 pkgtools/pkg_install/files/view/linkfarm.sh.in delete mode 100644 pkgtools/pkg_install/files/view/pkg_view.sh create mode 100644 pkgtools/pkg_install/files/view/pkg_view.sh.in (limited to 'pkgtools/pkg_install') diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure index 9d64f03efac..249dab130a2 100755 --- a/pkgtools/pkg_install/files/configure +++ b/pkgtools/pkg_install/files/configure @@ -310,7 +310,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CANONICAL_HOST INCLUDES SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S RANLIB ac_ct_RANLIB AR AUTOCONF AUTOHEADER pkgdbdir CPP EGREP LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CANONICAL_HOST INCLUDES SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S RANLIB ac_ct_RANLIB AR CHMOD CMP CP ENV FIND GREP LN MKDIR PAX RMDIR RM SED SORT TOUCH AUTOCONF AUTOHEADER pkgdbdir CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -2464,6 +2464,553 @@ echo "${ECHO_T}no" >&6 fi +# Extract the first word of "chmod", so it can be a program name with args. +set dummy chmod; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_CHMOD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CHMOD in + [\\/]* | ?:[\\/]*) + ac_cv_path_CHMOD="$CHMOD" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CHMOD="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +CHMOD=$ac_cv_path_CHMOD + +if test -n "$CHMOD"; then + echo "$as_me:$LINENO: result: $CHMOD" >&5 +echo "${ECHO_T}$CHMOD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "cmp", so it can be a program name with args. +set dummy cmp; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_CMP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CMP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CMP="$CMP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CMP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +CMP=$ac_cv_path_CMP + +if test -n "$CMP"; then + echo "$as_me:$LINENO: result: $CMP" >&5 +echo "${ECHO_T}$CMP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_CP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $CP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +CP=$ac_cv_path_CP + +if test -n "$CP"; then + echo "$as_me:$LINENO: result: $CP" >&5 +echo "${ECHO_T}$CP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "env", so it can be a program name with args. +set dummy env; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ENV+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ENV in + [\\/]* | ?:[\\/]*) + ac_cv_path_ENV="$ENV" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ENV="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +ENV=$ac_cv_path_ENV + +if test -n "$ENV"; then + echo "$as_me:$LINENO: result: $ENV" >&5 +echo "${ECHO_T}$ENV" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "find", so it can be a program name with args. +set dummy find; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_FIND+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FIND in + [\\/]* | ?:[\\/]*) + ac_cv_path_FIND="$FIND" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +FIND=$ac_cv_path_FIND + +if test -n "$FIND"; then + echo "$as_me:$LINENO: result: $FIND" >&5 +echo "${ECHO_T}$FIND" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "grep", so it can be a program name with args. +set dummy grep; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GREP="$GREP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +GREP=$ac_cv_path_GREP + +if test -n "$GREP"; then + echo "$as_me:$LINENO: result: $GREP" >&5 +echo "${ECHO_T}$GREP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "ln", so it can be a program name with args. +set dummy ln; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_LN+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LN in + [\\/]* | ?:[\\/]*) + ac_cv_path_LN="$LN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +LN=$ac_cv_path_LN + +if test -n "$LN"; then + echo "$as_me:$LINENO: result: $LN" >&5 +echo "${ECHO_T}$LN" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "mkdir", so it can be a program name with args. +set dummy mkdir; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MKDIR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MKDIR in + [\\/]* | ?:[\\/]*) + ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +MKDIR=$ac_cv_path_MKDIR + +if test -n "$MKDIR"; then + echo "$as_me:$LINENO: result: $MKDIR" >&5 +echo "${ECHO_T}$MKDIR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "pax", so it can be a program name with args. +set dummy pax; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PAX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PAX in + [\\/]* | ?:[\\/]*) + ac_cv_path_PAX="$PAX" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PAX="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +PAX=$ac_cv_path_PAX + +if test -n "$PAX"; then + echo "$as_me:$LINENO: result: $PAX" >&5 +echo "${ECHO_T}$PAX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "rmdir", so it can be a program name with args. +set dummy rmdir; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_RMDIR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $RMDIR in + [\\/]* | ?:[\\/]*) + ac_cv_path_RMDIR="$RMDIR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_RMDIR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +RMDIR=$ac_cv_path_RMDIR + +if test -n "$RMDIR"; then + echo "$as_me:$LINENO: result: $RMDIR" >&5 +echo "${ECHO_T}$RMDIR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_RM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $RM in + [\\/]* | ?:[\\/]*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +RM=$ac_cv_path_RM + +if test -n "$RM"; then + echo "$as_me:$LINENO: result: $RM" >&5 +echo "${ECHO_T}$RM" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +SED=$ac_cv_path_SED + +if test -n "$SED"; then + echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "sort", so it can be a program name with args. +set dummy sort; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_SORT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $SORT in + [\\/]* | ?:[\\/]*) + ac_cv_path_SORT="$SORT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SORT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +SORT=$ac_cv_path_SORT + +if test -n "$SORT"; then + echo "$as_me:$LINENO: result: $SORT" >&5 +echo "${ECHO_T}$SORT" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# Extract the first word of "touch", so it can be a program name with args. +set dummy touch; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_TOUCH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $TOUCH in + [\\/]* | ?:[\\/]*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_TOUCH="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + ;; +esac +fi +TOUCH=$ac_cv_path_TOUCH + +if test -n "$TOUCH"; then + echo "$as_me:$LINENO: result: $TOUCH" >&5 +echo "${ECHO_T}$TOUCH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"} AUTOHEADER=${AUTOHEADER-"$srcdir/missing --run autoheader"} @@ -3733,7 +4280,7 @@ done - ac_config_files="$ac_config_files Makefile add/Makefile admin/Makefile create/Makefile delete/Makefile info/Makefile lib/Makefile view/Makefile" + ac_config_files="$ac_config_files Makefile add/Makefile admin/Makefile create/Makefile delete/Makefile info/Makefile lib/Makefile view/Makefile view/linkfarm.sh view/pkg_view.sh" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4267,6 +4814,8 @@ do "info/Makefile" ) CONFIG_FILES="$CONFIG_FILES info/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "view/Makefile" ) CONFIG_FILES="$CONFIG_FILES view/Makefile" ;; + "view/linkfarm.sh" ) CONFIG_FILES="$CONFIG_FILES view/linkfarm.sh" ;; + "view/pkg_view.sh" ) CONFIG_FILES="$CONFIG_FILES view/pkg_view.sh" ;; "lib/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS lib/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -4377,6 +4926,20 @@ s,@LN_S@,$LN_S,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@AR@,$AR,;t t +s,@CHMOD@,$CHMOD,;t t +s,@CMP@,$CMP,;t t +s,@CP@,$CP,;t t +s,@ENV@,$ENV,;t t +s,@FIND@,$FIND,;t t +s,@GREP@,$GREP,;t t +s,@LN@,$LN,;t t +s,@MKDIR@,$MKDIR,;t t +s,@PAX@,$PAX,;t t +s,@RMDIR@,$RMDIR,;t t +s,@RM@,$RM,;t t +s,@SED@,$SED,;t t +s,@SORT@,$SORT,;t t +s,@TOUCH@,$TOUCH,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@pkgdbdir@,$pkgdbdir,;t t diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac index 22cc2bcfdb3..49cc2b96f21 100644 --- a/pkgtools/pkg_install/files/configure.ac +++ b/pkgtools/pkg_install/files/configure.ac @@ -17,6 +17,21 @@ AC_PROG_LN_S AC_PROG_RANLIB AC_CHECK_PROG(AR, ar, ar) +AC_PATH_PROG(CHMOD, chmod) +AC_PATH_PROG(CMP, cmp) +AC_PATH_PROG(CP, cp) +AC_PATH_PROG(ENV, env) +AC_PATH_PROG(FIND, find) +AC_PATH_PROG(GREP, grep) +AC_PATH_PROG(LN, ln) +AC_PATH_PROG(MKDIR, mkdir) +AC_PATH_PROG(PAX, pax) +AC_PATH_PROG(RMDIR, rmdir) +AC_PATH_PROG(RM, rm) +AC_PATH_PROG(SED, sed) +AC_PATH_PROG(SORT, sort) +AC_PATH_PROG(TOUCH, touch) + AUTOCONF=${AUTOCONF-"$srcdir/missing --run autoconf"} AC_SUBST(AUTOCONF) AUTOHEADER=${AUTOHEADER-"$srcdir/missing --run autoheader"} @@ -49,5 +64,7 @@ AH_BOTTOM( #endif ) -AC_CONFIG_FILES([Makefile add/Makefile admin/Makefile create/Makefile delete/Makefile info/Makefile lib/Makefile view/Makefile]) +AC_CONFIG_FILES([Makefile add/Makefile admin/Makefile create/Makefile \ + delete/Makefile info/Makefile lib/Makefile view/Makefile \ + view/linkfarm.sh view/pkg_view.sh]) AC_OUTPUT diff --git a/pkgtools/pkg_install/files/view/linkfarm.sh b/pkgtools/pkg_install/files/view/linkfarm.sh deleted file mode 100644 index c6df11ce7d7..00000000000 --- a/pkgtools/pkg_install/files/view/linkfarm.sh +++ /dev/null @@ -1,221 +0,0 @@ -#! /bin/sh - -# $NetBSD: linkfarm.sh,v 1.1 2003/09/01 16:27:16 jlam Exp $ - -# -# Copyright (c) 2002 Alistair G. Crooks. 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. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Alistair G. Crooks. -# 4. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - -# set -x - -# set up program definitions -findprog=/usr/bin/find -grepprog=/usr/bin/grep -lnprog=/bin/ln -mkdirprog=/bin/mkdir -pkginfoprog=/usr/sbin/pkg_info -rmprog=/bin/rm -rmdirprog=/bin/rmdir -sedprog=/usr/bin/sed -sortprog=/usr/bin/sort - -usage() { - echo 'Usage: linkfarm [options] package' - exit 1 -} - -version() { - $pkginfoprog -V - exit 0 -} - -checkdir() { - if [ ! -d "$1" ]; then - echo "linkfarm: \`$1' doesn't exist" - exit 1 - fi -} - -ignorefiles=${PLIST_IGNORE_FILES:-"info/dir *[~#] *.OLD *.orig *,v"} -linktype=-s - -# default action: create a linkfarm in $target from $stowdir/$1 -# i.e. linkfarm --target=${prefix}/${view} --dir=${prefix}/packages $1 -# -doit="" -target=${LOCALBASE:-/usr/pkg} -stowdir=${target}/packages -subdir="" -verbose=0 - -# default action is to create -check=no -delete=no -create=yes - -# process args - can't use getopt(1) because of '--' style args -while [ $# -gt 0 ]; do - case "$1" in - -D) delete=yes; create=no ;; - -R) delete=yes; create=yes ;; - -V) version ;; - -c) check=yes; doit=":" ;; - -d) stowdir=$2; shift ;; - -d*) stowdir=`echo $1 | $sedprog -e 's|-d||'` ;; - -s) subdir=$2; shift ;; - -s*) subdir=`echo $1 | $sedprog -e 's|-s||'` ;; - -t) target=$2; shift ;; - -t*) target=`echo $1 | $sedprog -e 's|-t||'` ;; - -n) doit=":" ;; - -v) verbose=`expr $verbose + 1` ;; - - --delete) delete=yes; create=no ;; - --dir=*) stowdir=`echo $1 | $sedprog -e 's|--dir=||'` ;; - --restow) delete=yes; create=yes ;; - --subdir=*) subdir=`echo $1 | $sedprog -e 's|--subdir=||'` ;; - --target=*) target=`echo $1 | $sedprog -e 's|--target=||'` ;; - --version) version ;; - - --) shift; break ;; - *) break ;; - esac - shift -done - -# set the package name -package=$1 - -# make sure stowdir has a full pathname -case $stowdir in -/*) ;; -*) stowdir=`pwd`/$stowdir ;; -esac - -# Set the directory from which we symlink. -case $subdir in -"") fromdir=$stowdir/$package ;; -*) fromdir=$stowdir/$package/$subdir ;; -esac - -# Set the directory to which we symlink. -case $target in -/*) todir=$target ;; -*) todir=`pwd`/$target ;; -esac - -# if we're checking the entries, check, then exit -case $check in -yes) - checkdir $fromdir - (cd $fromdir; - ex=0; - for f in `$findprog . ! -type d -print`; do - newf=`echo $f | $sedprog -e 's|^\./||'` - if [ -e $todir/$newf ]; then - ignore=no - for i in $ignorefiles; do - case $newf in - $i) ignore=yes; break ;; - esac - done - case $ignore in - no) - echo "${newf}"; ex=1 ;; - esac - fi - done - exit $ex) || exit 1 - ;; -esac - -# if we need to get rid of old linkfarms, do it -case $delete in -yes) - checkdir $fromdir - (cd $fromdir; - for f in `$findprog . ! -type d -print`; do - newf=`echo $f | $sedprog -e 's|^\./||'` - ignore=no - for i in $ignorefiles; do - case $newf in - $i) ignore=yes; break ;; - esac - done - case $ignore in - no) - if [ $verbose -gt 0 ]; then - echo "$rmprog $todir/$newf" - fi - $doit $rmprog $todir/$f ;; - esac - done - for d in `$findprog . -type d -print | $sortprog -r`; do - if [ $verbose -gt 0 ]; then - echo "$rmdirprog $todir/$d" - fi - $doit $rmdirprog $todir/$d > /dev/null 2>&1 - done) - ;; -esac - -# if we need to create new linkfarms, do it -case $create in -yes) - checkdir $fromdir - (cd $fromdir; - for d in `$findprog . -type d -print`; do - newd=`echo $d | $sedprog -e 's|^\./||'` - case "$d" in - "") continue ;; - esac - if [ $verbose -gt 0 ]; then - echo "$mkdirprog -p $todir/$newd" - fi - $doit $mkdirprog -p $todir/$newd > /dev/null 2>&1 - done - for f in `$findprog . ! -type d -print`; do - newf=`echo $f | $sedprog -e 's|^\./||'` - ignore=no - for i in $ignorefiles; do - case $newf in - $i) ignore=yes; break ;; - esac - done - case $ignore in - no) - if [ $verbose -gt 0 ]; then - echo "$lnprog ${linktype} $fromdir/$newf $todir/$newf" - fi - $doit $lnprog ${linktype} $fromdir/$newf $todir/$newf ;; - esac - done) - ;; -esac - -exit 0 diff --git a/pkgtools/pkg_install/files/view/linkfarm.sh.in b/pkgtools/pkg_install/files/view/linkfarm.sh.in new file mode 100644 index 00000000000..5c934139846 --- /dev/null +++ b/pkgtools/pkg_install/files/view/linkfarm.sh.in @@ -0,0 +1,225 @@ +#! /bin/sh + +# $NetBSD: linkfarm.sh.in,v 1.1 2003/09/08 04:49:07 jlam Exp $ + +# +# Copyright (c) 2002 Alistair G. Crooks. 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. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Alistair G. Crooks. +# 4. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + +# set -x + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +sbindir="@sbindir@" + +# set up program definitions +findprog="@FIND@" +grepprog="@GREP@" +lnprog="@LN@" +mkdirprog="@MKDIR@" +pkginfoprog="@sbindir@/pkg_info" +rmprog="@RM@" +rmdirprog="@RMDIR@" +sedprog="@SED@" +sortprog="@SORT@" + +usage() { + echo 'Usage: linkfarm [options] package' + exit 1 +} + +version() { + $pkginfoprog -V + exit 0 +} + +checkdir() { + if [ ! -d "$1" ]; then + echo "linkfarm: \`$1' doesn't exist" + exit 1 + fi +} + +ignorefiles=${PLIST_IGNORE_FILES:-"info/dir *[~#] *.OLD *.orig *,v"} +linktype=-s + +# default action: create a linkfarm in $target from $stowdir/$1 +# i.e. linkfarm --target=${prefix}/${view} --dir=${prefix}/packages $1 +# +doit="" +target=${LOCALBASE:-/usr/pkg} +stowdir=${target}/packages +subdir="" +verbose=0 + +# default action is to create +check=no +delete=no +create=yes + +# process args - can't use getopt(1) because of '--' style args +while [ $# -gt 0 ]; do + case "$1" in + -D) delete=yes; create=no ;; + -R) delete=yes; create=yes ;; + -V) version ;; + -c) check=yes; doit=":" ;; + -d) stowdir=$2; shift ;; + -d*) stowdir=`echo $1 | $sedprog -e 's|-d||'` ;; + -s) subdir=$2; shift ;; + -s*) subdir=`echo $1 | $sedprog -e 's|-s||'` ;; + -t) target=$2; shift ;; + -t*) target=`echo $1 | $sedprog -e 's|-t||'` ;; + -n) doit=":" ;; + -v) verbose=`expr $verbose + 1` ;; + + --delete) delete=yes; create=no ;; + --dir=*) stowdir=`echo $1 | $sedprog -e 's|--dir=||'` ;; + --restow) delete=yes; create=yes ;; + --subdir=*) subdir=`echo $1 | $sedprog -e 's|--subdir=||'` ;; + --target=*) target=`echo $1 | $sedprog -e 's|--target=||'` ;; + --version) version ;; + + --) shift; break ;; + *) break ;; + esac + shift +done + +# set the package name +package=$1 + +# make sure stowdir has a full pathname +case $stowdir in +/*) ;; +*) stowdir=`pwd`/$stowdir ;; +esac + +# Set the directory from which we symlink. +case $subdir in +"") fromdir=$stowdir/$package ;; +*) fromdir=$stowdir/$package/$subdir ;; +esac + +# Set the directory to which we symlink. +case $target in +/*) todir=$target ;; +*) todir=`pwd`/$target ;; +esac + +# if we're checking the entries, check, then exit +case $check in +yes) + checkdir $fromdir + (cd $fromdir; + ex=0; + for f in `$findprog . ! -type d -print`; do + newf=`echo $f | $sedprog -e 's|^\./||'` + if [ -e $todir/$newf ]; then + ignore=no + for i in $ignorefiles; do + case $newf in + $i) ignore=yes; break ;; + esac + done + case $ignore in + no) + echo "${newf}"; ex=1 ;; + esac + fi + done + exit $ex) || exit 1 + ;; +esac + +# if we need to get rid of old linkfarms, do it +case $delete in +yes) + checkdir $fromdir + (cd $fromdir; + for f in `$findprog . ! -type d -print`; do + newf=`echo $f | $sedprog -e 's|^\./||'` + ignore=no + for i in $ignorefiles; do + case $newf in + $i) ignore=yes; break ;; + esac + done + case $ignore in + no) + if [ $verbose -gt 0 ]; then + echo "$rmprog $todir/$newf" + fi + $doit $rmprog $todir/$f ;; + esac + done + for d in `$findprog . -type d -print | $sortprog -r`; do + if [ $verbose -gt 0 ]; then + echo "$rmdirprog $todir/$d" + fi + $doit $rmdirprog $todir/$d > /dev/null 2>&1 + done) + ;; +esac + +# if we need to create new linkfarms, do it +case $create in +yes) + checkdir $fromdir + (cd $fromdir; + for d in `$findprog . -type d -print`; do + newd=`echo $d | $sedprog -e 's|^\./||'` + case "$d" in + "") continue ;; + esac + if [ $verbose -gt 0 ]; then + echo "$mkdirprog -p $todir/$newd" + fi + $doit $mkdirprog -p $todir/$newd > /dev/null 2>&1 + done + for f in `$findprog . ! -type d -print`; do + newf=`echo $f | $sedprog -e 's|^\./||'` + ignore=no + for i in $ignorefiles; do + case $newf in + $i) ignore=yes; break ;; + esac + done + case $ignore in + no) + if [ $verbose -gt 0 ]; then + echo "$lnprog ${linktype} $fromdir/$newf $todir/$newf" + fi + $doit $lnprog ${linktype} $fromdir/$newf $todir/$newf ;; + esac + done) + ;; +esac + +exit 0 diff --git a/pkgtools/pkg_install/files/view/pkg_view.sh b/pkgtools/pkg_install/files/view/pkg_view.sh deleted file mode 100644 index ad4d91e1245..00000000000 --- a/pkgtools/pkg_install/files/view/pkg_view.sh +++ /dev/null @@ -1,268 +0,0 @@ -#! /bin/sh - -# $NetBSD: pkg_view.sh,v 1.2 2003/09/03 14:06:01 jlam Exp $ - -# -# Copyright (c) 2001 Alistair G. Crooks. 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. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Alistair G. Crooks. -# 4. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior written -# permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. - -# set -x - -# set up program definitions -chmodprog=/bin/chmod -cmpprog=/usr/bin/cmp -cpprog=/bin/cp -envprog=/usr/bin/env -findprog=/usr/bin/find -grepprog=/usr/bin/grep -linkfarmprog=/usr/sbin/linkfarm -lnprog=/bin/ln -mkdirprog=/bin/mkdir -paxprog=/bin/pax -pkginfoprog=/usr/sbin/pkg_info -rmprog=/bin/rm -rmdirprog=/bin/rmdir -sedprog=/usr/bin/sed -touchprog=/usr/bin/touch - -usage() { - echo 'Usage: pkg_view [-n] [-v] [-i ignore] [-k pkg_dbdir_dflt] [-w viewname] [-d stowdir] [-W viewbase] add|check|delete pkgname...' - exit 1 -} - -version() { - $pkginfoprog -V - exit 0 -} - -checkpkg() { - if [ ! -d "$2/$1" ]; then - echo "pkg_view: \`$1' doesn't exist in \`$2'" 1>&2 - exit 1 - fi -} - -######################################### -# Initialization and Options Processing # -######################################### - -doit="" -stowdir="" -viewbase=${LOCALBASE:-/usr/pkg} -view=${PKG_VIEW:-""} -dflt_ignorefiles=${PLIST_IGNORE_FILES:-"info/dir *[~#] *.OLD *.orig *,v"} -dflt_pkg_dbdir=${PKG_DBDIR:-/var/db/pkg} -ignorefiles="" -verbose=0 - -while [ $# -gt 0 ]; do - case "$1" in - -d) stowdir=$2; shift ;; - -d*) stowdir=`echo $1 | $sedprog -e 's|^-d||'` ;; - -i) ignorefiles="$ignorefiles $2"; shift ;; - -i*) ignorefiles="$ignorefiles `echo $1 | $sedprog -e 's|^-i||'`" ;; - -k) dflt_pkg_dbdir="$2"; shift ;; - -k*) dflt_pkg_dbdir=`echo $1 | $sedprog -e 's|^-k||'` ;; - -n) doit=":" ;; - -V) version ;; - -v) verbose=`expr $verbose + 1` ;; - -W) viewbase=$2; shift ;; - -W*) viewbase=`echo $1 | $sedprog -e 's|^-p||'` ;; - -w) view=$2; shift ;; - --view=*) view=`echo $1 | $sedprog -e 's|--view=||'` ;; - --) shift; break ;; - *) break ;; - esac - shift -done - -if [ $# -lt 1 ]; then - usage -fi - -# echoN will actually give output if ${verbose} > N. -echo1=":" -echo2=":" -if [ ${verbose} -gt 0 ]; then echo1=echo; fi -if [ ${verbose} -gt 1 ]; then echo2=echo; fi - -action="" -case "$1" in -add) action=add ;; -check) action=check ;; -delete|rm) action=delete ;; -*) usage ;; -esac -shift - -# if standard view, put package info into ${dflt_pkg_dbdir} -# if not standard view, put package info into view's pkgdb -case "$view" in -"") - pkg_dbdir=${dflt_pkg_dbdir} - targetdir=${viewbase} - viewstr="the standard view" - ;; -*) - pkg_dbdir=${viewbase}/${view}/.pkgdb - targetdir=${viewbase}/${view} - viewstr="view \"${view}\"" - ;; -esac - -# Use stowdir if it's given, else fall back to ${DEPOTBASE} or else -# default to ${viewbase}/packages. -# -depot_pkg_dbdir=${stowdir:-${DEPOTBASE:-${viewbase}/packages}} - -case "${depot_pkg_dbdir}" in -${pkg_dbdir}) - echo "pkg_view: the depot and the view package database directories are the same" 1>&2 - exit 1 - ;; -esac - -########################## -# Shell helper functions # -########################## - -# symlinks check|add|delete -# -# Calls linkfarm(1) to check, add or delete the symlink farm in -# ${targetdir}. We also ignore the right set of files when doing the -# linkfarm operations. -# -symlinks() { - pkg=$2 - case "$1" in - add) linkfarmflags="" ;; - check) linkfarmflags="-c" ;; - delete) linkfarmflags="-D" ;; - esac - if [ -f ${depot_pkg_dbdir}/$pkg/+BUILD_INFO ]; then - ignore=`$grepprog "^_PLIST_IGNORE_FILES=" ${depot_pkg_dbdir}/$pkg/+BUILD_INFO | $sedprog -e 's|^_PLIST_IGNORE_FILES=[ ]*||'` - fi - case "$ignore" in - "") ignore="${dflt_ignorefiles}" ;; - esac - dbs=`(cd ${depot_pkg_dbdir}/$pkg; echo +*)` - ignore="${ignore} ${ignorefiles} $dbs" - $doit $envprog PLIST_IGNORE_FILES="${ignore}" $linkfarmprog $linkfarmflags --target=${targetdir} --dir=${depot_pkg_dbdir} $pkg -} - -############# -# Main Loop # -############# - -while [ $# -gt 0 ]; do - case $action in - add) - checkpkg $1 ${depot_pkg_dbdir} - if [ -f ${pkg_dbdir}/$1/+DEPOT ]; then - echo "pkg_view: \`$1' already exists in $viewstr" 1>&2 - exit 1 - fi - $echo1 "Adding $1 to ${targetdir}." - symlinks add $1 - $doit $mkdirprog -p ${depot_pkg_dbdir}/$1 - temp=${depot_pkg_dbdir}/$1/+VIEWS.$$ - $doit $touchprog ${depot_pkg_dbdir}/$1/+VIEWS - $doit $cpprog ${depot_pkg_dbdir}/$1/+VIEWS ${temp} - case "$doit" in - "") ($grepprog -v '^'${pkg_dbdir}'$' ${temp} || true; echo ${pkg_dbdir}) > ${depot_pkg_dbdir}/$1/+VIEWS ;; - esac - $doit $rmprog ${temp} - $doit $mkdirprog -p ${pkg_dbdir}/$1 - # - # Copy all of the metadata files except for +VIEWS, - # which is only for the depoted package, and - # +REQUIRED_BY, which is irrelevant for a package in - # a view. - # - case "$doit" in - "") (cd ${depot_pkg_dbdir}/$1; $paxprog -rwpe '-s|\./\+VIEWS$||' '-s|\./\+REQUIRED_BY$||' ./+* ${pkg_dbdir}/$1) - $sedprog -e 's|'${depot_pkg_dbdir}/$1'|'${targetdir}'|g' < ${depot_pkg_dbdir}/$1/+CONTENTS > ${pkg_dbdir}/$1/+CONTENTS - echo "${depot_pkg_dbdir}/$1" > ${pkg_dbdir}/$1/+DEPOT - ;; - esac - if [ -f ${pkg_dbdir}/$1/+INSTALL ]; then - $doit $chmodprog +x ${pkg_dbdir}/$1/+INSTALL - $doit $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+INSTALL $1 VIEW-INSTALL - ec=$? - if [ $ec != 0 ]; then - echo "pkg_view: install script returned an error." 1>&2 - exit $ec - fi - fi - ;; - check) - checkpkg $1 ${depot_pkg_dbdir} - $echo1 "Checking $1 in ${targetdir}." - symlinks check $1 - exit $? - ;; - delete) - checkpkg $1 ${depot_pkg_dbdir} - if [ ! -f ${pkg_dbdir}/$1/+DEPOT ]; then - echo "pkg_view: \`$1' doesn't exist in $viewstr" 1>&2 - exit 1 - fi - $echo1 "Deleting $1 from ${targetdir}." - if [ -f ${pkg_dbdir}/$1/+REQUIRED_BY ]; then - if $cmpprog -s ${pkg_dbdir}/$1/+REQUIRED_BY /dev/null; then - : # not really required by another pkg - else - (echo "pkg_view: \`$1' is required by other packages:" - $sedprog -e 's|^| |' ${pkg_dbdir}/$1/+REQUIRED_BY) 1>&2 - exit 1 - fi - fi - if [ -f ${pkg_dbdir}/$1/+DEINSTALL ]; then - $doit $chmodprog +x ${pkg_dbdir}/$1/+DEINSTALL - $doit $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+DEINSTALL $1 VIEW-DEINSTALL - ec=$? - if [ $ec != 0 ]; then - echo "pkg_view: de-install script returned an error." 1>&2 - exit $ec - fi - fi - symlinks delete $1 - temp=${depot_pkg_dbdir}/$1/+VIEWS.$$ - $doit $cpprog ${depot_pkg_dbdir}/$1/+VIEWS ${temp} - case "$doit" in - "") ($grepprog -v '^'${pkg_dbdir}'$' ${temp} || true) > ${depot_pkg_dbdir}/$1/+VIEWS ;; - esac - $doit $rmprog ${temp} - $doit $rmprog -rf ${pkg_dbdir}/$1 - ;; - esac - shift -done - -exit 0 diff --git a/pkgtools/pkg_install/files/view/pkg_view.sh.in b/pkgtools/pkg_install/files/view/pkg_view.sh.in new file mode 100644 index 00000000000..447c27813e4 --- /dev/null +++ b/pkgtools/pkg_install/files/view/pkg_view.sh.in @@ -0,0 +1,272 @@ +#! /bin/sh + +# $NetBSD: pkg_view.sh.in,v 1.1 2003/09/08 04:49:07 jlam Exp $ + +# +# Copyright (c) 2001 Alistair G. Crooks. 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. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by Alistair G. Crooks. +# 4. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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. + +# set -x + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +sbindir="@sbindir@" + +# set up program definitions +chmodprog="@CHMOD@" +cmpprog="@CMP@" +cpprog="@CP@" +envprog="@ENV@" +findprog="@FIND@" +grepprog="@GREP@" +linkfarmprog="@sbindir@/linkfarm" +lnprog="@LN@" +mkdirprog="@MKDIR@" +paxprog="@PAX@" +pkginfoprog="@sbindir@/pkg_info" +rmprog="@RM@" +rmdirprog="@RMDIR@" +sedprog="@SED@" +touchprog="@TOUCH@" + +usage() { + echo 'Usage: pkg_view [-n] [-v] [-i ignore] [-k pkg_dbdir_dflt] [-w viewname] [-d stowdir] [-W viewbase] add|check|delete pkgname...' + exit 1 +} + +version() { + $pkginfoprog -V + exit 0 +} + +checkpkg() { + if [ ! -d "$2/$1" ]; then + echo "pkg_view: \`$1' doesn't exist in \`$2'" 1>&2 + exit 1 + fi +} + +######################################### +# Initialization and Options Processing # +######################################### + +doit="" +stowdir="" +viewbase=${LOCALBASE:-/usr/pkg} +view=${PKG_VIEW:-""} +dflt_ignorefiles=${PLIST_IGNORE_FILES:-"info/dir *[~#] *.OLD *.orig *,v"} +dflt_pkg_dbdir=${PKG_DBDIR:-/var/db/pkg} +ignorefiles="" +verbose=0 + +while [ $# -gt 0 ]; do + case "$1" in + -d) stowdir=$2; shift ;; + -d*) stowdir=`echo $1 | $sedprog -e 's|^-d||'` ;; + -i) ignorefiles="$ignorefiles $2"; shift ;; + -i*) ignorefiles="$ignorefiles `echo $1 | $sedprog -e 's|^-i||'`" ;; + -k) dflt_pkg_dbdir="$2"; shift ;; + -k*) dflt_pkg_dbdir=`echo $1 | $sedprog -e 's|^-k||'` ;; + -n) doit=":" ;; + -V) version ;; + -v) verbose=`expr $verbose + 1` ;; + -W) viewbase=$2; shift ;; + -W*) viewbase=`echo $1 | $sedprog -e 's|^-p||'` ;; + -w) view=$2; shift ;; + --view=*) view=`echo $1 | $sedprog -e 's|--view=||'` ;; + --) shift; break ;; + *) break ;; + esac + shift +done + +if [ $# -lt 1 ]; then + usage +fi + +# echoN will actually give output if ${verbose} > N. +echo1=":" +echo2=":" +if [ ${verbose} -gt 0 ]; then echo1=echo; fi +if [ ${verbose} -gt 1 ]; then echo2=echo; fi + +action="" +case "$1" in +add) action=add ;; +check) action=check ;; +delete|rm) action=delete ;; +*) usage ;; +esac +shift + +# if standard view, put package info into ${dflt_pkg_dbdir} +# if not standard view, put package info into view's pkgdb +case "$view" in +"") + pkg_dbdir=${dflt_pkg_dbdir} + targetdir=${viewbase} + viewstr="the standard view" + ;; +*) + pkg_dbdir=${viewbase}/${view}/.pkgdb + targetdir=${viewbase}/${view} + viewstr="view \"${view}\"" + ;; +esac + +# Use stowdir if it's given, else fall back to ${DEPOTBASE} or else +# default to ${viewbase}/packages. +# +depot_pkg_dbdir=${stowdir:-${DEPOTBASE:-${viewbase}/packages}} + +case "${depot_pkg_dbdir}" in +${pkg_dbdir}) + echo "pkg_view: the depot and the view package database directories are the same" 1>&2 + exit 1 + ;; +esac + +########################## +# Shell helper functions # +########################## + +# symlinks check|add|delete +# +# Calls linkfarm(1) to check, add or delete the symlink farm in +# ${targetdir}. We also ignore the right set of files when doing the +# linkfarm operations. +# +symlinks() { + pkg=$2 + case "$1" in + add) linkfarmflags="" ;; + check) linkfarmflags="-c" ;; + delete) linkfarmflags="-D" ;; + esac + if [ -f ${depot_pkg_dbdir}/$pkg/+BUILD_INFO ]; then + ignore=`$grepprog "^_PLIST_IGNORE_FILES=" ${depot_pkg_dbdir}/$pkg/+BUILD_INFO | $sedprog -e 's|^_PLIST_IGNORE_FILES=[ ]*||'` + fi + case "$ignore" in + "") ignore="${dflt_ignorefiles}" ;; + esac + dbs=`(cd ${depot_pkg_dbdir}/$pkg; echo +*)` + ignore="${ignore} ${ignorefiles} $dbs" + $doit $envprog PLIST_IGNORE_FILES="${ignore}" $linkfarmprog $linkfarmflags --target=${targetdir} --dir=${depot_pkg_dbdir} $pkg +} + +############# +# Main Loop # +############# + +while [ $# -gt 0 ]; do + case $action in + add) + checkpkg $1 ${depot_pkg_dbdir} + if [ -f ${pkg_dbdir}/$1/+DEPOT ]; then + echo "pkg_view: \`$1' already exists in $viewstr" 1>&2 + exit 1 + fi + $echo1 "Adding $1 to ${targetdir}." + symlinks add $1 + $doit $mkdirprog -p ${depot_pkg_dbdir}/$1 + temp=${depot_pkg_dbdir}/$1/+VIEWS.$$ + $doit $touchprog ${depot_pkg_dbdir}/$1/+VIEWS + $doit $cpprog ${depot_pkg_dbdir}/$1/+VIEWS ${temp} + case "$doit" in + "") ($grepprog -v '^'${pkg_dbdir}'$' ${temp} || true; echo ${pkg_dbdir}) > ${depot_pkg_dbdir}/$1/+VIEWS ;; + esac + $doit $rmprog ${temp} + $doit $mkdirprog -p ${pkg_dbdir}/$1 + # + # Copy all of the metadata files except for +VIEWS, + # which is only for the depoted package, and + # +REQUIRED_BY, which is irrelevant for a package in + # a view. + # + case "$doit" in + "") (cd ${depot_pkg_dbdir}/$1; $paxprog -rwpe '-s|\./\+VIEWS$||' '-s|\./\+REQUIRED_BY$||' ./+* ${pkg_dbdir}/$1) + $sedprog -e 's|'${depot_pkg_dbdir}/$1'|'${targetdir}'|g' < ${depot_pkg_dbdir}/$1/+CONTENTS > ${pkg_dbdir}/$1/+CONTENTS + echo "${depot_pkg_dbdir}/$1" > ${pkg_dbdir}/$1/+DEPOT + ;; + esac + if [ -f ${pkg_dbdir}/$1/+INSTALL ]; then + $doit $chmodprog +x ${pkg_dbdir}/$1/+INSTALL + $doit $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+INSTALL $1 VIEW-INSTALL + ec=$? + if [ $ec != 0 ]; then + echo "pkg_view: install script returned an error." 1>&2 + exit $ec + fi + fi + ;; + check) + checkpkg $1 ${depot_pkg_dbdir} + $echo1 "Checking $1 in ${targetdir}." + symlinks check $1 + exit $? + ;; + delete) + checkpkg $1 ${depot_pkg_dbdir} + if [ ! -f ${pkg_dbdir}/$1/+DEPOT ]; then + echo "pkg_view: \`$1' doesn't exist in $viewstr" 1>&2 + exit 1 + fi + $echo1 "Deleting $1 from ${targetdir}." + if [ -f ${pkg_dbdir}/$1/+REQUIRED_BY ]; then + if $cmpprog -s ${pkg_dbdir}/$1/+REQUIRED_BY /dev/null; then + : # not really required by another pkg + else + (echo "pkg_view: \`$1' is required by other packages:" + $sedprog -e 's|^| |' ${pkg_dbdir}/$1/+REQUIRED_BY) 1>&2 + exit 1 + fi + fi + if [ -f ${pkg_dbdir}/$1/+DEINSTALL ]; then + $doit $chmodprog +x ${pkg_dbdir}/$1/+DEINSTALL + $doit $envprog -i PKG_PREFIX=${targetdir} ${pkg_dbdir}/$1/+DEINSTALL $1 VIEW-DEINSTALL + ec=$? + if [ $ec != 0 ]; then + echo "pkg_view: de-install script returned an error." 1>&2 + exit $ec + fi + fi + symlinks delete $1 + temp=${depot_pkg_dbdir}/$1/+VIEWS.$$ + $doit $cpprog ${depot_pkg_dbdir}/$1/+VIEWS ${temp} + case "$doit" in + "") ($grepprog -v '^'${pkg_dbdir}'$' ${temp} || true) > ${depot_pkg_dbdir}/$1/+VIEWS ;; + esac + $doit $rmprog ${temp} + $doit $rmprog -rf ${pkg_dbdir}/$1 + ;; + esac + shift +done + +exit 0 -- cgit v1.2.3