De acordo com as Leis 12.965/2014 e 13.709/2018, que regulam o uso da Internet e o tratamento de dados pessoais no Brasil, ao me inscrever na newsletter do portal DICAS-L, autorizo o envio de notificações por e-mail ou outros meios e declaro estar ciente e concordar com seus Termos de Uso e Política de Privacidade.
Colaboração: Kaio Rafael
Data de Publicação: 06 de Janeiro de 2007
O script abaixo automatiza o processo de criação de um reposotório do Subversion, antes da execução do mesmo, mude as variáveis do script para seu funcionamento.
#!/bin/bash # # Copyright 2006 Kaio Rafael de Souza Barbosa # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # --------------------------------------------------------- # Este script cria repositorio, muda a permissao para o apache # poder ler e escrever os commits realizados pelos usuarios # # Para mais detalhes do subversion acesse: # http://svnbook.red-bean.com/nightly/pt_BR/svn-book.html#svn.serverconfig.httpd # http://svnbook.red-bean.com/nightly/pt_BR/svn-book.html#svn.reposadmin # Variables svn_root_home=/home/kaio/web-svn # diretorio que armazena todos os repositorios do subversion svn_adm_cmd=/usr/bin/svnadmin # comando do svnadmin apache_user=www-data # usuario que executa o apache apache_group=www-data # grupo do usuario que execua o apache svn_pass=/etc/apache2/senha # senha dos usuarios do subversion svn_access_file=/etc/apache2/projetos # diretorio com as permissoes do subversion svn_tmp=/tmp/repos # arquivo temporario svn_web_page=/svn # endereco web que ficara o repositorio http://server/svn/nome_repositorio nome_empresa="Free Software Foundation" # Nome da sua empresa # Functions create_svn(){ echo -n "Entre com o nome do repositorio a ser criado: " read svn_repos # verifica se o repositorio ja existe if [ -d ${svn_root_home}/${svn_repos} ];then echo "Repositorio ${svn_repos} ja existe" exit 1 else if `${svn_adm_cmd} create ${svn_root_home}/${svn_repos}` ; then echo "Repositorio ${svn_repos}, criado com sucesso!!" else echo "Erro na criacao do repositorio ${svn_repos}" exit 1 fi fi # Mudando as permissoes de dav lock e db echo "Mudando as permissoes de dav, lock e db" chmod g+w ${svn_root_home}/${svn_repos}/dav ${svn_root_home}/${svn_repos}/locks ${svn_root_home}/${svn_repos}/db chmod g+s ${svn_root_home}/${svn_repos}/dav ${svn_root_home}/${svn_repos}/locks ${svn_root_home}/${svn_repos}/db chown -R ${apache_user}:${apache_group} ${svn_root_home}/${svn_repos}/dav chown -R ${apache_user}:${apache_group} ${svn_root_home}/${svn_repos}/locks chown -R ${apache_user}:${apache_group} ${svn_root_home}/${svn_repos}/db touch ${svn_access_file}/${svn_repos} sleep 1 # Imprimindo a saida para o Apache cat << EOF > $svn_tmp ########################### # Projeto ${svn_repos} ########################### <Location ${svn_web_page}/${svn_repos}> DAV svn SVNPath ${svn_root_home}/${svn_repos} AuthType Basic AuthName "${svn_repos} em ${nome_empresa} " AuthUserFile ${svn_pass} AuthzSVNAccessFile ${svn_access_file}/${svn_repos} Require valid-user Allow from all </Location> EOF echo "Adicione as linhas abaixo no arquivo do apache" echo " " cat $svn_tmp } usage(){ echo "$(basename $0) opcoes" echo "Opcoes" echo "--create : Cria um repositorio" echo "--help : Imprime esta ajuda" } # Main Program if [ $(id -u) -eq 0 ];then if [ $# -eq 0 ]; then usage else case $1 in --create) create_svn;; --help) usage;; *) echo "Parametro $1, desconhecido";; esac fi else echo "Voce nao e' o root" exit 1 fi
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Comentários