主机平台:Gentoo Linux 11.2
内核版本:Linux Kernel 3.2.1
原创作品,转载请标明出处http://blog.csdn.net/yming0221/article/details/7412997
我们都喜欢Gentoo下的软件安装,多亏了Portage的技术,高度定制,编译安装过程中基本不会出现依赖的错误,也不会存在源码安装情况下的版本问题。不过自己感觉如果从源中emerge安装来一个软件,它会自动解决依赖,也会装一些其他的包,当我们将这个软件卸载后,其他的软件包貌似没有完全删除。
下面我就通过日志信息来还原安装前的状态。
首先查看日志,将/var/log/emerge.log下相应时间戳的内容复制到一个空白文件pack.log中。
形如:
1332998017: === (1 of 17) Cleaning (dev-libs/kpathsea-6.0.1_p20110705::/usr/portage/dev-libs/kpathsea/kpathsea-6.0.1_p20110705.ebuild) 1332998021: === (1 of 17) Compiling/Merging (dev-libs/kpathsea-6.0.1_p20110705::/usr/portage/dev-libs/kpathsea/kpathsea-6.0.1_p20110705.ebuild) 1332998097: === (1 of 17) Merging (dev-libs/kpathsea-6.0.1_p20110705::/usr/portage/dev-libs/kpathsea/kpathsea-6.0.1_p20110705.ebuild) 1332998099: >>> AUTOCLEAN: dev-libs/kpathsea:0 1332998106: === (1 of 17) Post-Build Cleaning (dev-libs/kpathsea-6.0.1_p20110705::/usr/portage/dev-libs/kpathsea/kpathsea-6.0.1_p20110705.ebuild) 1332998106: ::: completed emerge (1 of 17) dev-libs/kpathsea-6.0.1_p20110705 to / 1332998106: >>> emerge (2 of 17) dev-libs/zziplib-0.13.60-r1 to / 1332998106: === (2 of 17) Cleaning (dev-libs/zziplib-0.13.60-r1::/usr/portage/dev-libs/zziplib/zziplib-0.13.60-r1.ebuild) 1332998107: === (2 of 17) Compiling/Merging (dev-libs/zziplib-0.13.60-r1::/usr/portage/dev-libs/zziplib/zziplib-0.13.60-r1.ebuild) 1332998158: === (2 of 17) Merging (dev-libs/zziplib-0.13.60-r1::/usr/portage/dev-libs/zziplib/zziplib-0.13.60-r1.ebuild) 1332998159: >>> AUTOCLEAN: dev-libs/zziplib:0 1332998160: === (2 of 17) Post-Build Cleaning (dev-libs/zziplib-0.13.60-r1::/usr/portage/dev-libs/zziplib/zziplib-0.13.60-r1.ebuild) 1332998160: ::: completed emerge (2 of 17) dev-libs/zziplib-0.13.60-r1 to / 1332998160: >>> emerge (3 of 17) dev-tex/bibtexu-3.71_p20110705 to / 1332998160: === (3 of 17) Cleaning (dev-tex/bibtexu-3.71_p20110705::/usr/portage/dev-tex/bibtexu/bibtexu-3.71_p20110705.ebuild) 1332998165: === (3 of 17) Compiling/Merging (dev-tex/bibtexu-3.71_p20110705::/usr/portage/dev-tex/bibtexu/bibtexu-3.71_p20110705.ebuild) 1332998229: === (3 of 17) Merging (dev-tex/bibtexu-3.71_p20110705::/usr/portage/dev-tex/bibtexu/bibtexu-3.71_p20110705.ebuild) 1332998231: >>> AUTOCLEAN: dev-tex/bibtexu:0 1332998233: === (3 of 17) Post-Build Cleaning (dev-tex/bibtexu-3.71_p20110705::/usr/portage/dev-tex/bibtexu/bibtexu-3.71_p20110705.ebuild) 1332998233: ::: completed emerge (3 of 17) dev-tex/bibtexu-3.71_p20110705 to / 1332998233: >>> emerge (4 of 17) app-text/dvipsk-5.991_p20110705-r1 to / 1332998233: === (4 of 17) Cleaning (app-text/dvipsk-5.991_p20110705-r1::/usr/portage/app-text/dvipsk/dvipsk-5.991_p20110705-r1.ebuild) 1332998238: === (4 of 17) Compiling/Merging (app-text/dvipsk-5.991_p20110705-r1::/usr/portage/app-text/dvipsk/dvipsk-5.991_p20110705-r1.ebuild) 1332998313: === (4 of 17) Merging (app-text/dvipsk-5.991_p20110705-r1::/usr/portage/app-text/dvipsk/dvipsk-5.991_p20110705-r1.ebuild) 1332998314: >>> AUTOCLEAN: app-text/dvipsk:0 1332998316: === (4 of 17) Post-Build Cleaning (app-text/dvipsk-5.991_p20110705-r1::/usr/portage/app-text/dvipsk/dvipsk-5.991_p20110705-r1.ebuild) 1332998316: ::: completed emerge (4 of 17) app-text/dvipsk-5.991_p20110705-r1 to / 1332998316: >>> emerge (5 of 17) app-text/ps2pkm-1.5_p20110705 to / 1332998316: === (5 of 17) Cleaning (app-text/ps2pkm-1.5_p20110705::/usr/portage/app-text/ps2pkm/ps2pkm-1.5_p20110705.ebuild) 1332998321: === (5 of 17) Compiling/Merging (app-text/ps2pkm-1.5_p20110705::/usr/portage/app-text/ps2pkm/ps2pkm-1.5_p20110705.ebuild) 1332998376: === (5 of 17) Merging (app-text/ps2pkm-1.5_p20110705::/usr/portage/app-text/ps2pkm/ps2pkm-1.5_p20110705.ebuild) 1332998377: >>> AUTOCLEAN: app-text/ps2pkm:0 1332998379: === (5 of 17) Post-Build Cleaning (app-text/ps2pkm-1.5_p20110705::/usr/portage/app-text/ps2pkm/ps2pkm-1.5_p20110705.ebuild) 1332998379: ::: completed emerge (5 of 17) app-text/ps2pkm-1.5_p20110705 to / 1332998379: >>> emerge (6 of 17) x11-proto/printproto-1.0.5 to / 1332998379: === (6 of 17) Cleaning (x11-proto/printproto-1.0.5::/usr/portage/x11-proto/printproto/printproto-1.0.5.ebuild) 1332998379: === (6 of 17) Compiling/Merging (x11-proto/printproto-1.0.5::/usr/portage/x11-proto/printproto/printproto-1.0.5.ebuild) 1332998390: === (6 of 17) Merging (x11-proto/printproto-1.0.5::/usr/portage/x11-proto/printproto/printproto-1.0.5.ebuild) 1332998392: >>> AUTOCLEAN: x11-proto/printproto:0 1332998393: === (6 of 17) Post-Build Cleaning (x11-proto/printproto-1.0.5::/usr/portage/x11-proto/printproto/printproto-1.0.5.ebuild) 1332998393: ::: completed emerge (6 of 17) x11-proto/printproto-1.0.5 to / 1332998393: >>> emerge (7 of 17) virtual/perl-Getopt-Long-2.380.0-r1 to / 1332998393: === (7 of 17) Cleaning (virtual/perl-Getopt-Long-2.380.0-r1::/usr/portage/virtual/perl-Getopt-Long/perl-Getopt-Long-2.380.0-r1.ebuild) 1332998394: === (7 of 17) Compiling/Merging (virtual/perl-Getopt-Long-2.380.0-r1::/usr/portage/virtual/perl-Getopt-Long/perl-Getopt-Long-2.380.0-r1.ebuild) 1332998397: === (7 of 17) Merging (virtual/perl-Getopt-Long-2.380.0-r1::/usr/portage/virtual/perl-Getopt-Long/perl-Getopt-Long-2.380.0-r1.ebuild) 1332998397: >>> AUTOCLEAN: virtual/perl-Getopt-Long:0 1332998398: === (7 of 17) Post-Build Cleaning (virtual/perl-Getopt-Long-2.380.0-r1::/usr/portage/virtual/perl-Getopt-Long/perl-Getopt-Long-2.380.0-r1.ebuild) 1332998398: ::: completed emerge (7 of 17) virtual/perl-Getopt-Long-2.380.0-r1 to / 1332998399: >>> emerge (8 of 17) dev-tex/luatex-0.70.1 to / 1332998399: === (8 of 17) Cleaning (dev-tex/luatex-0.70.1::/usr/portage/dev-tex/luatex/luatex-0.7
cat pack.log | grep ">>> emerge (" >> pack
1332998106: >>> emerge (2 of 17) dev-libs/zziplib-0.13.60-r1 to / 1332998160: >>> emerge (3 of 17) dev-tex/bibtexu-3.71_p20110705 to / 1332998233: >>> emerge (4 of 17) app-text/dvipsk-5.991_p20110705-r1 to / 1332998316: >>> emerge (5 of 17) app-text/ps2pkm-1.5_p20110705 to / 1332998379: >>> emerge (6 of 17) x11-proto/printproto-1.0.5 to / 1332998393: >>> emerge (7 of 17) virtual/perl-Getopt-Long-2.380.0-r1 to / 1332998399: >>> emerge (8 of 17) dev-tex/luatex-0.70.1 to / 1332998585: >>> emerge (9 of 17) x11-libs/libXp-1.0.1 to / 1332998605: >>> emerge (10 of 17) app-text/texlive-core-2011-r6 to / 1332999248: >>> emerge (11 of 17) dev-texlive/texlive-documentation-base-2011 to / 1332999255: >>> emerge (12 of 17) dev-texlive/texlive-basic-2011-r1 to / 1332999294: >>> emerge (13 of 17) dev-texlive/texlive-fontutils-2011 to / 1332999302: >>> emerge (14 of 17) dev-texlive/texlive-latex-2011 to / 1332999333: >>> emerge (15 of 17) dev-texlive/texlive-latexrecommended-2011 to / 1332999373: >>> emerge (16 of 17) virtual/latex-base-1.0 to / 1332999378: >>> emerge (17 of 17) app-vim/vim-latex-1.8.23.20110214 to / 1333027173: >>> emerge (1 of 13) app-admin/eselect-ruby-20100603 to / 1333027179: >>> emerge (2 of 13) app-text/teckit-2.5.1 to / 1333027254: >>> emerge (3 of 13) media-libs/silgraphite-2.3.1 to / 1333027347: >>> emerge (4 of 13) app-text/xdvipdfmx-0.7.8_p20100722 to / 1333027417: >>> emerge (5 of 13) app-text/texlive-core-2011-r6 to / 1333028348: >>> emerge (6 of 13) dev-lang/ruby-1.8.7_p357 to / 1333028497: >>> emerge (7 of 13) dev-texlive/texlive-latex-2011 to / 1333028526: >>> emerge (8 of 13) dev-texlive/texlive-fontsrecommended-2011 to / 1333028642: >>> emerge (9 of 13) dev-texlive/texlive-genericrecommended-2011 to / 1333028649: >>> emerge (10 of 13) dev-texlive/texlive-pictures-2011 to / 1333028670: >>> emerge (11 of 13) dev-texlive/texlive-latexextra-2011-r2 to / 1333028788: >>> emerge (12 of 13) dev-texlive/texlive-mathextra-2011 to / 1333028808: >>> emerge (13 of 13) dev-texlive/texlive-xetex-2011 to / 1333069989: >>> emerge (1 of 2) virtual/tex-base-0 to / 1333069998: >>> emerge (2 of 2) app-text/dvipdfmx-20110311 to / 1333105118: >>> emerge (1 of 1) dev-tex/cjk-latex-4.8.2 to / 1333108086: >>> emerge (1 of 24) app-text/t1utils-1.36 to / 1333108100: >>> emerge (2 of 24) dev-texlive/texlive-metapost-2011 to / 1333108113: >>> emerge (3 of 24) dev-texlive/texlive-texinfo-2011 to / 1333108121: >>> emerge (4 of 24) dev-texlive/texlive-langcyrillic-2011 to / 1333108170: >>> emerge (5 of 24) app-text/texi2html-1.78 to / 1333108182: >>> emerge (6 of 24) app-text/psutils-1.17 to / 1333108190: >>> emerge (7 of 24) app-text/ps2eps-1.64 to / 1333108196: >>> emerge (8 of 24) media-gfx/sam2p-0.47 to / 1333108235: >>> emerge (9 of 24) dev-texlive/texlive-htmlxml-2011 to / 1333108243: >>> emerge (10 of 24) dev-texlive/texlive-langenglish-2011 to / 1333108258: >>> emerge (11 of 24) media-libs/t1lib-5.1.2 to /
然后使用cut命令剪切软件包名称部分,保存到pack1
cut -d' ' -f8-9 pack >> pack1
卸载软件包的包的名称不能接软件的版本信息,只好手动删除了(汗......我也知道一句简单的命令可以搞定)
然后将回车符号全部替换为空格,最后得到pack2文件
形如:
dev-libs/zziplib-0.13.60-r1 dev-tex/bibtexu-3.71_p20110705 app-text/dvipsk-5.991_p20110705-r1 app-text/ps2pkm-1.5_p20110705 x11-pro /printpro -1.0.5 virtual/perl-Ge pt-Long-2.380.0-r1 dev-tex/luatex-0.70.1 x11-libs/libXp-1.0.1 app-text/texlive-core-2011-r6 dev-texlive/texlive-documentation-base-2011 dev-texlive/texlive-basic-2011-r1 dev-texlive/texlive-fontutils-2011 dev-texlive/texlive-latex-2011 dev-texlive/texlive-latexrecommended-2011 virtual/latex-base-1.0 app-vim/vim-latex-1.8.23.20110214 app-admin/eselect-ruby-20100603 app-text/teckit-2.5.1 media-libs/silgraphite-2.3.1 app-text/xdvipdfmx-0.7.8_p20100722 app-text/texlive-core-2011-r6 dev-lang/ruby-1.8.7_p357 dev-texlive/texlive-latex-2011 dev-texlive/texlive-fontsrecommended-2011 dev-texlive/texlive-genericrecommended-2011 dev-texlive/texlive-pictures-2011 dev-texlive/texlive-latexextra-2011-r2 dev-texlive/texlive-mathextra-2011 dev-texlive/texlive-xetex-2011 virtual/tex-base-0 app-text/dvipdfmx-20110311 dev-tex/cjk-latex-4.8.2 app-text/t1utils-1.36 dev-texlive/texlive-metapost-2011 dev-texlive/texlive-texinfo-2011 dev-texlive/texlive-langcyrillic-2011 app-text/texi2html-1.78 app-text/psutils-1.17 app-text/ps2eps-1.64 media-gfx/sam2p-0.47 dev-texlive/texlive-htmlxml-2011 dev-texlive/texlive-langenglish-2011 media-libs/t1lib-5.1.2 dev-tex/xcolor-2.11 dev-tex/xmltex-1.9-r2 app-text/xdvik-22.84.16 media-libs/freetype-1.4_pre20080316-r2 app-text/lcdf-type ols-2.91 dev-tex/feynmf-1.08-r3 media-libs/gd-2.0.35-r3 virtual/texi2dvi-0 app-text/dvipng-1.14 app-text/passivetex-1.25 dev-tex/pgf-2.10 dev-tex/latex-beamer-3.11 app-text/texlive-2011
这样使用命令emerge -C 然后粘贴包名到控制台即可。软件包彻底移除。