Pejman Moghadam / Scripts

Bash script - Self Eextraction

pibluc domain


#!/bin/sh

BLU='\E[1;34m'
RES='\E[0m'

echo ""
echo -e "${BLU} Self-Extracting ${RES} ..."
echo ""

# create a temp directory to extract to.
export WRKDIR=`mktemp -d /tmp/selfextract.XXXXXX`

SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`

# Take the TGZ portion of this file and pipe it to tar.
tail +$SKIP $0 | tar xz -C $WRKDIR

# execute the installation script

PREV=`pwd`
cd $WRKDIR
./install.sh


# delete the temp files
cd $PREV
rm -rf $WRKDIR

echo ""
echo -e "${BLU} END ${RES} ..."
echo ""

exit 0

__ARCHIVE_FOLLOWS__

BY: Pejman Moghadam
TAG: extract
DATE: 2013-03-07 02:25:59


Pejman Moghadam / Scripts [ TXT ]