From 5d1e5d423c90e0857d39cf582cbb74d7bf514633 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 9 Aug 2011 16:24:40 +0000 Subject: [PATCH] Made releng/manual_burn and releng/manual_devices work on FreeBSD --- releng/inc/releng_getopts.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/releng/inc/releng_getopts.inc b/releng/inc/releng_getopts.inc index 26fdeefb..e20c58dc 100644 --- a/releng/inc/releng_getopts.inc +++ b/releng/inc/releng_getopts.inc @@ -45,16 +45,18 @@ cleanup() { # Verify once again we are in the releng_generated_data directory # Check for both returned code of grep and returned matching string - READ_CANON_EXISTS=`readlink -e "${GEN_DATA_DIR}"` + # There is no "readlink -e" on FreeBSD + READ_CANON_EXISTS=`cd "${GEN_DATA_DIR}" 2>/dev/null && pwd` DIR_NAME_GEN_DATA=`dirname "${READ_CANON_EXISTS}"` set +e - RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep -P "\w+\/releng_generated_data$"` + # There is no "grep -P" on FreeBSD + RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep "[a-zA-Z0-9_][a-zA-Z0-9_]*/releng_generated_data$"` GREP_RET_GEN_DATA="$?" case "${GREP_RET_GEN_DATA}" in 0) if [ x"${RET_NON_EMPTY_STRING}" != x"" ]; then # now call the nastiness - chmod +w -R ${GEN_DATA_DIR} + chmod -R +w ${GEN_DATA_DIR} rm -rf ${GEN_DATA_DIR} boldify printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}