Automatically install dependencies with “dpkg -i”By neokrates, written on July 19, 2010
Here is a combination of
dpkg -i and
apt-get -f install which will install a package and its dependencies automatically
This snippet will only work if you Linux distro knows how to get all packages, which are required.
✔ Debian Lenny
Should also work for:
✔ any Linux distro
Generally, you do:
2. If it needs dependencies, get them automatically with
apt-get-f --force-yes --yes install.
dpkg -i has generated the list of unresolved dependencies,
apt-get -f will just pick it up.
3. Run the
dpkg -i again
git-core_1.7.1-1_all.deb, which allow me to get newest git on my Debian Lenny.
The problem is, if I do
dpkg -i git_1.7.1-1_i386.deb it complains about missing packages
libcurl3-gnutls liberror-perl libdigest-sha1-perl:
# dpkg -i git_1.7.1-1_i386.deb Selecting previously deselected package git. (Reading database ... 36488 files and directories currently installed.) Unpacking git (from tools/scm/git_1.7.1-1_i386.deb) ... dpkg: dependency problems prevent configuration of git: git depends on libcurl3-gnutls (>= 7.16.2-1); however: Package libcurl3-gnutls is not installed. git depends on liberror-perl; however: Package liberror-perl is not installed. git depends on libdigest-sha1-perl; however: Package libdigest-sha1-perl is not installed. dpkg: error processing git (--install): dependency problems - leaving unconfigured Processing triggers for man-db ... Errors were encountered while processing: git
To get the installation automatically on any similar System, I wrote this script:
dpkg -i git_1.7.1-1_i386.deb > /dev/null 2>&1 if [ $? -gt 0 ]; then apt-get -f --force-yes --yes install>/dev/null 2>&1 fi dpkg -i git_1.7.1-1_i386.deb > /dev/null 2 > &1 # This is needed to complet Git installation dpkg -i git-core_1.7.1-1_all.deb>/dev/null 2 > &1