improved logging
This commit is contained in:
parent
2f71885690
commit
5eaa4863f7
1 changed files with 4 additions and 5 deletions
|
|
@ -21,7 +21,7 @@ check_input() {
|
|||
[[ -n "${password}" ]] || { log "ERROR" "No password given" && exit 2 ;}
|
||||
|
||||
if [[ ! "$size" =~ ^([1-9][0-9]*)?$ ]]; then
|
||||
log "ERROR" "Invalid size $size, must be empty or a positive number"
|
||||
log "ERROR" "Invalid size '$size', must be empty or a positive number"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ calc_smart_volumes() {
|
|||
num_volumes=$(( (total_size + size - 1) / size ))
|
||||
smart_size=$(( (total_size + num_volumes - 1) / num_volumes ))
|
||||
|
||||
log "INFO" "Calculated smart volume size '$size'"
|
||||
log "INFO" "Calculated smart volume size '$smart_size'"
|
||||
|
||||
echo "$smart_size"
|
||||
}
|
||||
|
|
@ -53,11 +53,12 @@ get_volumes() {
|
|||
local smart_size
|
||||
|
||||
if [[ -n "$size" ]]; then
|
||||
log "INFO" "Volumes size is set to ${size}MB"
|
||||
smart_size="$(calc_smart_volumes "$input_file" "$size" || echo -n)"
|
||||
volumes="-v${smart_size}m"
|
||||
fi
|
||||
|
||||
log "INFO" "Volumes set to '$volumes'"
|
||||
[[ -n "$volumes" ]] && log "INFO" "Volumes set to '$volumes'" || log "INFO" "Volumes argument unset"
|
||||
|
||||
echo "$volumes"
|
||||
}
|
||||
|
|
@ -79,8 +80,6 @@ create_archive() {
|
|||
local size="$4"
|
||||
local archive_name="$5"
|
||||
|
||||
[[ -n "$volumes" ]] && log "INFO" "Volumes size is set to $size MB"
|
||||
|
||||
7z a -mhe=on "-p${password}" "$volumes" "$archive_name" "${input_file}"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue