-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.sh
More file actions
executable file
·60 lines (47 loc) · 1.53 KB
/
Copy pathgit.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Creating Cvn Project Name
echo "Enter the git project name you want to create"
read -p"Enter git Folder name:" gitproject
cd /var/www/git
if [ -d "$gitproject" ]; then
echo " Svn Repo Name Already Exists , Please Enter Unic Name"
exit
else
mkdir -p /var/www/git/$gitproject && cd /var/www/git/$gitproject
git init --bare --shared
git config --file config http.receivepack true
chown -R apache:apache /var/www
fi
cd /etc/httpd/conf.d
echo "Enter the Svnapache filename you want to create"
read -p "Enter file Name:" gitconf
if [ -f "$gitconf.conf" ]; then
echo " Svn configuration file Already Exists , Please Enter Unic Name"
else
touch $gitconf.conf
fi
echo " Inserting svn Configuration Line TO conf File"
sleep 2
cat > $gitconf.conf << EOL
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<LocationMatch "^/git/$gitproject.*$">
Options all
Order deny,allow
AuthType Basic
AuthName "Staratafair git repository"
AuthBasicProvider ldap
AuthzLDAPAuthoritative on
AuthLDAPURL ldap:///DC=newmediaguruorg,DC=com?sAMAccountName?sub?(objectClass=user)
AuthLDAPBindDN
AuthLDAPBindPassword
Include $gitconf.txt
# Satisfy any
</LocationMatch>
EOL
echo " Enter numer of user you want to Allow "
read username
touch /etc/httpd/$gitconf.txt
echo Require ldap-user $username >> /etc/httpd/$gitconf.txt
service httpd restart