tweaks to the apacman installer

This commit is contained in:
brent s 2018-01-12 19:22:26 -05:00
parent 48eb809e84
commit 3ccef84028
1 changed files with 14 additions and 8 deletions

View File

@ -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()