removido
(usa Nenhuma)
Enviado em 01/02/2011 - 16:00h
#!/bin/bash
# -----------------------------------------------------------------------
# - Feito por: Douglas Giorgio Fim -
# - E-mail: douglasfim@yahoo.com.br -
# - Programa: dgfports -
# - Versao: x.x -
# - -
# - Este script pode ser alterado e distribuido por qualquer pessoa, -
# - desde que este quadro se mantenha inalterado. -
# - -
# - Obs.: Este script foi desenvolvido para criação de ports com -
# - scripts do slackbuilds.org. -
# - Não me responsabilizo pelas alterações do usuário. -
# -----------------------------------------------------------------------
#
# recomendo alterar somente as variaveis.
DIRPORTS=/usr/local/dgfports # defina aqui o diretorio padrão do ports, evite colocar diretorio existente, de preferencia não alterar.
SLACK_VERSION=13.1 # defina aqui a versão de seu slackware, esse valor tem que ser o mesmo do slackbuilds.org
# script direcionado para download.sh
EXAMPLE_SCRIPT='
ARCH=`uname -m`
case $1 in
-h|help|-help|--help)
echo "
Download SlackBuilds script -> Download program
./download.sh
Download SlackBuilds script -> Download program -> run SlackBuilds script
./download.sh makepkg
Install Package
./download.sh installpkg
Download SlackBuilds script -> Download program -> run SlackBuilds script -> Install the package
./download.sh all
Download SlackBuilds script -> Download program -> Resolve dependencies -> run SlackBuilds script -> Install the package
./download.sh dgf
não é compativel com todos os programas
Clean
./download.sh clean
limpa o diretorio atual
./donwload.sh clean distifiles
limpa o diretorio DISTIFILES
"
exit 1
;;
clean)
case $2 in
distifiles|DISTFILES)
rm -rf $DIRPORTS/DISTFILES/*
exit 1
;;
"")
for i in `ls | grep -v download.sh`; do rm -rf $i ; done
exit 1
;;
*)
echo "Parametro invalido"
exit 1
;;
esac
;;
esac
'
# script direcionado para download.sh
EXAMPLE_SCRIPT2='
cd $TOTAL_DIR
PRGNAM=`more *.info | grep PRGNAM | cut -d= -f2 | sed s/\"//g`
VERSION=`more *.info | grep VERSION | cut -d= -f2 | sed s/\"//g`
LINK1=`more *.info | grep DOWNLOAD_x86_64= | cut -d= -f2 | sed s/\"//g`
LINK2=`more *.info | grep DOWNLOAD= | cut -d= -f2 | sed s/\"//g`
chmod +x ./$PRGNAM.SlackBuild
if [ "$ARCH" == "x86_64" ]; then
if [ "$LINK1" == "" ];then
LINK_DOWNLOAD="$LINK2"
else
LINK_DOWNLOAD="$LINK1"
fi
else
LINK_DOWNLOAD="$LINK2"
fi
case $1 in
basic)
exit 1
;;
makepkg)
wget -c "$LINK_DOWNLOAD"
./$PRGNAM.SlackBuild
exit 1
;;
installpkg)
installpkg /tmp/$PRGNAM-$VERSION-$ARCH-*.t?z
exit 1
;;
all)
wget -c "$LINK_DOWNLOAD"
./$PRGNAM.SlackBuild && installpkg /tmp/$PRGNAM-$VERSION-`uname -m`-*.t?z
exit 1
;;
esac
'
EXAMPLE_SCRIPT_DGF="
case \$1 in
dgf|DGF)
#grep -wv 'rm -rf \$PKG' \$PRGNAM.SlackBuild | grep -wv 'rm -rf \$PRGNAM-\$VERSION' > \$PRGNAM.SlackBuild.dgf
#chmod +x \$PRGNAM.SlackBuild.dgf
#./\$PRGNAM.SlackBuild.dgf
wget -c \"\$LINK_DOWNLOAD\"
./\$PRGNAM.SlackBuild 2> \$TOTAL_DIR/ERRO_DEPENDS
ERRO_DEPENDS=\`more \$TOTAL_DIR/ERRO_DEPENDS | grep \"No package\" | awk '{print \$3}' | sed s/\'//g\ || echo ''\`
if [ \"\$ERRO_DEPENDS\" != \"\" ]; then
cd /usr/local/dgfports/*/\$ERRO_DEPENDS/
./download.sh dgf
"
EXAMPLE_SCRIPT_DGF2="
./download.sh dgf
exit 1
fi
installpkg /tmp/\$PRGNAM-\$VERSION-\$ARCH-*.t?z
echo \`ls /tmp/\$PRGNAM-\$VERSION-\$ARCH-*.t?z\` >> \$DIRPORTS/DISTFILES/TMP/package_installed
echo \"Package installed
\`more \$DIRPORTS/DISTFILES/TMP/package_installed\`\"
exit 1
;;
esac
"
EXAMPLE_SCRIPT_FINAL='
wget -c "$LINK_DOWNLOAD"
exit 1
'
# parametro para remoção do ports
case $1 in
-r)
echo "Removendo o DGFPorts..."
rm -rf $DIRPORTS
echo "Remoção concluida!"
exit 1
;;
-h)
echo "
Instalar o DGFPorts
./dgfportscreate.sh
Atualizar o DGFPorts
./dgfportscreate.sh
Remover o DGFPorts
./dgfportscreate.sh -r
Diretorio padrão do DGFPorts
/usr/local/dgfports
Instalar um aplicativo pelo DGFPorts
/usr/local/dgfports/<classe>/<aplicativo>/download.sh <parametro>
Mais informações sobre o download.sh
download.sh -h
"
exit 1
;;
""|" ")
echo ""
;;
*)
echo "Parametro invalido"
exit 1
;;
esac
mkdir -pv "$DIRPORTS" || exit 1
cd "$DIRPORTS" || exit 1
SLACKBUILD_WEB() {
wget
ftp://slackbuilds.org/$SLACK_VERSION/SLACKBUILDS.TXT.gz || echo "Falha ao tentar baixar o arquivo
ftp://slackbuilds.org/$SLACK_VERSION/SLACKBUILDS.TXT.gz" ||exit 1
gunzip -f $DIRPORTS/SLACKBUILDS.TXT.gz
ATUAL=`md5sum $DIRPORTS/SLACKBUILDS | awk '{print $1}' || echo nada`
NOVO=`md5sum $DIRPORTS/SLACKBUILDS.TXT | awk '{print $1}'`
if [ "$NOVO" == "$ATUAL" ] ; then
echo "A sua versão é a mais recente"
echo -n "Deseja dar sequencia assim mesmo? [y/N] " ; read -n1 ESCOLHA
echo ""
case $ESCOLHA in
n|N|"") exit 1 ;;
y|Y) echo "AGUARDE..." ;;
*) echo "Parametro invalido!" ; exit 1 ;;
esac
fi
mv $DIRPORTS/SLACKBUILDS.TXT $DIRPORTS/SLACKBUILDS
}
SLACKBUILD_WEB # comente essa linha em caso de desenvolvimento e testes
# cria os diretorios, não é recomendavel alterar
mkdir -pv "$DIRPORTS/DISTFILES/TMP"
touch "$DIRPORTS/DISTFILES/TMP/package_installed"
for i in `grep LOCATION: $DIRPORTS/SLACKBUILDS | awk '{print $3}'` ; do mkdir -pv $i & done
# função criada para criação de novas funções ao script
RECURS() {
for DIR in `ls -l "$DIRPORTS" | grep "^d" | grep -v DISTFILES | awk '{print $9}'` ; do
cd "$DIRPORTS/$DIR"
for SUB_DIR in `ls -l "$DIRPORTS/$DIR" | grep "^d" | grep -v DISTFILES | awk '{print $9}'` ; do
cd "$DIRPORTS/$DIR/$SUB_DIR"
$*
done
done
}
# Exemplo de uso:
#
# RECURS 'touch download.sh'
# RECURS 'chmod +x download.sh'
# remoção e criação de scripts, não é recomendavel alterar
for DIR in `ls -l "$DIRPORTS" | grep "^d" | grep -v DISTFILES | awk '{print $9}'` ; do
cd "$DIRPORTS/$DIR"
for SUB_DIR in `ls -l "$DIRPORTS/$DIR" | grep "^d" | grep -v DISTFILES | awk '{print $9}'` ; do
cd "$DIRPORTS/$DIR/$SUB_DIR"
echo "Removendo script $DIRPORTS/$DIR/$SUB_DIR/download.sh" &
rm -rf download.sh
echo "Criando script $DIRPORTS/$DIR/$SUB_DIR/download.sh" &
echo -e '#!/bin/bash\n' > download.sh
echo "DIRPORTS=$DIRPORTS" >> download.sh
echo "TOTAL_DIR=$DIRPORTS/$DIR/$SUB_DIR" >> download.sh
echo "$EXAMPLE_SCRIPT" >> download.sh
echo "wget -c
ftp://slackbuilds.org/$SLACK_VERSION/$DIR/$SUB_DIR.tar.gz" >> download.sh
echo "tar -xzvf $DIRPORTS/$DIR/$SUB_DIR/$SUB_DIR.tar.gz -C ../" >> download.sh
echo "cd $DIRPORTS/$DIR/$SUB_DIR" >> download.sh
echo "$EXAMPLE_SCRIPT2" >> download.sh
echo "$EXAMPLE_SCRIPT_DGF" >> download.sh
echo " cd $DIRPORTS/$DIR/$SUB_DIR" >> download.sh
echo "$EXAMPLE_SCRIPT_DGF2" >> download.sh
echo "$EXAMPLE_SCRIPT_FINAL" >> download.sh &
chmod +x download.sh
done
done
echo ""
exit 0