fixed unbound variable error and missing function parameter
This commit is contained in:
parent
34529d3372
commit
9b013d9996
1 changed files with 3 additions and 2 deletions
|
|
@ -61,6 +61,7 @@ get_volumes() {
|
||||||
|
|
||||||
generate_name() {
|
generate_name() {
|
||||||
# Generates a random archive name of 20 alphanumeric characters
|
# Generates a random archive name of 20 alphanumeric characters
|
||||||
|
local archive_dir="$1"
|
||||||
local archive_name
|
local archive_name
|
||||||
archive_name="$archive_dir/$(tr -dc '[:alnum:]' < /dev/urandom | head -c 20).7z"
|
archive_name="$archive_dir/$(tr -dc '[:alnum:]' < /dev/urandom | head -c 20).7z"
|
||||||
|
|
||||||
|
|
@ -73,7 +74,7 @@ create_archive() {
|
||||||
local input_file="$1"
|
local input_file="$1"
|
||||||
local password="$2"
|
local password="$2"
|
||||||
local volumes="$3"
|
local volumes="$3"
|
||||||
local archive_name="$5"
|
local archive_name="$4"
|
||||||
|
|
||||||
7z a -mhe=on "-p${password}" "$volumes" "$archive_name" "${input_file}"
|
7z a -mhe=on "-p${password}" "$volumes" "$archive_name" "${input_file}"
|
||||||
}
|
}
|
||||||
|
|
@ -87,10 +88,10 @@ main() {
|
||||||
check_dependencies "7z"
|
check_dependencies "7z"
|
||||||
check_input "$input_file" "$password" "$size"
|
check_input "$input_file" "$password" "$size"
|
||||||
|
|
||||||
archive_name="$(generate_name)"
|
|
||||||
archive_dir="$(dirname "$0")/../archives"
|
archive_dir="$(dirname "$0")/../archives"
|
||||||
mkdir -p "$archive_dir"
|
mkdir -p "$archive_dir"
|
||||||
|
|
||||||
|
archive_name="$(generate_name "$archive_dir")"
|
||||||
volumes="$(get_volumes "$input_file" "$size")"
|
volumes="$(get_volumes "$input_file" "$size")"
|
||||||
|
|
||||||
log "INFO" "Packing '${input_file}' into archive '$archive_name' with password '${password}'"
|
log "INFO" "Packing '${input_file}' into archive '$archive_name' with password '${password}'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue