GithubHelp home page GithubHelp logo

seatgeek / bash-aptfile Goto Github PK

View Code? Open in Web Editor NEW
93.0 93.0 8.0 21 KB

A simple method of defining apt-get dependencies for an application

Home Page: http://chairnerd.seatgeek.com/managing-application-server-dependencies/

License: BSD 3-Clause "New" or "Revised" License

Makefile 8.11% Shell 79.24% Dockerfile 12.65%

bash-aptfile's People

Contributors

5nafu avatar ad7six avatar josegonzalez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bash-aptfile's Issues

There should be a primitive for repository keys

Adding a normal repository (i.e. not a ppa ) add-apt-repository will not install the repository key:

REPOSITORY can be either a line that can be added directly to sources.list(5), in the form ppa:/ for adding Personal Package Archives, [...]

In the first form, REPOSITORY will just be appended to /etc/apt/sources.list.

In the second form, ppa:/ will be expanded to the full deb line of the PPA and added into a new file in the /etc/apt/sources.list.d/ directory. The GPG public key of the newly added PPA will also be downloaded and added to apt's keyring.

(emphasis from me)

If we use aptfile to add a repository, there should be an option to add the appropriate key as well.

I would suggest three distinct ways to install a key:

  1. installing from a local file
  2. installing from an URL (starting with http(s)://)
  3. installing with only a keyid (starting with "0x"?)

This probably would be needed for #4 as well.

looks like aptfile ignores the first line of an Aptfile

I'm usually run aptfile as a binary with an argument as aptfile .../Aptfile, and not as a script 'compiler'.
i.e. I don't use the 'hash-bang' in the first line

so.. if my Aptfile has only one line in it, the aptfile Aptfile will fail with an error:

/usr/local/bin/aptfile: line 292: /tmp/aptfile.4682.out: Success

If I add another line to Aptfile it works, but it still ignores the first line
e.g. if my Aptfile looks like this:

package 'qweqweqwe'
package 'bash'

aptfile Aptfile succeeds:

> aptfile Aptfile
[OK] package bash

--force-yes is deprecated

Running Ubuntu 18.04.3 LTS. Not sure when this got deprecated, but dpkg is throwing a warning.

W: --force-yes is deprecated, use one of the options starting with --allow instead.

apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -qq -y --force-yes install "$pkg"

"repository" primitive retries adding repositories if the architecture is set

When adding repositories with an architecture option, aptfile will alway assume it is not installed and tries to reinstall it.

How to reproduce:

  • create an aptfile with repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main"
  • run the aptfile at least twice

Expected behaviour:

  • Aptfile tries to add the repository only once (at most)

Actual behaviour:

  • Aptfile tries to add the repository on every run.

Adding repositories to source.list.d instead of source.list

User story: I am a system administrator. I would like to add a list of repositories to a single file in /etc/apt/sources.list.d/ rather than append to /etc/apt/sources.list, so that I see and manage groups of repositories.

For example, if I were installing FusionDirectory, I would want to create /etc/apt/sources.list.d/fusiondirectory.list with the following content:

deb http://repos.fusiondirectory.org/fusiondirectory-current/debian-jessie jessie main
deb-src http://repos.fusiondirectory.org/fusiondirectory-current/debian-jessie jessie main
deb http://repos.fusiondirectory.org/fusiondirectory-extra/debian-jessie jessie main
deb-src http://repos.fusiondirectory.org/fusiondirectory-extra/debian-jessie jessie main

Suggested implementation:

A new primitive called repository_file that works as follows:

repository_file "fusiondirectory.list" "deb http://repos.fusiondirectory.org/fusiondirectory-current/debian-jessie jessie main"
repository_file "fusiondirectory.list" "deb-src http://repos.fusiondirectory.org/fusiondirectory-current/debian-jessie jessie main"
...

Feature Request: Allow the installation of a package from an URL

Some vendors/developers supply the user with a download URL for their debian package (for example google-chrome or xnview).
This package might or might not contain a repository configuration in itself (like google-chrome). As aptfile writes the configuration to /etc/apt/sources.list when repository is used, this might result in multiple configurations for the same repository (See #4 for a related feature request). Apt will print multiple warnings if re repo is defined multiple times.

There is an undocumented feature in apt (and apparently in apt-get as well) to install local files similar to dpkg -i, but with the added benefit of doing (remote) dependency resolutions. This feature seems to be in apt since around 2015 (Version 1.2ish, see i3/i3.github.io#35 (comment) and Debian/apt@5465192).

I would like to propose a new primitive to aptfile to allow the installation of a package from an URL using the above mentioned feature for apt.
The User could supply a package name and URL for aptfile to check if a given package is installed and, if not, download & install the package for the URL.

Feature Request: Install multiple packages in one go

I would like to propose a new primitive to install multiple packages at once.
The way aptfile currently works is to start apt-get for each package separately resulting in quite a bit of overhead due to, for example, dependency resolution.
If there would be a way to install multiple packages simultaneously, this overhead would be minimized.

This new primitive, let's call it packagelist for the sake of this issue, might first check if any supplied packages are already installed, put all others into a list and install them with a single apt-get call.

I tested the below function with a list of 119 Packages (with a local apt-mirror) resulting the following runtimes:

first run second run
package 10m36.869s 0m2.930s
packagelist 5m28.567s 0m2.852s

Testsetup:

  • kvm virtual machine in with nonpersistent storage
  • manually updated apt-cache (outside from aptfile)
  • copied aptfile and configuration files to the VM
  • ran one configuration file with time sudo ./aptfile <configfile> twice
  • rebooted the VM and restarted with the other config file

One disadvantage is, that the user will not receive immediate feedback on what aptfile is installing before the run of apt-get finished, another, that errors in the packagelist (missing or broken packages) will fail the complete installation of all packages in the list.

function packagelist {
  [[ $TRACE ]] && set -x
  [[ -z $1 ]] && log_fail "Please specify at least one package to install"
  local input_packages=$@
  local install_packages=()
  for pkg in $input_packages; do
    dpkg --force-confnew -s "$pkg" > "$TMP_APTFILE_LOGFILE" 2>&1 && log_info "${APTFILE_CYAN}[OK]${APTFILE_COLOR_OFF} package $pkg" && continue
    install_packages+=($pkg)
  done
  if [[ ${#install_packages[@]} -gt 0 ]]; then
    apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" -qq -y --force-yes install ${install_packages[@]}
    [[ $? -eq 0 ]] || log_fail "${APTFILE_RED}[FAIL]${APTFILE_COLOR_OFF} packages ${install_packages[@]}"
    log_info "${APTFILE_GREEN}[NEW]${APTFILE_COLOR_OFF} packages ${install_packages[@]}"
  fi
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.