On 03/26/15 at 05:05pm, Minfei Huang wrote:
On 03/26/15 at 04:10pm, Baoquan He wrote:
> > +# fail to cut out the path, if the path contains
duplicated "/"
>
> This function is not good. I suggest using one line of sed command to do
> this. This kind of process looks weird.
>
I will investigate it, if there is a better way to deal it.
It should be like s#/+#/#, it's simpler than yours. Code will be bloated very
much if all code is written like below.
Dave might have a precise thought on this, you can consult him.
Thanks
Minfei
> > +cut_out_substring()
> > +{
> > + local _prefix_tmp="${initdir}/tmp/$$-kdump-dir"
> > + local _main_str=$_prefix_tmp/$1 _sub_str=$_prefix_tmp/$2 _pwd=`pwd`
> > +
> > + mkdir -p $_main_str
> > + mkdir -p $_sub_str
> > +
> > + cd $_main_str
> > + _main_str=`pwd`
> > + cd $_sub_str
> > + _sub_str=`pwd`
> > + cd $_pwd
> > +
> > + rm -rf $_prefix_tmp
> > +
> > + _main_str=${_main_str#*"$_prefix_tmp"}
> > + _sub_str=${_sub_str#*"$_prefix_tmp"}
> > + echo ${_main_str#*"$_sub_str"}
> > +}
> > diff --git a/mkdumprd b/mkdumprd
> > index 4d251ba..a8f9cbb 100644
> > --- a/mkdumprd
> > +++ b/mkdumprd
> > @@ -364,7 +364,7 @@ handle_default_dump_target()
> > _mntpoint=$(get_mntpoint_from_path $SAVE_PATH)
> > _target=$(get_target_from_path $SAVE_PATH)
> > if [ "$_mntpoint" != "/" ]; then
> > - SAVE_PATH=${SAVE_PATH##"$_mntpoint"}
> > + SAVE_PATH=$(cut_out_substring $SAVE_PATH $_mntpoint)
> > _fstype=$(get_fs_type_from_target $_target)
> >
> > if $(is_fs_type_nfs $_fstype); then
> > --
> > 1.9.3
> >
> > _______________________________________________
> > kexec mailing list
> > kexec(a)lists.fedoraproject.org
> >
https://lists.fedoraproject.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec