diff --git a/kdump-lib.sh b/kdump-lib.sh index d06a417..6d421d3 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -291,26 +291,6 @@ get_option_value() { strip_comments `grep "^$1[[:space:]]\+" /etc/kdump.conf | tail -1 | cut -d\ -f2-` } -#This function compose a absolute path with the mount -#point and the relative $SAVE_PATH. -#target is passed in as argument, could be UUID, LABEL, -#block device or even nfs server export of the form of -#"my.server.com:/tmp/export"? -#And possibly this could be used for both default case -#as well as when dump taret is specified. When dump -#target is not specified, then $target would be null. -make_absolute_save_path() -{ - local _target=$1 - local _mnt - - [ -n $_target ] && _mnt=$(get_mntpoint_from_target $1) - _mnt="${_mnt}/$SAVE_PATH" - - # strip the duplicated "/" - echo "$_mnt" | tr -s / -} - check_save_path_fs() { local _path=$1 @@ -320,6 +300,15 @@ check_save_path_fs() fi } +# Check if path exists within dump target +check_save_path_user_configured() +{ + local _target=$1 _path=$2 + local _mnt=$(get_mntpoint_from_target $_target) + + check_save_path_fs "$_mnt/$_path" +} + is_atomic() { grep -q "ostree" /proc/cmdline diff --git a/mkdumprd b/mkdumprd index f04f565..4fcce1c 100644 --- a/mkdumprd +++ b/mkdumprd @@ -387,20 +387,13 @@ do perror_exit "Dump target $config_val is probably not mounted." fi - _absolute_save_path=$(make_absolute_save_path $config_val) - _mntpoint=$(get_mntpoint_from_path $_absolute_save_path) - if is_atomic && is_bind_mount $_mntpoint; then - SAVE_PATH=${_absolute_save_path##"$_mntpoint"} - # the real dump path in the 2nd kernel, if the mount point is bind mounted. - SAVE_PATH=$(get_bind_mount_directory $_mntpoint)/$SAVE_PATH - fi - + # User configured target, use $SAVE_PATH as the dump path within the target + check_save_path_user_configured "$config_val" "$SAVE_PATH" + check_size fs "$config_val" add_mount "$config_val" - check_save_path_fs $_absolute_save_path - check_size fs $config_val ;; raw) - #checking raw disk writable + # checking raw disk writable dd if=$config_val count=1 of=/dev/null > /dev/null 2>&1 || { perror_exit "Bad raw disk $config_val" }