在 apt –upgradeable 中選擇相關包進行選擇性安裝
執行 Debian 我經常遇到大量可以升級的軟體包。我不想只是
apt upgrade
不小心做,所以我想先安裝“非嚴重”軟體包(及其相關的庫等 - 成組),然後再查看“嚴重”軟體包。在這個問題的末尾有一個 hacky 的方法,但我相信有更好的方法,以及這個問題可能會帶來更好的想法或擔憂。
問題:如何將相關軟體包的子組安裝在一起,從
apt list --upgradeable
?如果這裡是上述命令的輸出;
apparmor/testing 2.13.3-5+b1 amd64 [upgradable from: 2.13.3-5] gir1.2-atk-1.0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1] gir1.2-totem-1.0/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1] gjs/testing 1.58.1-1 amd64 [upgradable from: 1.58.0-2] gnome-calculator/testing 3.34.1-1 amd64 [upgradable from: 3.34.0-1] graphviz/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] hexchat/testing 2.14.2-5+b1 amd64 [upgradable from: 2.14.2-5] imagemagick-6.q16/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] imagemagick/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] iputils-ping/testing 3:20190709-2 amd64 [upgradable from: 3:20190709-1] libalgorithm-diff-xs-perl/testing 0.04-5+b2 amd64 [upgradable from: 0.04-5+b1] libapparmor1/testing 2.13.3-5+b1 amd64 [upgradable from: 2.13.3-5] libapt-pkg-perl/testing 0.1.36+b2 amd64 [upgradable from: 0.1.36+b1] libatk-adaptor/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3] libatk-bridge2.0-0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3] libatk-bridge2.0-dev/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3] libatk1.0-0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1] libatk1.0-data/testing 2.34.1-1 all [upgradable from: 2.34.0-1] libatk1.0-dev/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1] libatk1.0-doc/testing 2.34.1-1 all [upgradable from: 2.34.0-1] libb-hooks-op-check-perl/testing 0.22-1+b2 amd64 [upgradable from: 0.22-1+b1] libcairo-gobject-perl/testing 1.005-2+b1 amd64 [upgradable from: 1.005-2] libcairo-perl/testing 1.106-3+b2 amd64 [upgradable from: 1.106-3+b1] libcdt5/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libcgraph6/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libclass-xsaccessor-perl/testing 1.19-3+b3 amd64 [upgradable from: 1.19-3+b2] libclone-perl/testing 0.41-1+b2 amd64 [upgradable from: 0.41-1+b1] libcommon-sense-perl/testing 3.74-2+b8 amd64 [upgradable from: 3.74-2+b7] libdbd-mysql-perl/testing 4.050-2+b1 amd64 [upgradable from: 4.050-2] libdbi-perl/testing 1.642-1+b2 amd64 [upgradable from: 1.642-1+b1] libdevel-callchecker-perl/testing 0.008-1+b1 amd64 [upgradable from: 0.008-1] libfcgi-perl/testing 0.78-2+b4 amd64 [upgradable from: 0.78-2+b3] libfile-fcntllock-perl/testing 0.22-3+b6 amd64 [upgradable from: 0.22-3+b5] libgd-perl/testing 2.71-2+b1 amd64 [upgradable from: 2.71-2] libgdal-dev/testing 2.4.2+dfsg-1+b3 amd64 [upgradable from: 2.4.2+dfsg-1+b2] libgdal20/testing 2.4.2+dfsg-1+b3 amd64 [upgradable from: 2.4.2+dfsg-1+b2] libgjs0g/testing 1.58.1-1 amd64 [upgradable from: 1.58.0-2] libglib-object-introspection-perl/testing 0.047-1+b1 amd64 [upgradable from: 0.047-1] libglib-perl/testing 3:1.329.1-1+b1 amd64 [upgradable from: 3:1.329.1-1] libglib2.0-0/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3] libglib2.0-bin/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3] libglib2.0-data/testing 2.62.1-1 all [upgradable from: 2.62.0-3] libglib2.0-dev-bin/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3] libglib2.0-dev/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3] libglib2.0-doc/testing 2.62.1-1 all [upgradable from: 2.62.0-3] libgvc6/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libgvpr2/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libhtml-parser-perl/testing 3.72-3+b4 amd64 [upgradable from: 3.72-3+b3] libimage-magick-q16-perl/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] libio-pty-perl/testing 1:1.08-1.1+b6 amd64 [upgradable from: 1:1.08-1.1+b5] libjson-xs-perl/testing 4.020-1+b1 amd64 [upgradable from: 4.020-1] liblab-gamut1/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libldap-2.4-2/testing 2.4.48+dfsg-1+b1 amd64 [upgradable from: 2.4.48+dfsg-1] liblinux-epoll-perl/testing 0.016-1+b2 amd64 [upgradable from: 0.016-1+b1] liblist-moreutils-perl/testing 0.416-1+b5 amd64 [upgradable from: 0.416-1+b4] liblocale-gettext-perl/testing 1.07-3+b5 amd64 [upgradable from: 1.07-3+b4] liblz4-1/testing 1.9.1-2 amd64 [upgradable from: 1.8.3-1+b1] libmagick++-6.q16-8/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] libmagickcore-6.q16-6/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] libmagickwand-6.q16-6/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1] libnet-dbus-perl/testing 1.1.0-6+b1 amd64 [upgradable from: 1.1.0-6] libnet-dns-sec-perl/testing 1.13-1+b1 amd64 [upgradable from: 1.13-1] libnet-libidn-perl/testing 0.12.ds-3+b2 amd64 [upgradable from: 0.12.ds-3+b1] libnet-ssleay-perl/testing 1.88-1+b1 amd64 [upgradable from: 1.88-1] libpango-perl/testing 1.227-3+b2 amd64 [upgradable from: 1.227-3+b1] libparams-classify-perl/testing 0.015-1+b2 amd64 [upgradable from: 0.015-1+b1] libpathplan4/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libperlio-gzip-perl/testing 0.19-1+b6 amd64 [upgradable from: 0.19-1+b5] libpurple0/testing 2.13.0-2.2+b1 amd64 [upgradable from: 2.13.0-2.2] libpython2.7-dev/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] libpython2.7-minimal/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] libpython2.7-stdlib/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] libpython2.7/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] libpython3.7-dev/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] libpython3.7-minimal/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] libpython3.7-stdlib/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] libpython3.7/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] libref-util-xs-perl/testing 0.117-1+b2 amd64 [upgradable from: 0.117-1+b1] libsereal-decoder-perl/testing 4.007+ds-1+b1 amd64 [upgradable from: 4.007+ds-1] libsereal-encoder-perl/testing 4.007+ds-1+b1 amd64 [upgradable from: 4.007+ds-1] libsnmp30/testing 5.7.3+dfsg-5+b2 amd64 [upgradable from: 5.7.3+dfsg-5+b1] libsqlite3-0/testing 3.30.0-1 amd64 [upgradable from: 3.29.0-2] libsqlite3-dev/testing 3.30.0-1 amd64 [upgradable from: 3.29.0-2] libsub-name-perl/testing 0.21-1+b4 amd64 [upgradable from: 0.21-1+b3] libsvn1/testing 1.10.6-1+b1 amd64 [upgradable from: 1.10.6-1] libterm-readkey-perl/testing 2.38-1+b1 amd64 [upgradable from: 2.38-1] libtext-charwidth-perl/testing 0.04-9+b1 amd64 [upgradable from: 0.04-9] libtext-iconv-perl/testing 1.7-6+b2 amd64 [upgradable from: 1.7-6] libtotem0/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1] libtype-tiny-xs-perl/testing 0.016-1+b1 amd64 [upgradable from: 0.016-1] libunicode-utf8-perl/testing 0.62-1+b1 amd64 [upgradable from: 0.62-1] libxdot4/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7] libxml-libxml-perl/testing 2.0134+dfsg-1+b1 amd64 [upgradable from: 2.0134+dfsg-1] libxml-parser-perl/testing 2.46-1+b1 amd64 [upgradable from: 2.46-1] libyaml-libyaml-perl/testing 0.80+repack-2+b1 amd64 [upgradable from: 0.80+repack-2] libzbar0/testing 0.23-1.1+b1 amd64 [upgradable from: 0.23-1.1] linux-compiler-gcc-8-x86/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1] linux-headers-5.2.0-3-amd64/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1] linux-kbuild-5.2/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1] linux-libc-dev/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1] meson/testing 0.52.0-1 all [upgradable from: 0.51.2-1] node-yargs-parser/testing 15.0.0-1 all [upgradable from: 14.0.0-2] openjdk-11-jdk-headless/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2] openjdk-11-jdk/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2] openjdk-11-jre-headless/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2] openjdk-11-jre/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2] openssh-client/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7] openssh-server/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7] openssh-sftp-server/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7] perl-base/testing 5.30.0-6 amd64 [upgradable from: 5.28.1-6] perl/testing 5.30.0-6 amd64 [upgradable from: 5.28.1-6] pidgin/testing 2.13.0-2.2+b1 amd64 [upgradable from: 2.13.0-2.2] python2.7-dev/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] python2.7-minimal/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] python2.7/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4] python3.7-dev/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] python3.7-minimal/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] python3.7/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1] subversion/testing 1.10.6-1+b1 amd64 [upgradable from: 1.10.6-1] texinfo/testing 6.6.0.dfsg.1-2+b1 amd64 [upgradable from: 6.6.0.dfsg.1-2] totem-common/testing 3.34.1-2 all [upgradable from: 3.34.0-1] totem-plugins/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1] totem/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1] usb.ids/testing 2019.10.05-1 all [upgradable from: 2019.07.27-1]
我想首先更新/安裝所有與 python2 相關的東西。所以我會這樣做:
sudo apt-get -s install $(sudo apt list --upgradeable | cut -d " " -f 1 | sed 's/\/[a-z]*$//' | awk '/python3/' | tr "\n" " ")
當然,每次都
pipe
可以將其分解為碎片,並可能分解為>
文件。我還注意到
apt
聲稱腳本不穩定。當然,它似乎
apt-get
也會接受包的“垂直列表”,例如sudo apt-get -s install $(sudo apt list --upgradeable | cut -d " " -f 1 | sed 's/\/[a-z]*$//' | awk '/python3/')
當然只使用一個
sudo
。這是我經常做的事情,因此希望(很可能)有更好的方法和/或也可以幫助其他人。PS我認為這個如何使用apt選擇不完整的軟體包範圍? 而這個如何使用 apt 選擇不完整的軟體包範圍?問題很接近,但不是我想要的。
我試圖讓@Jasen 回答工作- apt: Install all php packages 無論如何
apt-cache search
,但它從而不是池中提取apt list --upgradeable
,但即使他似乎也不喜歡它(儘管它比我使用的要優雅得多)。
正如Ferenc Wágner 所說,
aptitude
每當我想對更細粒度的軟體包選擇進行操作時,我都會使用,而不是“所有可以升級的東西”。我假設您沒有預定義的包集,您可以在腳本中為其編寫匹配測試,因此更適合採用更具互動性的方法;aptitude
的 TUI 非常適合這種工作。預設情況下,它按“虛擬”狀態(安全更新、其他可升級包、新包、已安裝包、未安裝包、過時包、虛擬包和任務;
aptitude
將其稱為“狀態”)呈現包,並在每個狀態,按部分,最後按存檔。因此,今天的一組 OpenSSL 更新顯示為這與您所追求的不太匹配,但是
aptitude
的顯示是高度可定制的,並且包可以按源包名稱分組,甚至可以按您關心的任何模式進行分組;例如,按狀態、優先級和源包:您可以在執行時切換視圖 ( ),或在的配置文件
G
中配置您喜歡的視圖。aptitude
+
將選擇要升級的軟體包以及任何相關的升級;aptitude
還將突出顯示任何損壞的內容。因此,在僅選擇libssl1.1
升級後:在這一點上,我可以尋求
aptitude
幫助以解決損壞問題,或者繼續自己選擇升級包。在實際做之前g
會告訴我我要求做的所有事情。aptitude
在繼續之前,我還可以查看包的更改日誌,並檢查所有可用版本等。以
aptitude
這種方式使用還避免了任何涉及apt install
(orapt-get install
) 的方法的重大缺點:它不會失去“自動安裝”標誌。