dzomaya / NUTandRpi

A repo for Network UPS Tools and Eaton Tripp Lite UPS demo scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uninstall

timothystewart6 opened this issue · comments

It would be nice to either document or automate the steps to revert / uninstall the actions taken by this script. I think docs in README.md would be a good start. Thank you for this!

I think it's something like this:

sudo sudo apt-get remove nut nut-cgi snmp snmpd libsnmp-dev snmp-mibs-downloader --purge
sudo rm -rf /etc/nut
sudo rm -rf /etc/snmp
sudo apt-get autoremove
sudo reboot

@timothystewart6
Good call. Yours looks like it would work. Here is the script I use occasionally in testing:

#!/bin/bash
dpkg --purge libupsclient4 libusb-0.1-4 nut-client nut-server nut nut-cgi
apt remove apache2 -y
apt remove snmp snmpd libsnmp-dev snmp-mibs-downloader -y
rm /etc/snmp/snmpd.conf
apt-get purge apache2 -y
rm -rf /etc/apache2

https://gist.github.com/dzomaya/eb3c733e4c157dbbd516c5f4e8ac3fca

I don't recall why I use dpkg for the Network UPS Tools and Libusb stuff, but I think there was a reason.

I'll at least add to the readme in the next week or so. Could also add a secondary script to the repo.
I'll tag this as a good first issue in case someone wants to hop in with a PR in the interim.

Thanks! I think autoremove will clean up all dependencies that aren't being used anymore. nut installs quite a few.

The following packages were automatically installed and are no longer required:
 apache2 apache2-bin apache2-data apache2-utils fontconfig-config
  fonts-dejavu-core libapr1 libaprutil1 libaprutil1-dbd-sqlite3
  libaprutil1-ldap libc-dev-bin libc-devtools libc6-dev libcrypt-dev
  libdeflate0 libfontconfig1 libfreetype6 libgd3 libjbig0 libjpeg-turbo8
  libjpeg8 libltdl7 liblua5.3-0 libmysqlclient21 libnetsnmptrapd40
  libnsl-dev libnutscan1 libpci-dev libsensors-dev libsnmp-perl libssl-dev
  libtiff5 libtirpc-dev libudev-dev libupsclient4 libusb-0.1-4 libwebp7
  libwrap0-dev libxpm4 linux-libc-dev manpages-dev mysql-common
  rpcsvc-proto smistrip ssl-cert zlib1g-dev

so you don't have to one off remove things like apache2

Yeah, autoremove seems better than what I was doing.

@timothystewart6
https://github.com/dzomaya/NUTandRpi#how-to-uninstall

Added to README. I did NOT include the reboot step you mention, but let me know if you think there is an important reason to always reboot (I generally like to suggest it, but didn't come up with a specific reason to make it a step here).

Other than that, pretty closely mirrors what you suggested with some minor tweaks/notes.

@timothystewart6 https://github.com/dzomaya/NUTandRpi#how-to-uninstall

Added to README. I did NOT include the reboot step you mention, but let me know if you think there is an important reason to always reboot (I generally like to suggest it, but didn't come up with a specific reason to make it a step here).

Other than that, pretty closely mirrors what you suggested with some minor tweaks/notes.

For sure! Reboot is not necessary! Thank you!