diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:19:38 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:41:20 -0400 |
commit | bb17fdbc594db5b11d0d561af4838ce3521c59f8 (patch) | |
tree | 1c2afaef0b1b71c46c77337b6bf87a412892079f /src/abslibre-tools | |
parent | a78f88414f8005dca62f8e5012c3f688647cd3c4 (diff) |
libredbdiff: re-indent
Diffstat (limited to 'src/abslibre-tools')
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index 28279ad..41bac17 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -208,14 +208,13 @@ main() { } main_update() { - if true; then - if [[ $EUID != 0 ]]; then - die "To initialize %s or update %s pacman databases, %s must be run as root (without arguments). Nothing done." \ - "$name" \ - "$name" \ - "$cmd" - fi - check_vars libredbdiff statedir mirror_prbl mirror_arch || exit 1 + if [[ $EUID != 0 ]]; then + die "To initialize %s or update %s pacman databases, %s must be run as root (without arguments). Nothing done." \ + "$name" \ + "$name" \ + "$cmd" + fi + check_vars libredbdiff statedir mirror_prbl mirror_arch || exit 1 createdir "$statedir" @@ -263,73 +262,73 @@ main_update() { warning "%q already exists. Skipping." "$mirrorlist_arch" fi - createdir "$dbpath_prbl" + createdir "$dbpath_prbl" + { msg "Synchronizing %s pacman databases for %s" "$name" "Parabola" pacman --config "$conffile_prbl" -Sy || die "Failed to synchronize pacman database for %s. Exiting." Parabola + } - createdir "$dbpath_arch" + createdir "$dbpath_arch" + { msg "Synchronizing %s pacman databases for %s" "$name" "Arch" pacman --config "$conffile_arch" -Sy || die "Failed to synchronize pacman database for %s. Exiting." Arch + } - msg "%s pacman databases are updated. %s is ready. Run %q -n to print results." \ - "$name" "$name" "$cmd" - return 0 - fi + msg "%s pacman databases are updated. %s is ready. Run %q -n to print results." \ + "$name" "$name" "$cmd" } main_compare() { - if true; then - check_vars libredbdiff statedir repos || exit 1 - - local conffiles=( - "$dbpath_prbl/sync/libre.db" - "$dbpath_arch/sync/core.db" - "$conffile_prbl" - "$conffile_arch" - ) - local file - for file in "${conffiles[@]}"; do - if ! [[ -f "$file" && -r "$file" ]]; then - error "Could not read %q." "$file" - die "Nothing done. It may be necessary to run %q without \ + check_vars libredbdiff statedir repos || exit 1 + + local conffiles=( + "$dbpath_prbl/sync/libre.db" + "$dbpath_arch/sync/core.db" + "$conffile_prbl" + "$conffile_arch" + ) + local file + for file in "${conffiles[@]}"; do + if ! [[ -f "$file" && -r "$file" ]]; then + error "Could not read %q." "$file" + die "Nothing done. It may be necessary to run %q without \ arguments as root to initialize %s." "$cmd" "$name" - fi - done - - local tmpdir - tmpdir="$(mktemp --tmpdir -d "$cmd.XXXXXXXXXX")" || die "Could not create temporary working directory" - trap "rm -rf -- $(printf %q "$tmpdir")" RETURN - local arch_packages_tmp="$tmpdir/arch-packages" - local prbl_packages_tmp="$tmpdir/parabola-packages" - - unset provides ver_prbl ver_arch - declare -gA provides ver_prbl ver_arch - - pacman --config "$conffile_arch" -Ss | \ - grep -v '^ ' | \ - awk -F/ '{print $2}' \ - > "$arch_packages_tmp" || \ - die "pacman command to get Arch package data has failed. Exiting." - - local pkgname pkgver rest - while read -r pkgname pkgver rest; do - ver_arch["$pkgname"]="$pkgver" - done < "$arch_packages_tmp" - - expac --config "$conffile_prbl" -S '%r/%n %v %S' \ - > "$prbl_packages_tmp" || \ - die "expac command to get Parabola package data has failed. Exiting." - - if [[ $# == 1 ]]; then - print_cmp "$1" - else - for repo in "${repos[@]}" ; do - echo "[$repo]" - print_cmp "$repo" - done fi + done + + local tmpdir + tmpdir="$(mktemp --tmpdir -d "$cmd.XXXXXXXXXX")" || die "Could not create temporary working directory" + trap "rm -rf -- $(printf %q "$tmpdir")" RETURN + local arch_packages_tmp="$tmpdir/arch-packages" + local prbl_packages_tmp="$tmpdir/parabola-packages" + + unset provides ver_prbl ver_arch + declare -gA provides ver_prbl ver_arch + + pacman --config "$conffile_arch" -Ss | \ + grep -v '^ ' | \ + awk -F/ '{print $2}' \ + > "$arch_packages_tmp" || \ + die "pacman command to get Arch package data has failed. Exiting." + + local pkgname pkgver rest + while read -r pkgname pkgver rest; do + ver_arch["$pkgname"]="$pkgver" + done < "$arch_packages_tmp" + + expac --config "$conffile_prbl" -S '%r/%n %v %S' \ + > "$prbl_packages_tmp" || \ + die "expac command to get Parabola package data has failed. Exiting." + + if [[ $# == 1 ]]; then + print_cmp "$1" + else + for repo in "${repos[@]}" ; do + echo "[$repo]" + print_cmp "$repo" + done fi } |