From 3ccef84028e58be35ac964935264a2ec01b7abab Mon Sep 17 00:00:00 2001 From: brent s Date: Fri, 12 Jan 2018 19:22:26 -0500 Subject: [PATCH] tweaks to the apacman installer --- aif/scripts/pkg/apacman.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/aif/scripts/pkg/apacman.py b/aif/scripts/pkg/apacman.py index b4af715..ae4e8c1 100644 --- a/aif/scripts/pkg/apacman.py +++ b/aif/scripts/pkg/apacman.py @@ -7,8 +7,10 @@ import shutil import subprocess from urllib.request import urlopen -pkg = 'https://aif.square-r00t.net/cfgs/files/apacman.tar.xz' -local_pkg = '/tmp/apacman.tar.xz' +pkg_base = 'apacman' +pkgs = ('', '-deps', '-utils') +url_base = 'https://aif.square-r00t.net/cfgs/files' +local_dir = '/tmp' conf_options = {} conf_options['apacman'] = {'enabled': ['needed', 'noconfirm', 'noedit', 'progress', 'purgebuild', 'skipcache', 'keepkeys'], @@ -19,19 +21,19 @@ conf_options['pacman'] = {'enabled': [], 'values': {'UseSyslog': None, 'Color': None, 'TotalDownload': None, 'CheckSpace': None, 'VerbosePkgLists': None}} def downloadPkg(pkgfile, dlfile): + url = os.path.join(url_base, pkgfile) # Prep the destination os.makedirs(os.path.dirname(dlfile), exist_ok = True) # Download the pacman package - with urlopen(pkgfile) as url: + with urlopen(url) as u: with open(dlfile, 'wb') as f: - f.write(url.read()) + f.write(u.read()) return() def installPkg(pkgfile): # Install it subprocess.run(['pacman', '-Syyu']) # Installing from an inconsistent state is bad, mmkay? subprocess.run(['pacman', '--noconfirm', '--needed', '-S', 'base-devel']) - subprocess.run(['pacman', '--noconfirm', '-Rdd', 'gcc']) # Required for multilib-devel subprocess.run(['pacman', '--noconfirm', '--needed', '-S', 'multilib-devel']) subprocess.run(['pacman', '--noconfirm', '--needed', '-U', pkgfile]) return() @@ -77,12 +79,16 @@ def configurePkg(opts, pkgr): def finishPkg(): # Finish installing (optional deps) - for p in ('apacman-deps', 'apacman-utils', 'git', 'customizepkg-scripting', 'pkgfile', 'rsync'): + for p in ('git', 'customizepkg-scripting', 'pkgfile', 'rsync'): subprocess.run(['apacman', '--noconfirm', '--needed', '-S', p]) def main(): - downloadPkg(pkg, local_pkg) - installPkg(local_pkg) + for p in pkgs: + pkg = pkg_base + p + fname = '{0}.tar.xz'.format(pkg) + local_pkg = os.path.join(local_dir, fname) + downloadPkg(fname, local_pkg) + installPkg(local_pkg) for tool in ('pacman', 'apacman'): configurePkg(conf_options[tool], tool) finishPkg()