跳过对包的明确选择(并强制下载最新版本)

跳过对包的明确选择(并强制下载最新版本)

我输入sudo apt-get install lua并得到以下内容:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package lua is a virtual package provided by:
  lua5.3:i386 5.3.1-1
  lua5.2:i386 5.2.4-1
  lua5.1:i386 5.1.5-8
  lua50 5.0.3-7
  lua5.3 5.3.1-1
  lua5.2 5.2.4-1
  lua5.1 5.1.5-8
You should explicitly select one to install.

E: Package 'lua' has no installation candidate

我认为该软件包的作者希望您手动选择要安装的软件包。

有没有办法强制直接下载最新的软件包(在本例中为 5.3)?

答案1

快速破解一下:

sudo apt-get install \
    $(sudo apt-get install -s lua | \
        awk '/^ +lua/' | \
        cut -d : -f 1 | \
        sort -Vu -k2 | \
        awk 'END {print $1}')

或者

package="lua"
sudo apt-get install \
    $(sudo apt-get install -s "$package" | \
        awk '/^ +'"$package"'/' | \
        cut -d : -f 1 | \
        sort -Vu -k2 | \
        awk 'END {print $1}')

$ sudo apt-get install \
    $(sudo apt-get install -s lua | \
        awk '/^ +lua/' | \
        cut -d : -f 1 | \
        sort -Vu -k2 | \
        awk 'END {print $1}')
E: Package 'lua' has no installation candidate
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  lua5.3
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 103 kB of archives.
After this operation, 379 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ wily/main lua5.3 amd64 5.3.1-1 [103 kB]
Fetched 103 kB in 0s (215 kB/s)
Selecting previously unselected package lua5.3.
(Reading database ... 419661 files and directories currently installed.)
Preparing to unpack .../lua5.3_5.3.1-1_amd64.deb ...
Unpacking lua5.3 (5.3.1-1) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up lua5.3 (5.3.1-1) ...

相关内容