def debian_package_install(packages):
 cmds = []
 (reg_packages, url_packages) = ([], [])
 for package in packages:
  if package.startswith('http'):
   url_packages.append(package)
  else:
   reg_packages.append(package)
 if reg_packages:
  cmds.append('apt-get -y install --no-install-recommends {}'.format(' '.join(reg_packages)))
  cmds.append('apt-get clean')
 for url in url_packages:
  name = url[(url.rfind('/') + 1):]
  cmds.extend(['curl --location {} -o {}'.format(url, name), 'dpkg -i {}'.format(name), 'rm -rf {}'.format(name)])
 return ' && '.join(cmds)

def debian_package_install ( packages ) : cmds = [ ] ( reg_packages , url_packages ) = ( [ ] , [ ] ) for package in packages : if package . startswith ( 'http' ) : url_packages . append ( package ) else : reg_packages . append ( package ) if reg_packages : cmds . append ( 'apt-get -y install --no-install-recommends {}' . format ( ' ' . join ( reg_packages ) ) ) cmds . append ( 'apt-get clean' ) for url in url_packages : name = url [ ( url . rfind ( '/' ) + 1 ) : ] cmds . extend ( [ 'curl --location {} -o {}' . format ( url , name ) , 'dpkg -i {}' . format ( name ) , 'rm -rf {}' . format ( name ) ] ) return ' && ' . join ( cmds )
jinja utility method for building debian-based package install command apt-get is not capable of installing .