diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:18:10 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-03 01:41:18 -0400 |
commit | a78f88414f8005dca62f8e5012c3f688647cd3c4 (patch) | |
tree | 75c0c6c41d5235035e06f21c8da775ccbc8d604d | |
parent | 98e694e9677227a41e0a96fc70a502891acfdfe2 (diff) |
libredbdiff: inline initialize.
The indentation here is a little off. Just go with it.
-rwxr-xr-x | src/abslibre-tools/libredbdiff | 94 |
1 files changed, 45 insertions, 49 deletions
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" |