我从 Fink 切换到 HomeBrew,我想卸载 Fink 和我安装的所有软件包以避免将来出现问题。
我发现这个 perl 代码片段应该可以删除所有包,但是它却没有:
fink list | perl -lne '/^s*is+(S+)/ and print $1' | xargs fink purge
我怎样才能删除所有软件包?
答案1
通过使用反引号可以简单地避免 xargs 的 -r 问题:
fink purge `fink list | perl -lne '/^\s*i\s+(\S+)/ and print $1'`
答案2
我不熟悉 fink,但我假设它fink list
为每个软件包都输出一行,并且对于已安装的软件包,它们的格式为:i packagename
。问题是你使用了s
and S
(文字字符)而不是\s
and \S
:分别是空格和非空格。
正确的做法可能是:
fink list | perl -lne '/^\s*i\s+(\S+)/ and print $1' | xargs -r fink purge
我还在 xargs 中添加了,-r
这样fink purge
如果没有任何匹配的行(已安装的包),它就不会运行。
答案3
来自fink 常见问题解答:
Q5.6: How can I uninstall all of Fink?
A: Almost all files installed by Fink are in /sw (or wherever
you chose to install it), except for a few exceptions.
Thus, in order to get rid of Fink, enter this command:
fink remove --recursive daemonic xinitrc
sudo rm -rf /sw
If you aren't planning to reinstall Fink you also will
want to remove the "source /sw/bin/init.csh" line you
added to your .cshrc file or the "source /sw/bin/init.sh"
line you added to your .bashrc file, whichever is appropriate
to your setup, using a text editor. If you had the xinitrc
package installed, then you will want to restore the original
/usr/X11/lib/X11/xinit/xinitrc, which has been backed up as
/usr/X11/lib/X11/xinit/xinitrc.YYYYMMDDhhmm, i.e. the
extension has a year, month, date, hour, and minute). If you
have more than one of these, the original one normally does
not mention sys-xinitrc-fink. Once you've found the right one,
you can use
sudo mv /usr/X11/lib/X11/xinit/xinitrc.YYYYMMDDhhmm \
/usr/X11/lib/X11/xinit/xinitrc
replacing YYMMDDhhmm with the actual extension on your system.