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

Email客户端

开发平台:

C/C++

  1. #!/bin/sh
  2. # This is the install script... Nice and short.
  3. help ()
  4. {
  5.     cat <<EOF
  6. This script is witten and maintained by Dean Jones.
  7. Please send bugs to <dean@cleancode.org>
  8. Options are described below.
  9.     --prefix dir            Specifies the main prefix to all directories
  10.     --bindir dir            Specifies the bin directory. Overrides --prefix
  11.     --mandir dir            Specifies the man directory. Overrides --prefix
  12.     --sysconfdir dir        Specifies the sys config directory. Overrides --prefix
  13.     --binext ext            Specifies the extension to binaries (ex: .exe)
  14.     --version version       Specifies the version of the program to install
  15. EOF
  16.     exit
  17. }
  18. # Get command line arguments
  19. while [ "$1" ]
  20. do
  21.     case "$1" in
  22.         "-p" | "--prefix" | "-prefix")
  23.             if [ -z "$2" ]
  24.             then
  25.                 echo "error: option '$1' requires an argument"
  26.                 exit 2
  27.             fi
  28.             shift
  29.             prefix="$1"
  30.             ;;
  31.         "-b" | "--bindir" | "-bindir")
  32.             if [ -z "$2" ]
  33.             then
  34.                 echo "error: option '$1' requires an argument"
  35.                 exit 2
  36.             fi
  37.             shift
  38.             bindir="$1"
  39.             ;;
  40.         "-m" | "--mandir" | "-mandir")
  41.             if [ -z "$2" ]
  42.             then
  43.                 echo "error: option '$1' requires an argument"
  44.                 exit 2
  45.             fi
  46.             shift
  47.             mandir="$1"
  48.             ;;
  49.         "-s" | "--sysconfdir" | "-sysconfdir")
  50.             if [ -z "$2" ]
  51.             then
  52.                 echo "error: option '$1' requires an argument"
  53.                 exit 2
  54.             fi
  55.             shift
  56.             sysconf="$1"
  57.             ;;
  58.         "-d" | "--docdir" | "-docdir")
  59.             if [ -z "$2" ]
  60.             then
  61.                 echo "error: option '$1' requires an argument"
  62.                 exit 2
  63.             fi
  64.             shift
  65.             docdir="$1"
  66.             ;;
  67.         "--binext" | "-binext" )
  68.             shift
  69.             binext="$1"
  70.             ;;
  71.         "--version" | "-version" )
  72.             if [ "$2" ]
  73.             then
  74.                 shift
  75.                 VERSION="$1"
  76.             else
  77.                 VERSION=""
  78.             fi
  79.             ;;
  80.         "-h" | "--help" | "-help" )
  81.             help
  82.             ;;
  83.         * )
  84.             help
  85.             ;;
  86.     esac
  87.     shift
  88. done
  89. if [ -z "$VERSION" ]
  90. then
  91.     echo "error: You MUST specify the --version flag"
  92.     exit 2
  93. fi
  94. if [ -z "$prefix" ]
  95. then
  96.     if [ -z "$bindir" ] || [ -z "$mandir" ] || [ -z "$sysconf" ]
  97.     then
  98.         echo "If --bindir --mandir and --sysconfdir are not specified"
  99.         echo "then you MUST specify --prefix!"
  100.         echo
  101.         help
  102.         exit 2
  103.     fi
  104. fi
  105. mkdir -p $bindir $mandir $sysconf $docdir
  106. mkdir -p $bindir $mandir $mandir/man1 $sysconf $docdir
  107. echo "Installing email v$VERSION..."
  108. if [ -z "$bindir" ]
  109. then
  110.     bindir="$prefix/bin"
  111. fi
  112. if [ -z "$mandir" ]
  113. then
  114.     mandir="$prefix/man"
  115. fi
  116. if [ -z "$sysconf" ]
  117. then
  118.     sysconf="$prefix/etc"
  119. fi
  120. if [ -z "$docdir" ]
  121. then
  122.     docdir="$prefix/doc"
  123. fi
  124. echo "Binary directory: $bindir"
  125. echo "Man directory: $mandir"
  126. echo "System configuration file directory: $sysconf"
  127. echo "Copying src/email$binext to $bindir..."
  128. if [ -x "src/email$binext" ]
  129. then
  130.     cp -f "src/email$binext" "$bindir"
  131.     if [ $? -ne 0 ]; then
  132.         echo "FAILED TO COPY EXECUTABLE"
  133.         exit
  134.     fi
  135.     chmod 755 "$bindir/email$binext"
  136. fi
  137. if [ ! -d "$sysconf/email" ]
  138. then
  139.     echo "Creating Email Directory... "
  140.     mkdir -p "$sysconf/email" 
  141.     if [ $? -ne 0 ]
  142.     then
  143.         echo "FAILED TO CREATE '$sysconf/email'"
  144.         exit 2
  145.     else
  146.         echo "Created '$sysconf/email'... "
  147.     fi
  148. fi
  149. echo "Copying Files to '$sysconf/email' directory... "
  150. if [ ! -f "$sysconf/email/email.sig" ]; then
  151.     cp -f email.sig "$sysconf/email"
  152.     if [ $? -ne 0 ]
  153.     then
  154.         echo "FAILED TO COPY email.sig to $sysconf/email"
  155.         exit 2
  156.     fi
  157. fi
  158. if [ ! -f "$sysconf/email/email.address.template" ]; then
  159.     cp -f email.address.template "$sysconf/email"
  160.     if [ $? -ne 0 ]
  161.     then
  162.         echo "FAILED TO COPY email.address.template to $sysconf/email"
  163.         exit 2
  164.     fi
  165. fi
  166. if [ ! -f "$sysconf/email/email.conf" ]; then
  167.     if [ -f email.conf ]
  168.     then
  169.         cp -f email.conf "$sysconf/email"
  170.         if [ $? -ne 0 ]
  171.         then
  172.             echo "FAILED TO COPY email.conf to $sysconf/email"
  173.             exit 2
  174.         fi
  175. if [ "`uname | cut -b 1-6`" = "CYGWIN" ]
  176. then
  177. if [ -f "generate_config" ]
  178. then
  179. chmod +x "generate_config"
  180. cp generate_config "$bindir/email-config"
  181. chmod 755 "$bindir/email-config"
  182. "$bindir/email-config" "$sysconf/email/email.conf"
  183. fi
  184. fi
  185.     fi
  186. fi
  187. if [ ! -f "$sysconf/email/mime.types" ]; then
  188.     cp -f mime.types "$sysconf/email"
  189.     if [ $? -ne 0 ]
  190.     then
  191.         echo "FAILED TO COPY mime.types to $sysconf/email"
  192.         exit 2
  193.     fi
  194. fi
  195. cp -f email.help "$sysconf/email"
  196. if [ $? -ne 0 ]
  197. then
  198.     echo "FAILED TO COPY email.help to $sysconf/email"
  199.     exit 2
  200. fi
  201. echo "Copying man pages to $mandir/man1..."
  202. cp -f email.1 "$mandir/man1"
  203. if [ "$?" -ne 0 ]
  204. then
  205.     echo "FAILED TO COPY email.1 to $mandir/man1"
  206.     exit 2
  207. fi
  208.     
  209. echo "Copying email help documentation to $docdir/email-$VERSION... "
  210. if [ ! -d "$docdir/email-$VERSION" ]; then
  211.     mkdir -p "$docdir/email-$VERSION"
  212.     if [ "$?" -ne 0 ]
  213.     then
  214.         echo "FAILED TO MKDIR $docdir/email-$VERSION"
  215.         exit 2
  216.     fi
  217. fi
  218. cp -f email.1 README ChangeLog THANKS COPYING AUTHORS "$docdir/email-$VERSION"
  219. if [ "$?" -ne 0 ]
  220. then
  221.     echo "FAILED TO COPY documentation to $docdir/email-$VERSION"
  222.     exit 2
  223. fi
  224. echo " Success!"
  225. cat << EOF
  226. #######################################################
  227. # Done installing E-Mail client.                      #
  228. # Please read README for information on setup and use.#
  229. #                                                     #
  230. # If you have any questions or concerns...            #
  231. # Please e-mail: software@cleancode.org               #
  232. #######################################################
  233. EOF