Menu

Yet Another UnInstall Question

Help
2005-09-11
2012-08-31
  • Eric P. Tiongson

    Got it running in one go using Tiger though (as everybody else noticed) there is no uninstall option.

    I'm trying to see if we can package this with our software, our last release was using postgresql 7.x.x, and one of our must-haves is that our software should be able to uninstall cleanly. That is, remove all traces of ours as well as 3rd party software that we bundle if the user wishes so.

    If bundled, I can "uninstall" postgresql 8.0.3 using our tools, I just want to check if I'm missing anything. Here's my list.

    1. remove all postgres databases
    2. shutdown postgressql
    3. remove /Library/StartupItems/PostgreSQL
    4. remove /Library/PostgreSQL8
    5. remove postgres user using niutil

    Am I missing something? That is, is the package doing anything else that I'm not aware of?

    Thanks.

     
    • Eric P. Tiongson

      Thanks! I almost missed the group and Receipts part.

      BTW, great work you've done here.

       
    • Andy Satori

      Andy Satori - 2005-09-11

      You are correct, below is the body of the script that I use to strip my install for testing.

      !/bin/sh

      clean up the previous installation so we can test it again.

      echo
      echo # This script will attempt to remove all vestiges of a PostgreSQL8 installation
      echo # -----------------------------------------------------------------------------
      echo #

      make sure that we are running as root

      x=whoami | grep root
      if (! test -n "$x") then
      echo # You must be root (sudo) to have sufficient rights to remove the
      echo # folders and files that need to be removed.

      exit 0
      

      fi

      set -e

      echo # User: $x

      make sure the database is shutdown

      echo # Stopping the Database
      /Library/StartupItems/PostgreSQL/PostgreSQL stop
      echo # ...done

      remove the user and group from the netinfo database

      echo # Removing NetInfo entries

      PG_UID=/usr/bin/nifind -p //users/postgres | grep "^uid:.[0-9]" | sed 's/.*: //' | sed 's/ //'

      User exists

      if test $PG_UID; then
      sudo /usr/bin/niutil -destroyprop / /users/postgres gid
      sudo /usr/bin/niutil -destroyprop / /users/postgres uid
      sudo /usr/bin/niutil -destroyprop / /users/postgres home
      sudo /usr/bin/niutil -destroy / /users/postgres
      echo # ...Deleted Postgres User: $PG_UID
      fi

      PG_GID=/usr/bin/nifind -p //groups/postgres | grep "gid:.[0-9]" | sed 's/.*: //' | sed 's/ //'

      Group Exist, destroy it

      if test $PG_GID; then
      sudo /usr/bin/niutil -destroyprop / /groups/postgres gid
      sudo /usr/bin/niutil -destroy / /groups/postgres
      echo # ...Deleted Postgres Group: $PG_GID
      fi

      sudo /usr/bin/niutil -resync /

      echo # ...done

      remove the log files

      echo # Removing Logs \& Receipts
      sudo rm -f /Library/Logs/PostgreSQL8.log
      sudo rm -rf /Library/Receipts/PostgreSQL8.pkg
      sudo rm -rf /Library/Receipts/Postgres\ Startup\ Item.pkg
      sudo rm -rf /Library/Receipts/Postgres\ JDBC.pkg
      sudo rm -rf /Library/Receipts/Client\ Tools.pkg
      sudo rm -rf /Library/Receipts/SQL-Ledger.pkg
      echo # ...done

      remove the directories

      echo # Removing Files and Folders
      sudo rm -rf /Library/PostgreSQL8
      sudo rm -rf /Library/StartupItems/PostgreSQL
      sudo rm -rf /Applications/PostgreSQL

      the following lines are for SQL-Ledger

      sudo rm -rf /Library/WebServer/Documents/sql-ledger
      sudo rm -f /private/etc/httpd/users/sql-ledger.conf
      sudo rm -f /usr/bin/dbiproxy
      sudo rm -f /usr/bin/dbish
      sudo rm -rf /Library/Perl/5.8.1/darwin-thread-multi-2level

      echo # ...done

      echo #
      echo # -----------------------------------------------------------------------------
      echo # PostgreSQL8 has been removed from the system.

       

Log in to post a comment.

MongoDB Logo MongoDB