uninstall.sh
上传用户:knt0001
上传日期:2022-01-28
资源大小:264k
文件大小:3k
源码类别:

Email客户端

开发平台:

C/C++

  1. #!/bin/sh
  2. help ()
  3. {
  4. cat <<EOF
  5. This script is written and maintained by Dean Jones.
  6. Please send all bugs to <dean@cleancode.org>
  7. Options are described below and all are MANDITORY.
  8.     --bindir dir        Specifies the directory to find the binary to remove.
  9.     --mandir dir        Specifies the directory to find the manual page to remove.
  10.     --sysconfdir dir    Specifies the directory to find the config files to remove.
  11.     --docdir dir        Specifies the directory to find the documentation to remove.
  12.     --version version   Specifies the version of the program
  13.     --help              Duh.
  14. EOF
  15. }
  16. # Get command line arguments
  17. while [ "$1" ]
  18. do
  19.     case "$1" in
  20.         "-b" | "--bindir" | "-bindir")
  21.             if [ -z "$2" ]
  22.             then
  23.                 echo "error: option '$1' requires an argument"
  24.                 exit 2
  25.             fi
  26.             shift
  27.             bindir="$1"
  28.             ;;
  29.         "-m" | "--mandir" | "-mandir")
  30.             if [ -z "$2" ]
  31.             then
  32.                 echo "error: option '$1' requires an argument"
  33.                 exit 2
  34.             fi
  35.             shift
  36.             mandir="$1"
  37.             ;;
  38.         "-s" | "--sysconfdir" | "-sysconfdir")
  39.             if [ -z "$2" ]
  40.             then
  41.                 echo "error: option '$1' requires an argument"
  42.                 exit 2
  43.             fi
  44.             shift
  45.             sysconfdir="$1"
  46.             ;;
  47.         "-d" | "--docdir" | "-docdir")
  48.             if [ -z "$2" ]
  49.             then
  50.                 echo "error: option '$1' requires an argument"
  51.                 exit 2
  52.             fi
  53.             shift
  54.             docdir="$1"
  55.             ;;
  56.         "-v" | "--version" | "-version")
  57.             if [ -z "$2" ]
  58.             then
  59.                 echo "error: option '$1' requires an argument"
  60.                 exit 2
  61.             fi
  62.             shift
  63.             VERSION="$1"
  64.             ;;
  65.         "-h" | "--help" | "-help" )
  66.             help
  67.             ;;
  68.         * )
  69.             help
  70.             ;;
  71.     esac
  72.     shift
  73. done
  74. if [ -z "$bindir" ] || [ -z "$mandir" ] || [ -z "$sysconfdir" ] || [ -z "$VERSION" ]
  75. then
  76.     echo "Not enough arguments on the command line."
  77.     help
  78.     exit 2
  79. fi
  80. if [ -f "$bindir/email" ]
  81. then
  82.     echo "Removing Binary..."
  83.     rm -f "$bindir/email"
  84. elif [ -f "$bindir/email.exe" ]
  85. then
  86.     echo "Removing Binary..."
  87.     rm -f "$bindir/email.exe"
  88. fi
  89. if [ -d "$sysconfdir/email" ]
  90. then
  91.     echo "Removing $sysconfdir/email..."
  92.     rm -rf "$sysconfdir/email"
  93. fi
  94. if [ "`uname | cut -b 1-6`" = "CYGWIN" ]
  95. then
  96. rm -f "$bindir/email-config"
  97. fi
  98. if [ -d "$docdir/email-$VERSION" ]
  99. then
  100.     echo "Removing $docdir/email-$VERSION..."
  101.     rm -rf "$docdir/email-$VERSION"
  102. fi
  103. if [ -f "$mandir/man1/email.1" ]
  104. then
  105.     echo "Removing $mandir/man1/email.1..."
  106.     rm -f "$mandir/man1/email.1"
  107. fi
  108. echo -n "Would you like to remove users personal ~/.email.conf files? "
  109. read answer
  110. if [ "$answer" = "yes" ] || [ "$answer" = "y" ]
  111. then
  112.     for home_dir in `cat /etc/passwd | awk -F : '{print $6}'`
  113.     do
  114.         if [ -f "$home_dir/.email.conf" ]
  115.         then
  116.             echo "Removing $home_dir/.email.conf"
  117.             rm -f "$home_dir/.email.conf"
  118.         fi
  119.     done
  120. fi
  121. echo "Finished!"