Skip to content

Instantly share code, notes, and snippets.

@brahmana
Created March 5, 2013 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brahmana/5087790 to your computer and use it in GitHub Desktop.
Save brahmana/5087790 to your computer and use it in GitHub Desktop.
Update post-uninstall script for the crossplatformui Ubuntu package to make sure it is uninstalled properly without errors. Details are here : http://techbrahmana.blogspot.in/2013/03/package-installation-error-on-ubuntu.html
#!/bin/sh
set -e
SETTING_DATA_PATH=".ztemtapp/ZTEEVDO"
#e.g. /var/lib/dpkg/info
# when execs "sudo dpkg -P xxxx", 1st execute this script with "remove" arg, then execute this script with "purge" arg
if [ "$1" = "remove" ] ; then
sudo sed '/ztemt/d' /etc/init.d/rc.local > tmpfile; sudo mv -f tmpfile /etc/init.d/rc.local; sudo chmod 0755 /etc/init.d/rc.local
#kill ztemtvcdromd
#sudo killall -9 ztemtvcdromd
if [ -d /usr/local/bin/ztemtApp/zteusbserial ] ; then
sudo /bin/rm -R /usr/local/bin/ztemtApp/zteusbserial
fi
#purge: Remove USB Driver
if [ -n "$(lsmod|grep ztemt)" ]; then
sudo /sbin/rmmod ztemt ;
fi
sudo /sbin/ldconfig
#Delete Setting.conf
/bin/rm -f /root/$SETTING_DATA_PATH/Setting.conf
/bin/rm -f /root/$SETTING_DATA_PATH/MultiUser.xml
/bin/rm -f /root/$SETTING_DATA_PATH/EVDOApp.pid
for ALLUSERPATH in `find /home -mount -maxdepth 1 -mindepth 1 -type d`;
do
if [ -d $ALLUSERPATH ] ; then
/bin/rm -f $ALLUSERPATH/$SETTING_DATA_PATH/Setting.conf
/bin/rm -f $ALLUSERPATH/$SETTING_DATA_PATH/MultiUser.xml
/bin/rm -f $ALLUSERPATH/$SETTING_DATA_PATH/EVDOApp.pid
fi
done
fi
#if [ "$1" = "purge" ] ; then
#fi
# End automatically added section
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment