adds default value for need_sudo parameter in backup_file function

This commit is contained in:
Menno van Leeuwen 2024-11-08 14:38:12 +01:00
parent 4926ae8cc0
commit 00f647074d
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE

View File

@ -51,7 +51,7 @@ confirm_symlink() {
backup_file() { backup_file() {
local file="$1" local file="$1"
local need_sudo="$2" local need_sudo="${2:-false}"
if [ -f "$file" ]; then if [ -f "$file" ]; then
log_info "Backing up $file to $file.bak..." log_info "Backing up $file to $file.bak..."
@ -63,6 +63,7 @@ backup_file() {
fi fi
} }
check_prerequisites() { check_prerequisites() {
command -v git >/dev/null 2>&1 || die "Git is required but not installed" command -v git >/dev/null 2>&1 || die "Git is required but not installed"
command -v sudo >/dev/null 2>&1 || die "Sudo is required but not installed" command -v sudo >/dev/null 2>&1 || die "Sudo is required but not installed"