how can a feed a file list into dpkg --get?

一曲冷凌霜 提交于 2019-12-13 05:24:47

问题


I can use dpkg --get-selections | grep -v deinstall | cut -f 1 | tr '\n' ' ' > listpackages.txt

to fill a file with all my installed packages.

Is there a to install using dpkg or apt and reference the listpackages.txt file created above?

I want to be able to backup what I have installed as a package list, reinstall my distro and finally in one command install everything I had installed on the previous version.

-thanks u2!


回答1:


apt-get install `cat listpackages.txt`




回答2:


Use the --set-selections flag to do this.

To export the package list from one system: dpkg --get-selections followed by whatever filtering you want.

To re-import the list to another system, pipe it into dpkg --set-selections, and then run aptitude install. The dpkg --set-selections command will only queue the install process; you then actually have to execute it.



来源:https://stackoverflow.com/questions/25688982/how-can-a-feed-a-file-list-into-dpkg-get

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!