Monday, May 28, 2007

Self-extracting Archive

baraye sakhte ye archive file ke ham auto-extract bashe, ham auto install, mishe az in ravesh estefade kard :
1- ehtiaj be ye file header darim :

#!/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__


2- ehtiaj be ye file .tar.gz darim ke tush ./install.sh vujud dashte bashe mesle in :

#!/bin/bash

RED='\E[1;31m'
GRN='\E[1;32m'
RES='\E[0m'

echo -e "${RED} Upgrade to BIND 9.4.1 (Slackware11.0) ${RES} "
echo -e "${GRN} Making Backup ${RES} ..."
cp /etc/named.conf .
cp -r /etc/rndc.key .
cp -r /var/named .
rm -rf ./named/named.run

echo -e "${GRN} Downloading Package ${RES} ..."
wget -nv http://ftp.isc.org/isc/bind9/9.4.1/bind-9.4.1.tar.gz

echo -e "${GRN} Decompressing Package ${RES} ..."
tar -zxf ./bind-9.4.1.tar.gz

echo -e "${GRN} Configuring Package ${RES} ..."
cd ./bind-9.4.1
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var > /dev/null

echo -e "${GRN} Compiling Package ${RES} ..."
make > /dev/null

echo -e "${GRN} Removing Old Package ${RES} ..."
removepkg bind > /dev/null

echo -e "${GRN} Installing New Package ${RES} ..."
make install > /dev/null 2>&1
cd ..

echo -e "${GRN} Restoring Backup ${RES} ..."
mv ./named.conf /etc/named.conf
mv ./rndc.key /etc/rndc.key
rm -rf /var/named
mv ./named /var/
rm -rf ./bind-9.4.1

echo -e "${GRN} Cleaning Up ${RES} ..."
rm -rf bind-9.4.1.tar.gz

echo -e "${GRN} Restarting BIND ${RES} ..."
/etc/rc.d/rc.bind restart

echo -e "${RED} $(named -v) successfuly installed ${RES} "


3- bad mishe ba in dastur file e auto extract ro saakht :
# cat header file.tar.gz > newfile.sh
# chmod +x newfile.sh

Saturday, May 26, 2007

Ext3 Partition Format, Redhat 8.0

Emruz yeki az cache server ha hesabi adaa dar avord;
raahi gheir az in nadashtam :

# mke2fs -cvj -L "/storage" /dev/sda5

BIND 9.4.1 - Slackware 11.0

"Bind-9.3.2-P1" ke tu "slackware 11.0" hast bug dare ve ye seri site haro resolve nemikone, ba update kardanesh be "BIND 9.4.1" moshkelesh hal shod.
az in script baraye update kardanesh estefade kardam :



#!/bin/bash

RED='\E[1;31m'
GRN='\E[1;32m'
RES='\E[0m'

echo -e "${RED} Upgrade to BIND 9.4.1 (Slackware11.0) ${RES} "
echo -e "${GRN} Making Backup ${RES} ..."
cp /etc/named.conf .
cp -r /etc/rndc.key .
cp -r /var/named .
rm -rf ./named/named.run

echo -e "${GRN} Downloading Package ${RES} ..."
wget -nv http://ftp.isc.org/isc/bind9/9.4.1/bind-9.4.1.tar.gz

echo -e "${GRN} Decompressing Package ${RES} ..."
tar -zxf ./bind-9.4.1.tar.gz

echo -e "${GRN} Configuring Package ${RES} ..."
cd ./bind-9.4.1
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var > /dev/null

echo -e "${GRN} Compiling Package ${RES} ..."
make > /dev/null

echo -e "${GRN} Removing Old Package ${RES} ..."
removepkg bind > /dev/null

echo -e "${GRN} Installing New Package ${RES} ..."
make install > /dev/null 2>&1
cd ..

echo -e "${GRN} Restoring Backup ${RES} ..."
mv ./named.conf /etc/named.conf
mv ./rndc.key /etc/rndc.key
rm -rf /var/named
mv ./named /var/
rm -rf ./bind-9.4.1

echo -e "${GRN} Cleaning Up ${RES} ..."
rm -rf bind-9.4.1.tar.gz

echo -e "${GRN} Restarting BIND ${RES} ..."
/etc/rc.d/rc.bind restart

echo -e "${RED} $(named -v) successfuly installed ${RES} "