Shell Script: Script para a instalação do pureftpd

Publicado por Perfil removido 13/04/2005

[ Hits: 4.705 ]

Download build_pureftpd.sh




Fiz um script que baixa o source, compila e gera o pacote para slackware.

  



Esconder código-fonte

#!/bin/sh
#
# compile and install pureftpd server
# by Estevão Ferreira eXagon--> haniball_br@hotmail.com
# version: 0.1
#
declared_vars () 
{
version=1.0.18
arch=i486
build=1but
tar=`which tar`
wget=`which wget`
pureftpd_source="pure-ftpd-$version.tar.bz2"
pureftpd_dir="pure-ftpd-$version"
url="ftp://ftp.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-$version.tar.bz2"
}

create_dirs ()
{
if [ "$TMP" = "" ]; then
        TMP=/tmp
fi

if [ "$BUILD_DIR" = "" ]; then
   BUILD_DIR=$TMP/pkg-pureftpd
fi

if [ ! -d $TMP ]; then
        mkdir -p $TMP
fi

if [ ! -d $BUILD_DIR ]; then
   mkdir -p $BUILD_DIR
fi
}

download ()
{
cd $TMP
$wget $url
}

compile () {
cd $TMP
$tar xvjf $pureftpd_source
cd $pureftpd_dir
CFLAGS="-O2 -march=i486 -mcpu=i686" \
CXXFLAGS="-O2 -march=i486 -mcpu=i686" \
./configure --prefix=/usr \
   --sysconfdir=/etc \
   --without-humor \
   --without-banner \
   --with-largefile \
   --with-language=brazilian-portuguese
make
make install DESTDIR=$BUILD_DIR
mkdir -p $BUILD_DIR/usr/doc/pureftpd-$version
mkdir -p $BUILD_DIR/etc
cp -a AUTHORS CONTACT COPYING ChangeLog FAQ HISTORY INSTALL \
NEWS README* THANKS $BUILD_DIR/usr/doc/pureftpd-$version
cp configuration-file/pure-ftpd.conf $BUILD_DIR/etc/
cp configuration-file/pure-config.pl $BUILD_DIR/usr/sbin/
chmod 755 $BUILD_DIR/usr/sbin/pure-config.pl
chown -R root:root $BUILD_DIR
}

create_scripts ()
{
mkdir -p $BUILD_DIR/install
mkdir -p $BUILD_DIR/etc/rc.d
cat > $BUILD_DIR/install/slack-desc << SLACKDESK
       |-----handy-ruler------------------------------------------------------|
pureftpd: pureftpd (FTP server daemon)
pureftpd:
pureftpd: Pure-FTPd is a free (BSD), secure, production-quality and
pureftpd: standard-conformant FTP server based upon Troll-FTPd. It doesn't
pureftpd: provide useless bells and whistles, but focuses on efficiency and
pureftpd: ease of use. It provides simple answers to common needs, plus
pureftpd: unique useful features for personal users as well as hosting
pureftpd:
pureftpd:
pureftpd:
pureftpd:
SLACKDESK
cat > $BUILD_DIR/etc/rc.d/rc.pureftpd << RC_PUREFTPD
#!/bin/sh
# Start/stop/restart the pureftp server:

ftpd_start() {
/usr/sbin/pure-config.pl /etc/pure-ftpd.conf
}

ftpd_stop() {
  killall pure-ftpd
}

ftpd_restart() {
  ftpd_stop
  sleep 1
  ftpd_start
}

case "\$1" in
'start')
  ftpd_start
  ;;
'stop')
  ftpd_stop
  ;;
'restart')
  ftpd_restart
  ;;
*)
  echo "usage \$0 start|stop|restart"
esac
RC_PUREFTPD
}
create_package ()
{
cd $BUILD_DIR
makepkg -l y -c n pureftpd-$version-$arch-$build.tgz
}

install_pureftpd ()
{
echo -en "\nDo you liked of install pureftpd? Y/n: "
read result

if [ "$result" = "y" -o "$result" = "Y" -o -z "$result" ]; then
   if [ -e $BUILD_DIR/pureftpd-$version-$arch-$build.tgz ]; then
   cd $BUILD_DIR
   installpkg pureftpd-$version-$arch-$build.tgz
   fi
else
   echo -e "\nThe pureftpd is not installed\n"
fi
}

declared_vars
create_dirs
download
compile
create_scripts
create_package
install_pureftpd

Scripts recomendados

Monta e desmonta o CD-ROM automaticamente

Manipular serviços no Runit (Void Linux)

Gammu - Script para geração de configuração - codinome "gammuninja"

Manutenção de rede

tirinha-0.5.sh : Baixa as tirinhas da Ilustrada da Folha de São Paulo


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário