我使用 install.sh 从命令行安装了一个程序,但它没有响应,因此需要删除它。如何删除这样的程序?提前谢谢。这是shell 脚本。
#! /bin/bash
FILE_NAME=Photon_3G
NEW_FILE_PATH_TATA=Photon_3G/ZTE/MF190
EXE_FILE=Photon_3G
DISPLAY_NAME="Photon 3G"
SYS_PATH=/opt
INSTALL_PATH=$SYS_PATH/$NEW_FILE_PATH_TATA
LANGUAGE=English
#DRIVER_NAME=linuxdriveronda1.0.1
QM_NAME=ondatim_lan.qm
HELP=help
#HELP=help.html cancel by ChenYing 2009-2-13
#HELPFILES=index_files
RUN_EVINCE=$SYS_PATH/$NEW_FILE_PATH_TATA/Data/launchFirefox.sh
UPDATE_FILE=update
APLAY=$SYS_PATH/$NEW_FILE_PATH_TATA/Data/aplay.sh #added by ChenYing 2009-11-26
#********************************************************
#Define variable-two-frase-production-by-yh-20090822---begin---------
TWO_ON=true # true or false
PATH_NAME=`dirname $0`
TMP_DIR_NAME=/tmp
TWO_FRASE_TEMP_DIR=$TMP_DIR_NAME/two_phase_temp
TWO_FRASE_CONFIG_FILE_MODEM=/PCCFG/Description.xml
DES_DIR=$INSTALL_PATH
ZIP_FILE_NAME=$TWO_FRASE_TEMP_DIR/lu.zip
TEMP_DIR=$TWO_FRASE_TEMP_DIR/temp
LAST_RUN=$INSTALL_PATH/last_run.sh
CHOOSE_LANGUAGE_RUN=$TEMP_DIR/choose_language.sh
#Define variable-two-frase-production-by-yh-20090822---end------------
#********************************************************
if [ -f $INSTALL_PATH/$EXE_FILE ]; then
echo "****** Fail to install !!! "
echo the "$EXE_FILE" has been installed.
read -p "press any key to exit.... " -n 1
exit -1
fi
echo "..................start install................."
echo -n "*** Check for root..."
if [ $EUID -ne 0 ]; then
echo -e "\b\b\b - failed"
echo "*** Please retry as root user."
read -p "press any key to exit.... " -n 1
exit -1
fi
echo "ok..."
#Select the language for the installation form the choices below.
# (1) English
# (2) Italian
# (3) Spanish
# (4) Simplified Chinese
# (5) Traditional Chinese "
#echo "Please input number (1,2,3,4 or 5):"
#read S_NUMBER
#
#if [ $S_NUMBER == "1" ];then
# LANGUAGE=English
#elif [ $S_NUMBER == "2" ];then
# LANGUAGE=Italian
#elif [ $S_NUMBER == "3" ];then
# LANGUAGE=Spanish
#elif [ $S_NUMBER == "4" ];then
# LANGUAGE=Simplified_Chinese
#elif [ $S_NUMBER == "5" ];then
# LANGUAGE=Traditional_Chinese
#else
# LANGUAGE=English
#fi
#********************************************************
#Download files-two-frase-production-by-yh-20090822---begin---------
rettfp=3
if [ $TWO_ON == 'true' ];then
if [ -d $TWO_FRASE_TEMP_DIR ]; then
rm -rf $TWO_FRASE_TEMP_DIR
fi
mkdir -p $TWO_FRASE_TEMP_DIR
if [ -f $PATH_NAME/zr ];then
chmod +x $PATH_NAME/zr
$PATH_NAME/zr $TWO_FRASE_CONFIG_FILE_MODEM $TWO_FRASE_TEMP_DIR
rettfp=$?
fi
if [ $rettfp == '5' -o $rettfp == '6' -o $rettfp == '7' ];then
echo -e "Stage 5"
# echo -e "Can not complete the installation. Installation will abort."
# echo -e "Please try to install again."
# read temp_1
# exit -1
elif [ $rettfp == '3' -o $rettfp == '4' ];then
echo -e "Stage 3"
else
echo -e "Get resouse file successfully."
fi
fi
#Download files-two-frase-production-by-yh--20090822--end----------
#gaoxiang added 2009.4.16 for change NetworkManager.conf
####
#CONF_FILE="/etc/dbus-1/system.d/NetworkManager.conf"
#if [ -f $CONF_FILE ]; then
# echo .............modify NetworkManager.conf...............
# sed '/send_interface=\"org\.freedesktop\.NetworkManager\"/s/allow/deny/g' $CONF_FILE > NetworkManager.conf.temp
# mv -f NetworkManager.conf.temp $CONF_FILE
# /etc/init.d/NetworkManager restart
#fi
#end of gaoxiang
#delete first
if [ -f $INSTALL_PATH/$FILE_NAME ];then
rm -rf $INSTALL_PATH
rm -f /bin/$FILE_NAME
fi
if [ -f $INSTALL_PATH/$EXE_FILE ];then
rm -rf $INSTALL_PATH
rm -f /bin/$EXE_FILE
fi
TMP_FILE=/etc/defaultwvdial.conf
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/etc/ppp/defaultoptions
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/etc/ppp/defaultresolv.conf
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/etc/defaultresolv.conf
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/usr/share/applications/$FILE_NAME*.desktop
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/usr/share/pixmaps/$FILE_NAME*.png
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
#delete autorun files
TMP_FILE=/sbin/join-air-launch.sh
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/etc/udev/rules.d/998-join-air.rules
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
TMP_FILE=/etc/udev/rules.d/9-cdrom.rules
if [ -f $TMP_FILE ];then
rm -f $TMP_FILE
echo ..........delete $TMP_FILE ok...........
fi
cp -f $FILE_NAME.tar.gz $SYS_PATH/$FILE_NAME.tar.gz
cd $SYS_PATH
tar -zxvf $FILE_NAME.tar.gz
#********************************************************
#Replace files-two-frase-production-by-yh--20090822--begin---------
if [ $TWO_ON == 'true' -a $rettfp == '0' ];then
# unzip files
unzip > /dev/null
ret=$?
if [ $ret != '0' ]; then
echo -e "Can not find unzip."
echo -e "Installation will abort."
exit -1
fi
unzip -o $ZIP_FILE_NAME -d $TEMP_DIR
retunz=$?
if [ $retunz != '0' ]; then
echo -e "unzip $ZIP_FILE_NAME failed."
echo -e "Installation will abort."
exit -1
else
echo -e "unzip $ZIP_FILE_NAME successfully."
fi
RETURN_CHOOSE_LANG=1
if [ $rettfp == '0' -a -f $CHOOSE_LANGUAGE_RUN ];then
chmod +x $CHOOSE_LANGUAGE_RUN
$CHOOSE_LANGUAGE_RUN
RETURN_CHOOSE_LANG=$?
fi
#change permission
#chmod 0755 -R $TEMP_DIR
#chmod u+s -R $TEMP_DIR
# backup destination directory
BACKUP_DES_DIR=$TWO_FRASE_TEMP_DIR/backup_for_desDir
if [ -d $BACKUP_DES_DIR ];then
rm -rf $BACKUP_DES_DIR
fi
mkdir -p $BACKUP_DES_DIR
cp -rf $DES_DIR/* $BACKUP_DES_DIR/
#start to replace
cp -rf $TEMP_DIR/* $DES_DIR/
retplace=$?
if [ $retplace != '0' ];then
cp -rf $BACKUP_DES_DIR/* $DES_DIR/
echo -e "Replacing file failed."
echo -e "Installation will abort."
exit -1;
else
echo -e "Repalcing file successfully."
rm -rf $BACKUP_DES_DIR
fi
fi
#Replace files-two-frase-production-by-yh--20090822--end---------
#********************************************************
SYS_PPP_DIR="/etc/ppp"
if [ -e $SYS_PPP_DIR -a -d $SYS_PPP_DIR ];then
chmod a+x $SYS_PPP_DIR
fi
PEERS_DIR="/etc/ppp/peers"
if [ -e $PEERS_DIR -a -d $PEERS_DIR ];then
chmod a+x $PEERS_DIR
fi
chmod 0755 $INSTALL_PATH/pppd/ip-up.local
cp -f $INSTALL_PATH/pppd/ip-up.local /etc/ppp/ip-up.local
chmod 0755 $INSTALL_PATH/pppd/ip-down.local
cp -f $INSTALL_PATH/pppd/ip-down.local /etc/ppp/ip-down.local
chmod 0755 $INSTALL_PATH/pppd/get_route_info
cp -f $INSTALL_PATH/pppd/get_route_info /etc/ppp/get_route_info
chmod 0755 $INSTALL_PATH/usr/share/applications/$EXE_FILE.desktop
cp -f $INSTALL_PATH/usr/share/applications/$EXE_FILE.desktop /usr/share/applications/$EXE_FILE.desktop
chmod 0755 $INSTALL_PATH/usr/share/pixmaps/$EXE_FILE.png
cp -f $INSTALL_PATH/usr/share/pixmaps/$EXE_FILE.png /usr/share/pixmaps/$EXE_FILE.png
chmod 0755 $INSTALL_PATH/bin/$EXE_FILE
cp -f $INSTALL_PATH/bin/$EXE_FILE /bin/$EXE_FILE
chmod 0755 /usr/bin/wvdial
chmod 0755 /usr/sbin/pppd
chmod 0755 $RUN_EVINCE
chmod 0755 $APLAY #added by ChenYing 2009-11-26
chmod a+x $INSTALL_PATH/Data/run_evince.sh
#xt add update script 090617
chmod 0755 $SYS_PATH/$NEW_FILE_PATH_TATA/$UPDATE_FILE
cd $SYS_PATH/$NEW_FILE_PATH_TATA/usr/lib
cp * /usr/lib
if [ "$(cat /etc/lsb-release | grep Ubuntu)" != "" ];then
if [ ! -L /usr/lib/libcurl.so.4 ];then
ln -s /usr/lib/libcurl-gnutls.so.4 /usr/lib/libcurl.so.4
fi
elif [ "$(cat /etc/debian_version)"=="4.0" ];then
if [ ! -L /usr/lib/libcurl.so.4 ];then
ln -s /usr/lib/libcurl.so.3.0.0 /usr/lib/libcurl.so.4
fi
fi
#add end 090617
TMP_FILE=/etc/wvdial.conf
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
else
cp -f $INSTALL_PATH/Data$TMP_FILE $TMP_FILE
chmod 0755 $TMP_FILE
fi
TMP_FILE=/etc/ppp/options
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
else
cp -f $INSTALL_PATH/Data$TMP_FILE $TMP_FILE
chmod 0755 $TMP_FILE
fi
TMP_FILE=/etc/ppp/resolv.conf
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
else
cp -f $INSTALL_PATH/Data$TMP_FILE $TMP_FILE
chmod 0755 $TMP_FILE
fi
TMP_FILE=/etc/resolv.conf
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
else
cp -f $INSTALL_PATH/Data$TMP_FILE $TMP_FILE
chmod 0755 $TMP_FILE
fi
#add by ChenYing 2009-3-5
TMP_FILE=/etc/resolv.conf.bak
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
fi
TMP_FILE=/etc/resolv.conf.prev
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
fi
TMP_FILE=/etc/ppp/peers/wvdial
if [ -f $TMP_FILE ];then
chmod 0755 $TMP_FILE
else
cp -f $INSTALL_PATH/Data$TMP_FILE $TMP_FILE
chmod 0755 $TMP_FILE
fi
#Language Select and help file
#TMP_FILE=$INSTALL_PATH/bin/$LANGUAGE/$QM_NAME
#if [ -f $TMP_FILE ];then
# chmod 0755 $TMP_FILE
# cp -f $TMP_FILE $INSTALL_PATH/Data/$QM_NAME
#fi
#TMP_FILE=$INSTALL_PATH/bin/$LANGUAGE/$HELP
#cp -r $TMP_FILE $INSTALL_PATH/Data
chmod 0777 $SYS_PATH
chmod 0777 $SYS_PATH/$FILE_NAME
chown root.root $INSTALL_PATH/$EXE_FILE
chmod 0755 $INSTALL_PATH/$EXE_FILE
chmod u+s $INSTALL_PATH/$EXE_FILE
chmod 0755 $INSTALL_PATH/uninstall.sh
#install language
echo "install the fonts..."
cp -rf $INSTALL_PATH/Data/fonts/Arial /usr/share/fonts/truetype/
echo "refurbish the font cache..."
fc-cache
#
TMP_FILE=$INSTALL_PATH/bin/9-cdrom.rules
cp -f $TMP_FILE /etc/udev/rules.d/9-cdrom.rules
#if locate udevadm >/dev/null 2>&1
if [ -f /sbin/udevadm ]
then
/sbin/udevadm control reload_rules >/dev/null 2>&1
/sbin/udevadm control --reload-rules >/dev/null 2>&1
/sbin/udevadm trigger --subsystem-match=block
echo "udevadm is exist!"
else
/sbin/udevcontrol reload_rules
/sbin/udevtrigger --subsystem-match=block
echo "udevadm isn't exist!"
fi
rm -f $INSTALL_PATH/bin/9-cdrom.rules
#remove temp file
rm -f $SYS_PATH/$FILE_NAME.tar.gz
#modified by ChenYing 2009-5-5, install driver begin xt add 081126
echo ******Begin to $INSTALL_PATH/driver
cd $INSTALL_PATH/driver
chmod 0755 driver_install.run
./driver_install.run
echo ****** End to $INSTALL_PATH/driver
#install driver end
#added SeLinux's moudle by ChenYing
cd $INSTALL_PATH/driver
chmod 0755 se
if [ -n "`uname -r |grep fc`" ];then
./se "/usr/sbin/semodule -i disselfirefox.pp"
./se "/usr/sbin/semodule -i nm.pp"
echo "it's ok!"
fi
#the end
#change user group
while read LINE
do
USER2CH=${LINE%%:*}
LINE=${LINE#*:}
LINE=${LINE#*:}
USER_ID=${LINE%%:*}
if [ $USER_ID -ge 1000 ];then
if [ $USER2CH != "nobody" ]; then
#echo $USER2CH:$USER_ID
/usr/sbin/usermod -a -G netdev,dialout,dip $USER2CH
fi
fi
done < /etc/passwd
TMP_FILE=$INSTALL_PATH/launch-gui.sh
if [ -f $TMP_FILE ];then
chown root.root $TMP_FILE
chmod 0755 $TMP_FILE
chmod u+s $TMP_FILE
cp -f $TMP_FILE /bin
fi
#restore Data
cd ~
RESTOREPAH=$(pwd)
cd -
if [ -e $RESTOREPAH/sms.xml -o -e $RESTOREPAH/contact.xml -o -e $RESTOREPAH/historyRecord.xml ];then
echo "restain path is $RESTOREPAH"
echo "Do you want to restore saved user data?(y/n):"
read SELECT
if [ $SELECT == "Yes" -o $SELECT == "yes" -o $SELECT == "y" -o $SELECT == "Y" ];then
TMP_FILE=$RESTOREPAH/sms.xml
if [ -f $TMP_FILE ];then
rm -rf $INSTALL_PATH/Data/sms.xml
cp -f $TMP_FILE $INSTALL_PATH/Data/
echo "....sms data has been restored"
fi
TMP_FILE=$RESTOREPAH/contact.xml
if [ -e $TMP_FILE ];then
rm -rf $INSTALL_PATH/Data/contact.xml
cp -f $TMP_FILE $INSTALL_PATH/Data/
echo "....contact data has been resotored"
fi
TMP_FILE=$RESTOREPAH/historyRecord.xml
if [ -e $TMP_FILE ];then
rm -rf $INSTALL_PATH/Data/historyRecord.xml
cp -f $TMP_FILE $INSTALL_PATH/Data/
echo "....historyRecord data has been resotored"
fi
echo "data has been restored successfully"
fi
fi
#********************************************************
#Update -two-frase-production-by-yh--20090822--begin---------
if [ $TWO_ON == 'true' -a $rettfp == '0' -a -f $LAST_RUN ];then
chmod +x $LAST_RUN
$LAST_RUN $RETURN_CHOOSE_LANG
else
echo "install completed!!!"
echo "....After setup, you will find the $DISPLAY_NAME in \"Applications->Internet->$DISPLAY_NAME\". Click the $DISPLAY_NAME and the application will run"
read -p "press any key to continue.... " -n 1
#run
$EXE_FILE
fi
#Update-two-frase-production-by-yh--20090822--end---------
#********************************************************
答案1
我肯定搞错了,第 4、7、8 和 360 行并不意味着只有一个卸载脚本
/opt/Photon_3G/ZTE/MF190/uninstall.sh
因为第 360 行显示应该有一个卸载程序脚本:
chmod 0755 $INSTALL_PATH/uninstall.sh
而在 4/7 号线上:
NEW_FILE_PATH_TATA=Photon_3G/ZTE/MF190
SYS_PATH=/opt
第 8 行:
INSTALL_PATH=$SYS_PATH/$NEW_FILE_PATH_TATA
更普遍:
任何由 a 安装的正确应用程序都*/sh
应该在其 README 文件中描述如何卸载,该文件可能位于您下载的 zip 文件中的某个位置。此外,当您安装时,您会在终端窗口中多次看到如何卸载的命令。如果您忘记了,实用的程序是再次安装,这样您就可以阅读如何卸载。
如果可能的话,我会避免手动删除该应用程序,因为很难知道安装程序脚本实际上做了什么。
答案2
所以看起来主程序所有内容都位于一个文件夹中。
要删除它,我可以尝试:
sudo rm -R /opt/Photon_3G
不过要小心因为安装程序也会改变内容几个文件,并在这里和那里添加其他文件。这是件棘手的事情。他们真的应该为您提供卸载程序……无论如何,您可以探索他们所做的更改,但要掌握脚本。您将找到以下目的地:
/etc/ppp/ip-up.local
/etc/ppp/ip-down.local
/etc/ppp/get_route_info
/etc/wvdial.conf
/etc/ppp/resolv.conf
/etc/resolv.conf.prev
你应该检查一下。但当然你必须知道你看到的是什么,更重要的是,在修改任何内容之前,你必须了解你触摸的是什么。这不是一件容易的事。抱歉。