summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJon Ringle <jon@ringle.org>2010-03-09 21:30:12 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2010-03-10 23:31:07 +0100
commit88e11c1c5afca5b2b11c83c503de550dbc3f75ee (patch)
tree6b69d2d7e68aaf93f4b09f69a8aeddad58e93ae4 /scripts
parent786896c302d57ffcd338a110b789f2ee1257f0d6 (diff)
downloadptxdist-88e11c1c5afca5b2b11c83c503de550dbc3f75ee.tar.gz
ptxdist-88e11c1c5afca5b2b11c83c503de550dbc3f75ee.tar.xz
[install_alternative] clean up install_alternative handling
The current "ptxd_install_file" function uses an implicit "$src == --" to signal install_alternative. The cleanup is done by explicitly defining a variable "$cmd == alternative", for the normal install_copy it is defined to "file". This patch renames "ptxd_install_file" into "ptxd_install_file_impl". And creates a wrapper "ptxd_install_file" which just defines "cmd=file" and calls the _impl. The install alternative implementation follows the same pattern. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> [squashed mkl's related commits] Signed-off-by: Jon Ringle <jon@ringle.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh74
1 files changed, 37 insertions, 37 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 9aeff69a8..8c3c5546c 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -42,36 +42,34 @@ ptxd_install_setup_src() {
src="${pkg_pkg_dir}${dst}"
fi
- if [ -n "${src}" ]; then
- local -a list
-
- if [ "${src}" = "--" ]; then
- list=( \
- "${PTXDIST_WORKSPACE}/projectroot${dst}${PTXDIST_PLATFORMSUFFIX}" \
- "${PTXDIST_WORKSPACE}/projectroot${dst}" \
- "${PTXDIST_TOPDIR}/generic${dst}" \
- "${pkg_pkg_dir}${dst}" \
- )
- else
- list=( \
- "${src}${PTXDIST_PLATFORMSUFFIX}" \
- "${src}" \
- )
- fi
+ local -a list
+
+ if [ "${cmd}" = "alternative" ]; then
+ list=( \
+ "${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \
+ "${PTXDIST_WORKSPACE}/projectroot${src}" \
+ "${PTXDIST_TOPDIR}/generic${src}" \
+ "${pkg_pkg_dir}${src}" \
+ )
+ else
+ list=( \
+ "${src}${PTXDIST_PLATFORMSUFFIX}" \
+ "${src}" \
+ )
+ fi
- for src in "${list[@]}"; do
- if [ -f "${src}" ]; then
- return
- fi
- done
+ for src in "${list[@]}"; do
+ if [ -f "${src}" ]; then
+ return
+ fi
+ done
- echo -e "\nNo suitable file '${dst}' could be found in any of these locations:"
- local orig_IFS="${IFS}"
- local IFS="
+ echo -e "\nNo suitable file '${dst}' could be found in any of these locations:"
+ local orig_IFS="${IFS}"
+ local IFS="
"
- echo -e "${list[*]}\n"
- IFS="${orig_IFS}"
- fi
+ echo -e "${list[*]}\n"
+ IFS="${orig_IFS}"
}
export -f ptxd_install_setup_src
@@ -101,7 +99,7 @@ EOF
}
export -f ptxd_install_dir
-ptxd_install_file() {
+ptxd_install_file_impl() {
local src="$1"
local dst="$2"
local usr="$3"
@@ -111,15 +109,9 @@ ptxd_install_file() {
local -a dirs ndirs pdirs sdirs
local mod_nfs mod_rw
- if [ "${src}" == "--" ]; then
- local cmd="alternative"
- else
- local cmd="copy"
- fi
-
ptxd_install_setup_src &&
cat << EOF
-install ${cmd} file:
+install ${cmd}:
src=${src}
dst=${dst}
owner=${usr}
@@ -165,7 +157,7 @@ EOF
echo "f:${dst}:${usr}:${grp}:${mod}" >> "${pkg_xpkg_perms}"
}
-export -f ptxd_install_file
+export -f ptxd_install_file_impl
ptxd_install_ln() {
local src="$1"
@@ -235,11 +227,19 @@ EOF
export -f ptxd_install_mknod
ptxd_install_alternative() {
- ptxd_install_file -- "$@" ||
+ local cmd="alternative"
+ ptxd_install_file_impl "${1}" "${@}" ||
ptxd_install_error "install_alternative failed!"
}
export -f ptxd_install_alternative
+ptxd_install_file() {
+ local cmd="file"
+ ptxd_install_file_impl "$@" ||
+ ptxd_install_error "install_file failed!"
+}
+export -f ptxd_install_file
+
ptxd_install_link() {
ptxd_install_ln "$@" ||
ptxd_install_error "install_link failed!"