1. yang xiaoyong
  2. woocode

Source

woocode / sa-auto / src / init-env.sh

#!/bin/sh

WORKING_DIR=$(dirname $(which $0))

PREFIX_ROOT=/opt
LIB_ROOT=$PREFIX_ROOT/lib
SVR_ROOT=$PREFIX_ROOT/svr
CONF_ROOT=$PREFIX_ROOT/conf
SH_ROOT=$PREFIX_ROOT/sh

TGZ_SUFFIX='.tar.gz'
MEMCACHED=memcached-1.4.13
LIBEVENT=libevent-2.0.18

# SOME GENERAL GCC OPTIMIZATION
GLOBAL_MAKE_OPTS=" -O2 -j3 "

get_srcpkg_basename () {
    echo "$1" | cut -d"-" -f1
}

make_links() {
    test -z "$1" && exit -2;
    src_bn=$(get_srcpkg_basename "$1")
    ln -s -T "$1" $src_bn
}

extract () {
    # unpack a tar archive, decompressing as necessary.
    # this function is meant to isolate us from problems
    # with versions of tar that don't support .gz or .bz2.
    echo Extracting $1 ...
    case "$1" in
        *.tar)
            tar -xf "$1"
            ;;
        *.zip)
            unzip "$1"
            ;;
        *.tgz | *.tar.gz)
            gunzip -c "$1" | tar -xf -
            ;;
        *.tar.bz2)
            bunzip2 -c "$1" | tar -xf -
            ;;
        *)
            echo "Unable to unpack $1; extension not recognized."
            exit 1
    esac
    if [ $? -gt 0 ]
    then
        echo Usage: $0 tarball
    fi
}

alias x=extract