Author: pierre
Date: Sun Mar 19 07:54:28 2017
New Revision: 3926
Log:
Add checks for the files used by package management functions. Fix #1701
Modified:
jhalfs/trunk/common/libs/func_validate_configs.sh
jhalfs/trunk/jhalfs
Modified: jhalfs/trunk/common/libs/func_validate_configs.sh
==============================================================================
--- jhalfs/trunk/common/libs/func_validate_configs.sh Sat Mar 18 11:25:21
2017 (r3925)
+++ jhalfs/trunk/common/libs/func_validate_configs.sh Sun Mar 19 07:54:28
2017 (r3926)
@@ -80,6 +80,15 @@
exit 1
}
+# This function is only used when testing package management files.
+ write_pkg_and_die() {
+ echo -e "\n${DD_BORDER}"
+ echo "Package management is requested but" >&2
+ echo -e $* >&2
+ echo -e "${DD_BORDER}\n"
+ exit 1
+ }
+
validate_file() {
# For parameters ending with a '+' failure causes a warning message only
echo -n "`eval echo $PARAM_VALS`"
@@ -184,6 +193,28 @@
echo
;;
+ # Case of PKGMNGT: two files, packageManager.xml and packInstall.sh
+ # must exist in $PKGMNGTDIR:
+ PKGMNGT) echo -e "`eval echo $PARAM_VALS`"
+ if [ ! -e "$PKGMNGTDIR/packageManager.xml" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packageManager.xml does not
exist
+ fi
+ if [ ! -e "$PKGMNGTDIR/packInstall.sh" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packInstall.sh does not exist
+ fi
+ if [ ! -s "$PKGMNGTDIR/packageManager.xml" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packageManager.xml has zero size
+ fi
+ if [ ! -s "$PKGMNGTDIR/packInstall.sh" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packInstall.sh has zero size
+ fi
+ if [ ! -r "$PKGMNGTDIR/packageManager.xml" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packageManager.xml is not
readable
+ fi
+ if [ ! -r "$PKGMNGTDIR/packInstall.sh" ]; then
+ write_pkg_and_die $PKGMNGTDIR/packInstall.sh is not readable
+ fi
+ ;;
# Display non-validated envars found in ${PROGNAME}_PARAM_LIST
* ) echo -e "`eval echo $PARAM_VALS`" ;;
Modified: jhalfs/trunk/jhalfs
==============================================================================
--- jhalfs/trunk/jhalfs Sat Mar 18 11:25:21 2017 (r3925)
+++ jhalfs/trunk/jhalfs Sun Mar 19 07:54:28 2017 (r3926)
@@ -382,9 +382,10 @@
#
# Copy packageManager.xml, if needed
- [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
- cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
+ [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] && {
+ cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/
cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
+ }
#
# Copy urls.xsl, if needed
[[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
--
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page