我从 cisco 下载了文件(ubuntu 安装文件(带教程/学生版))并提取了文件。生成一个文件夹Packettracer62Student
。我运行了文件夹中的文件安装。同意 EULA,脚本下载了所有需要的文件。基本上一切都运行正常。
问题是我想卸载packettracer
但找不到任何有用的方法。
我已经尝试过sudo apt-get remove --purge packettracer
,还有dpkg -r packettracer
。两者都显示找不到包。我尝试了grep
它以防它的名称不同,但仍然没有结果。
我可以通过什么选项来删除软件(包)packettracer62
?
这是./install
我从包中使用的脚本:(抱歉,格式不对,一旦我弄清楚如何正确输入脚本,我就会对其进行编辑)
#!/bin/bash
# Thanks to Felix Wolf ([email protected]) for providing this install script.
# Thanks to Paul Fedele for providing script to check/download 32-bit library on a 64-bit machine
initInstall ()
{
echo
echo Welcome to Cisco Packet Tracer 6.2 Installation
echo
echo Read the following End User License Agreement \"EULA\" carefully. You must accept the terms of this EULA to install and use Cisco Packet Tracer.
echo "Press the Enter key to read the EULA."
echo
read cont
more eula.txt
echo "Do you accept the terms of the EULA? (Y)es/(N)o"
echo
read input
case "$input" in
yes|YES|Yes|Y|y)
(installer);;
esac
exit 0
}
installer ()
{
SDIR=`dirname $_`
ARCHITECTURE=$(uname -m)
INSTALL_32BIT_LIBRARY=false
echo "You have accepted the terms to the EULA. Congratulations. Packet Tracer will now be installed."
read -p "Enter location to install Cisco Packet Tracer or press enter for default [/opt/pt]: " IDIR
if [ -z $IDIR ]; then
IDIR="/opt/pt"
fi
if [ $ARCHITECTURE = "x86_64" ]; then
DEPENDS=$(dpkg -l | grep yelp | tail -n 1 | cut -c1)
if [ $DEPENDS = "i" ]; then
TESTCONNECTION=`wget --tries=3 --timeout=15 www.cisco.com -O /tmp/testinternet &>/dev/null 2>&1`
if [ $? != 0 ]; then
echo -"You are not connected to the Internet. Please check your Internet connection and try again."; exit 0
else
INSTALL_32BIT_LIBRARY=true
fi
fi
fi
if [ -e $IDIR ]; then
read -p "It appears that Packet Tracer is already installed. Do you wish to replace it? [Yn] " NEEDREPLACE
if [ "$NEEDREPLACE" = "y" ] || [ "$NEEDREPLACE" = "Y" ] || [ -z $NEEDREPLACE ]; then
sudo rm -rf $IDIR
else
echo "Program Terminated"; exit 0
fi
fi
QIDIR=${IDIR//\//\\\\\/}
echo Installing into $IDIR
if mkdir $IDIR > /dev/null 2>&1; then
if cp -r $SDIR/* $IDIR; then
echo Copied all files successfully to $IDIR
fi
sh -c "sed s/III/$QIDIR/ $SDIR/tpl.packettracer > $IDIR/packettracer"
chmod a+x $IDIR/packettracer
sh -c "sed s/III/$QIDIR/ $SDIR/tpl.linguist > $IDIR/linguist"
chmod a+x $IDIR/linguist
if touch /usr/share/applications/pt6.desktop > /dev/null 2>&1; then
echo -e "[Desktop Entry]\nExec=PacketTracer6\nIcon=pt6\nType=Application\nTerminal=false\nName=Packet Tracer 6.2" | tee /usr/share/applications/pt6.desktop > /dev/null
rm -f /usr/share/icons/hicolor/48x48/apps/pt6.png
gtk-update-icon-cache -f -q /usr/share/icons/hicolor
sleep 10
cp $SDIR/art/app_student.png /usr/share/icons/hicolor/48x48/apps/pt6.png
gtk-update-icon-cache -f -q /usr/share/icons/hicolor
fi
if [ "$INSTALL_32BIT_LIBRARY" = true ]; then
echo "Installing 32 bit libraries for Packet Tracer."
dpkg --add-architecture i386
apt-get -y install lib32z1
apt-get -y install lib32ncurses5
apt-get -y install lib32bz2-1.0
apt-get -y install libgcc1:i386
apt-get -y install libstdc++6:i386
apt-get -y install libssl-dev:i386
apt-get -y install libqtwebkit4:i386
apt-get -y install libqt4-scripttools:i386
fi
else
echo
echo Not able to create and copy files to $IDIR
read -p "Should we try to gain root access with sudo? [Yn] " QSD
if [ "$QSD" = "y" ] || [ "$QSD" = "Y" ] || [ -z $QSD ]; then
if sudo mkdir $IDIR; then
echo Installing into $IDIR
if sudo cp -r $SDIR/* $IDIR; then
echo Copied all files successfully to $IDIR
else
echo
echo Not able to copy files to $IDIR
echo Exiting installation
exit
fi
sudo sh -c "sed s/III/$QIDIR/ $SDIR/tpl.packettracer > $IDIR/packettracer"
sudo chmod a+x $IDIR/packettracer
sudo sh -c "sed s/III/$QIDIR/ $SDIR/tpl.linguist > $IDIR/linguist"
sudo chmod a+x $IDIR/linguist
if sudo touch /usr/share/applications/pt6.desktop; then
echo -e "[Desktop Entry]\nExec=PacketTracer6\nIcon=pt6\nType=Application\nTerminal=false\nName=Packet Tracer 6.2" | sudo tee /usr/share/applications/pt6.desktop > /dev/null
sudo rm -f /usr/share/icons/hicolor/48x48/apps/pt6.png
sudo gtk-update-icon-cache -f -q /usr/share/icons/hicolor
sleep 10
sudo cp $SDIR/art/app_student.png /usr/share/icons/hicolor/48x48/apps/pt6.png
sudo gtk-update-icon-cache -f -q /usr/share/icons/hicolor
fi
if [ "$INSTALL_32BIT_LIBRARY" = true ]; then
echo "Installing 32 bit libraries for Packet Tracer."
sudo dpkg --add-architecture i386
sudo apt-get -y install lib32z1
sudo apt-get -y install lib32ncurses5
sudo apt-get -y install lib32bz2-1.0
sudo apt-get -y install libgcc1:i386
sudo apt-get -y install libstdc++6:i386
sudo apt-get -y install libssl-dev:i386
sudo apt-get -y install libqtwebkit4:i386
sudo apt-get -y install libqt4-scripttools:i386
fi
else
echo
echo Not able to gain root access with sudo
echo Exiting installation
exit
fi
else
echo
echo Exiting installation
exit
fi
fi
echo
echo
read -p "Should we create a symbolic link \"packettracer\" in /usr/local/bin for easy Cisco Packet Tracer startup? [Yn] " QC
if [ "$QC" = "y" ] || [ "$QC" = "Y" ] || [ -z $QC ]; then
if [ "$user" != "root" ]; then
sudo ln -sf $IDIR/packettracer /usr/local/bin
else
ln -sf $IDIR/packettracer /usr/local/bin
fi
echo "Type \"packettracer\" in a terminal to start Cisco Packet Tracer"
else
echo "Type \"$IDIR/packettracer\" in a terminal to start Cisco Packet Tracer"
fi
# add the environment var PT5HOME
sudo sh set_ptenv.sh $IDIR
echo
echo Cisco Packet Tracer 6.2 installed successfully
}
initInstall
exit 0
答案1
apt-get 或 dpkg 删除该程序失败的原因是该应用程序根本不是 ubuntu 包。
这是一个粗暴的脚本,它手动执行操作并且没有提供简单的卸载功能(如果您不是新手,卸载它很容易,但这仍然不是不提供卸载脚本的好理由,但无论如何)。
让我们看看它能做什么。
它将主应用程序及其文件移到/opt/pt
生成桌面菜单项、/usr/share/applications/pt6.desktop
图标/usr/share/applications/pt6.desktop
和符号链接/usr/local/bin/packettracker
从脚本本身可以看出,如果您没有运行 32 位系统,它也会手动安装一堆 32 位依赖项。(直接取自您发布的脚本)
sudo apt-get -y install lib32z1
sudo apt-get -y install lib32ncurses5
sudo apt-get -y install lib32bz2-1.0
sudo apt-get -y install libgcc1:i386
sudo apt-get -y install libstdc++6:i386
sudo apt-get -y install libssl-dev:i386
sudo apt-get -y install libqtwebkit4:i386
sudo apt-get -y install libqt4-scripttools:i386
因此,如果你想删除它,但又无法从文件管理器中删除,请删除该文件夹/opt/pt
sudo rm -rf /opt/pt
删除菜单项和图标,然后刷新图标缓存
sudo rm /usr/share/icons/hicolor/48x48/apps/pt6.png
sudo rm /usr/share/applications/pt6.desktop
sudo gtk-update-icon-cache -f -q /usr/share/icons/hicolor
删除 symlink 中的符号链接/usr/local/bin/packettracker
sudo rm /usr/local/bin/packettracker
然后,如果您使用的是 64 位 Ubuntu,您可以像apt-get
往常一样删除它安装的依赖项(我在上面的摘录中向您展示的依赖项)。
来源:我在 Debian Jessie 上安装了同样愚蠢的东西,但这花了一些功夫,而且我不得不自己阅读那个脚本。我在寻找如何修复它的一些依赖项时发现了这个问题,因为它安装的一些数据包在 Jessie 中不再存在,或者它们有不同的名称(幸好符合多架构标准)。