diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:06:18 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:39:15 -0400 |
commit | 2335251f5baaf7bd5f7a53ee703d3308c69beb0c (patch) | |
tree | 79b5dffb72ca89bbab55554e6fdde652dab2870f /src | |
parent | e5b63059b96ef63bfda4e8d28e2de97a58b6aee3 (diff) |
libredbdiff: clean up initialization-detection code
Diffstat (limited to 'src')
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index e88eb91..badb69e 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -70,7 +70,7 @@ createdir() { if [[ ! -e "$dir" ]] ; then msg "Creating directory %q" "$dir" mkdir -- "$dir" || die "Failed to create directory %q. Exiting." "$dir" - elif [[ -n "$init" ]]; then + elif $init; then warning "%q already exists. Skipping." "$dir" fi } @@ -80,7 +80,7 @@ setmirror() { local mirror="$2" local mirrorlist="$3" - if [[ -n "$init" ]] && [[ -n "$mirror" ]]; then + if [[ -n "$mirror" ]]; then local mirrorescaped mirrorescaped="${mirror//./\\.}" mirrorescaped="${mirrorescaped//\$/\\$}" @@ -310,6 +310,7 @@ main_update() { fi check_vars libredbdiff statedir mirror_prbl mirror_arch || exit 1 + local init=false if ! [[ -e "$conffile_prbl" && \ -e "$conffile_arch" && \ -e "$mirrorlist_prbl" && \ @@ -317,13 +318,10 @@ main_update() { warning "At least one %s configuration file is missing." \ "$name" msg "Downloading and preparing missing configuration files." - init=1 + initialize + init=true fi - createdir "$statedir" - - initialize - if ! [[ -d "$dbpath_prbl" && \ -d "$dbpath_arch" ]]; then warning "At least one %s pacman DB directory is missing. Synchronizing %s DB files." \ |