From a78f88414f8005dca62f8e5012c3f688647cd3c4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 3 May 2017 01:18:10 -0400 Subject: libredbdiff: inline initialize. The indentation here is a little off. Just go with it. --- src/abslibre-tools/libredbdiff | 94 ++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 49 deletions(-) (limited to 'src/abslibre-tools') diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff index 074d8fe..28279ad 100755 --- a/src/abslibre-tools/libredbdiff +++ b/src/abslibre-tools/libredbdiff @@ -60,54 +60,6 @@ createdir() { fi } -initialize() { - createdir "$statedir" - - if [[ ! -e "$conffile_prbl" ]] ; then - msg "Generating %s %q" Parabola pacman.conf - cp -T /usr/share/pacman/defaults/pacman.conf.x86_64 "$conffile_prbl" - sed -r \ - -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_prbl|" \ - -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_prbl|" \ - -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \ - -i "$conffile_prbl" - local repo - for repo in multilib {libre,pcr,nonprism}{,-multilib}; do - enablerepo "$repo" "$conffile_prbl" - done - else - warning "%q already exists. Skipping." "$conffile_prbl" - fi - - if [[ ! -e "$conffile_arch" ]] ; then - msg "Generating %s %q" Arch pacman.conf - wget -q \ - -O "$conffile_arch" \ - "https://git.archlinux.org/svntogit/packages.git/plain/pacman/repos/core-x86_64/pacman.conf.x86_64" || - die "Failed to download %q. Exiting." "$conffile_arch" - sed -r \ - -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_arch|" \ - -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_arch|" \ - -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \ - -i "$conffile_arch" - enablerepo multilib "$conffile_arch" - else - warning "%q already exists. Skipping." "$conffile_arch" - fi - - if [[ ! -e "$mirrorlist_prbl" ]] ; then - printf 'Server = %s\n' "$mirror_prbl" > "$mirrorlist_prbl" - else - warning "%q already exists. Skipping." "$mirrorlist_prbl" - fi - - if [[ ! -e "$mirrorlist_arch" ]] ; then - printf 'Server = %s\n' "$mirror_arch" > "$mirrorlist_arch" - else - warning "%q already exists. Skipping." "$mirrorlist_arch" - fi -} - # Globals: # - pkgname : the Parabola pkgname # - ver_prbl : a map of pkgname->arch_pkgver @@ -265,7 +217,51 @@ main_update() { fi check_vars libredbdiff statedir mirror_prbl mirror_arch || exit 1 - initialize + createdir "$statedir" + + if [[ ! -e "$conffile_prbl" ]] ; then + msg "Generating %s %q" Parabola pacman.conf + cp -T /usr/share/pacman/defaults/pacman.conf.x86_64 "$conffile_prbl" + sed -r \ + -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_prbl|" \ + -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_prbl|" \ + -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \ + -i "$conffile_prbl" + local repo + for repo in multilib {libre,pcr,nonprism}{,-multilib}; do + enablerepo "$repo" "$conffile_prbl" + done + else + warning "%q already exists. Skipping." "$conffile_prbl" + fi + + if [[ ! -e "$conffile_arch" ]] ; then + msg "Generating %s %q" Arch pacman.conf + wget -q \ + -O "$conffile_arch" \ + "https://git.archlinux.org/svntogit/packages.git/plain/pacman/repos/core-x86_64/pacman.conf.x86_64" || + die "Failed to download %q. Exiting." "$conffile_arch" + sed -r \ + -e "s|/etc/pacman\.d/mirrorlist$|$mirrorlist_arch|" \ + -e "s|^#?DBPath\s*=.*|DBPath = $dbpath_arch|" \ + -e "s|^#?Architecture\s*=.*|Architecture = x86_64|" \ + -i "$conffile_arch" + enablerepo multilib "$conffile_arch" + else + warning "%q already exists. Skipping." "$conffile_arch" + fi + + if [[ ! -e "$mirrorlist_prbl" ]] ; then + printf 'Server = %s\n' "$mirror_prbl" > "$mirrorlist_prbl" + else + warning "%q already exists. Skipping." "$mirrorlist_prbl" + fi + + if [[ ! -e "$mirrorlist_arch" ]] ; then + printf 'Server = %s\n' "$mirror_arch" > "$mirrorlist_arch" + else + warning "%q already exists. Skipping." "$mirrorlist_arch" + fi createdir "$dbpath_prbl" msg "Synchronizing %s pacman databases for %s" "$name" "Parabola" -- cgit v1.2.2