dreport: Change -f option to -p
Change optional file option to path. Valid paths are
absolute file path or d-bus path based on type parameter.
Change-Id: Ic167f9cc95f280f123d8b318c34c959952f1a78a
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/tools/dreport b/tools/dreport
index f690498..35f4a9c 100755
--- a/tools/dreport
+++ b/tools/dreport
@@ -21,10 +21,10 @@
-t, —-type <type> Data collection type. Valid types are
"user", "core".
Default type is "user" initiated.
- -f, —-file <file> Optional file to be included in the archive.
- Absolute path of the file must be passed as
- parameter. This is useful to include application
- core in the dump.
+ -p, —-path <path> Optional contents to be included in the archive.
+ Valid paths are absolute file path or d-bus path
+ based on type parameter.
+ -Absolute file path for "core" type.
-s, --size <size> Maximum allowed size(in KB) of the archive.
Report will be truncated in case size exceeds
this limit. Default size is unlimited.
@@ -61,7 +61,7 @@
declare -x quiet=$FALSE
declare -x dump_size="unlimited"
declare -x name_dir=""
-declare -x optional_file=""
+declare -x optional_path=""
declare -x dreport_log=""
declare -x summary_log=""
declare -x cur_dump_size=0
@@ -273,12 +273,12 @@
{
desc="Move Optional file"
- mv $optional_file $name_dir
+ mv $optional_path $name_dir
if [ $? -ne 0 ]; then
- log_error "Failed to move file $optional_file"
+ log_error "Failed to move file $optional_path"
return 1
fi
- if check_size "$name_dir/$(basename "$optional_file")"; then
+ if check_size "$name_dir/$(basename "$optional_path")"; then
log_info "Moving file $file_name"
else
log_warning "Skipping $file_name move"
@@ -331,7 +331,7 @@
}
# @brief get pid from the file
-# dreport "core" type user provides core file as optional file parameter.
+# dreport "core" type user provides core file as optional path parameter.
# As per coredump source code systemd-coredump uses below format
# https://github.com/systemd/systemd/blob/master/src/coredump/coredump.c
# /var/lib/systemd/coredump/core.%s.%s." SD_ID128_FORMAT_STR “.
@@ -339,7 +339,7 @@
function set_pid()
{
#Escape bash characters in file name
- file=$(printf %q "$optional_file")
+ file=$(printf %q "$optional_path")
#matching systemd-coredump core file format.
core_pid=$(echo $file | awk -F . '{ print $5}')
@@ -413,7 +413,7 @@
log_summary "Epochtime: $EPOCHTIME"
log_summary "ID: $dump_id"
log_summary "Type: $dump_type"
- log_summary "Optional file: $optional_file"
+ log_summary "Optional path: $optional_path"
}
# @brief Check the validity of user inputs and initialize global
@@ -573,8 +573,8 @@
fi
}
-TEMP=`getopt -o n:d:i:t:s:f:vVqh \
- --long name:,dir:,dumpid:,type:,size:,file:,verbose,version,quiet,help \
+TEMP=`getopt -o n:d:i:t:s:p:vVqh \
+ --long name:,dir:,dumpid:,type:,size:,path:,verbose,version,quiet,help \
-- "$@"`
if [ $? -ne 0 ]
@@ -603,8 +603,8 @@
-s|--size)
dump_size=$2
shift 2;;
- -f|--file)
- optional_file=$2
+ -p|--path)
+ optional_path=$2
shift 2;;
-v|—-verbose)
verbose=$TRUE