Bash скрипт быстрого создания репозитария SVN

#!/bin/bash

if [ "$#" -eq 0 ]; then
    echo "No arguments supplied"
    exit 1
fi

REPOSITORY_USER="user"
REPOSITORY_PASSWORD="password"
REPOSITORY_BASE_URL="svn://server.url"

if [ "$#" -eq 1 ]; then
    REPOSITORY_NAME=$1
    PROJECT_NAME=$1
fi

if [ "$#" -eq 2 ]; then
    REPOSITORY_NAME=$1
    PROJECT_NAME=$2
fi

REPOSITORY_URL="${REPOSITORY_BASE_URL}/${REPOSITORY_NAME}"

svnadmin create ${REPOSITORY_NAME}
echo "${REPOSITORY_USER} = ${REPOSITORY_PASSWORD}" >> ./${REPOSITORY_NAME}/conf/passwd
sed -i "s/# anon-access/anon-access/g" ./${REPOSITORY_NAME}/conf/svnserve.conf
sed -i "s/# auth-access/auth-access/g" ./${REPOSITORY_NAME}/conf/svnserve.conf
sed -i "s/# password-db/password-db/g" ./${REPOSITORY_NAME}/conf/svnserve.conf
sed -i "s/# realm = My First Repository/realm = ${PROJECT_NAME}/g" ./${REPOSITORY_NAME}/conf/svnserve.conf
svn mkdir -m "First commit" "${REPOSITORY_URL}/trunc" "${REPOSITORY_URL}/branches" "${REPOSITORY_URL}/tags" --username "${REPOSITORY_USER}" --password "${REPOSITORY_PASSWORD}" --no-auth-cache > /dev/null
© 2008-2018 Spider13 Software Twitter