Desinstalando aplicativo / programa / serviço instalado por meio do script * .sh

0

Eu instalei um programa usando o install.sh da linha de comando, mas ele não está respondendo, portanto, preciso removê-lo. Como remover esse programa? Muito obrigado antecipadamente. Aqui está o script de 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---------
#********************************************************
    
por Fagun Bhavsar 27.03.2014 / 07:51

2 respostas

1

Eu devo estar realmente confundindo se a linha 4,7, 8 e 360 não significa que há simplesmente um script de desinstalação em

/opt/Photon_3G/ZTE/MF190/uninstall.sh

Como na linha de linha 360 ele mostra que deve haver um script de desinstalação:

chmod 0755 $INSTALL_PATH/uninstall.sh

enquanto no lineline 4/7:

NEW_FILE_PATH_TATA=Photon_3G/ZTE/MF190
SYS_PATH=/opt

e na linha 8:

INSTALL_PATH=$SYS_PATH/$NEW_FILE_PATH_TATA

Mais geralmente:

Qualquer aplicativo adequado, instalado por um */sh deve ter descrito em seu arquivo README, em algum lugar do arquivo zip que você provavelmente terá baixado, como desinstalar. Além disso, quando você instala, na janela do terminal, você verá muitas vezes o comando como desinstalar. Se você esqueceu, o procedimento pragmático seria instalar mais uma vez, assim você pode ler como desinstalar.

Eu evitaria remover manualmente o aplicativo, se possível, porque é difícil saber o que o script do instalador realmente fez.

    
por Jacob Vlijm 29.03.2014 / 14:10
0

Então parece que o programa principal está em uma pasta.

Para removê-lo, posso tentar com:

sudo rm -R /opt/Photon_3G

Mas tenha cuidado porque o instalador também altera o conteúdo de vários arquivos e adiciona outros aqui e ali. Isso é uma coisa complicada. Eles realmente devem fornecer-lhe um desinstalador ... de qualquer maneira, você pode explorar as mudanças que eles fizeram, mas segurando o script. Você encontrará destinos como:

/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

Isso você deve verificar. Mas é claro que você tem que saber o que você está vendo e, mais importante, você tem que entender o que você está tocando antes de modificar qualquer um destes. Não é uma tarefa fácil. Desculpe.

    
por Rho 29.03.2014 / 10:37