浏览代码

FIX: #168 complete-uninstall.sh is redhat only

The utility script sbin/complete-uninstall.sh had a few issues:
 - assumed a rpm-based system
 - incorrect copyright message
 - assumed (non-standard) location of hpcc home directory
 - was not shipped

Change the script to handle uninstalls of .deb files too, and use
option on userdel to handle home directory removal more cleanly.
Add the file back to the install set.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 14 年之前
父节点
当前提交
42f3d81978
共有 2 个文件被更改,包括 39 次插入18 次删除
  1. 36 18
      initfiles/sbin/complete-uninstall.sh
  2. 3 0
      install_directory/bash_startup.install

+ 36 - 18
initfiles/sbin/complete-uninstall.sh

@@ -1,25 +1,34 @@
 #!/bin/bash
-################################################################################
-## Copyright © 2011 HPCC Systems.  All rights reserved.
-################################################################################
+#############################################
+#    Copyright (C) 2011 HPCC Systems.
+#
+#    All rights reserved. This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with All rights reserved. This program is free software: you can redistribute program.  If not, see <http://www.gnu.org/licenses/>.
+#############################################
 
-echo "Removing RPM"
-rpm -e hpccsystems-clienttools
-rpm -e hpccsystems-graphcontrol
-rpm -e hpccsystems-documentation
-rpm -e hpccsystems-platform
-
-echo "Removing user"
-if [ -e /usr/sbin/userdel ]; then
-    /usr/sbin/userdel hpcc
-elif [ -e /usr/bin/userdel ]; then
-    /usr/bin/userdel hpcc
-elif [ -e /bin/userdel ]; then
-    /bin/userdel hpcc
+if [ -e /etc/debian_version ]; then
+    dpkg --purge hpccsystems-platform
+    dpkg --purge hpccsystems-clienttools
+    dpkg --purge hpccsystems-graphcontrol
+    dpkg --purge hpccsystems-documentation
+elif [ -e /etc/redhat-release -o -e /etc/SuSE-release ]; then
+    echo "Removing RPM"
+    rpm -e hpccsystems-clienttools
+    rpm -e hpccsystems-graphcontrol
+    rpm -e hpccsystems-documentation
+    rpm -e hpccsystems-platform
 fi
 
-rm -rf /Users/hpcc
-
 echo "Removing Directory - /opt/HPCCSystems/*"
 rm -rf /opt/HPCCSystems/*
 
@@ -31,4 +40,13 @@ for i in lock run log lib; do
     rm -rf /var/$i/HPCCSystems/*; 
 done
 
+echo "Removing user"
+if [ -e /usr/sbin/userdel ]; then
+    /usr/sbin/userdel -r hpcc
+elif [ -e /usr/bin/userdel ]; then
+    /usr/bin/userdel -r hpcc
+elif [ -e /bin/userdel ]; then
+    /bin/userdel -r hpcc
+fi
+
 exit 0

+ 3 - 0
install_directory/bash_startup.install

@@ -63,6 +63,9 @@ Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/initfiles/etc/sshkey/.ssh/id_rsa DES
 Install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/initfiles/etc/sshkey/.ssh/id_rsa.pub DESTINATION ${OSSDIR}/etc/sshkey/.ssh
     PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )
 
+install ( FILES ${CMAKE_BINARY_DIR}/initfiles/sbin/complete-uninstall.sh DESTINATION ${OSSDIR}/sbin
+    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
+
 install ( FILES ${CMAKE_BINARY_DIR}/initfiles/sbin/keygen.sh DESTINATION ${OSSDIR}/sbin
     PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )