tweaks to the apacman installer
This commit is contained in:
		
							parent
							
								
									48eb809e84
								
							
						
					
					
						commit
						3ccef84028
					
				| @ -7,8 +7,10 @@ import shutil | |||||||
| import subprocess | import subprocess | ||||||
| from urllib.request import urlopen | from urllib.request import urlopen | ||||||
| 
 | 
 | ||||||
| pkg = 'https://aif.square-r00t.net/cfgs/files/apacman.tar.xz' | pkg_base = 'apacman' | ||||||
| local_pkg = '/tmp/apacman.tar.xz' | pkgs = ('', '-deps', '-utils') | ||||||
|  | url_base = 'https://aif.square-r00t.net/cfgs/files' | ||||||
|  | local_dir = '/tmp' | ||||||
| 
 | 
 | ||||||
| conf_options = {} | conf_options = {} | ||||||
| conf_options['apacman'] = {'enabled': ['needed', 'noconfirm', 'noedit', 'progress', 'purgebuild', 'skipcache', 'keepkeys'], | 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}} |                           'values': {'UseSyslog': None, 'Color': None, 'TotalDownload': None, 'CheckSpace': None, 'VerbosePkgLists': None}} | ||||||
| 
 | 
 | ||||||
| def downloadPkg(pkgfile, dlfile): | def downloadPkg(pkgfile, dlfile): | ||||||
|  |     url = os.path.join(url_base, pkgfile) | ||||||
|     # Prep the destination |     # Prep the destination | ||||||
|     os.makedirs(os.path.dirname(dlfile), exist_ok = True) |     os.makedirs(os.path.dirname(dlfile), exist_ok = True) | ||||||
|     # Download the pacman package |     # Download the pacman package | ||||||
|     with urlopen(pkgfile) as url: |     with urlopen(url) as u: | ||||||
|         with open(dlfile, 'wb') as f: |         with open(dlfile, 'wb') as f: | ||||||
|             f.write(url.read()) |             f.write(u.read()) | ||||||
|     return() |     return() | ||||||
| 
 | 
 | ||||||
| def installPkg(pkgfile): | def installPkg(pkgfile): | ||||||
|     # Install it |     # Install it | ||||||
|     subprocess.run(['pacman', '-Syyu'])  # Installing from an inconsistent state is bad, mmkay? |     subprocess.run(['pacman', '-Syyu'])  # Installing from an inconsistent state is bad, mmkay? | ||||||
|     subprocess.run(['pacman', '--noconfirm', '--needed', '-S', 'base-devel']) |     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', '-S', 'multilib-devel']) | ||||||
|     subprocess.run(['pacman', '--noconfirm', '--needed', '-U', pkgfile]) |     subprocess.run(['pacman', '--noconfirm', '--needed', '-U', pkgfile]) | ||||||
|     return() |     return() | ||||||
| @ -77,12 +79,16 @@ def configurePkg(opts, pkgr): | |||||||
| 
 | 
 | ||||||
| def finishPkg(): | def finishPkg(): | ||||||
|     # Finish installing (optional deps) |     # 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]) |         subprocess.run(['apacman', '--noconfirm', '--needed', '-S', p]) | ||||||
| 
 | 
 | ||||||
| def main(): | def main(): | ||||||
|     downloadPkg(pkg, local_pkg) |     for p in pkgs: | ||||||
|     installPkg(local_pkg) |         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'): |     for tool in ('pacman', 'apacman'): | ||||||
|         configurePkg(conf_options[tool], tool) |         configurePkg(conf_options[tool], tool) | ||||||
|     finishPkg() |     finishPkg() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 brent s
						brent s