-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmungo.sh
72 lines (43 loc) · 1.06 KB
/
mungo.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
source ./config
# declare directory variable
CURRENT_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPO_BASE="$PARENT_DIR"repos/
SITE_BASE="$PARENT_DIR"sites/
COMMAND=$1
NAME=$2
function create() {
echo "Creating repository & site"
mkdir "$REPO_BASE$NAME"
mkdir "$SITE_BASE$NAME"
echo "Initializing... repository"
cd $REPO_BASE$NAME
git --git-dir=. --work-tree=$SITE_BASE$NAME init
git --bare update-server-info
git config core.bare false
git config receive.denycurrentbranch ignore
echo "Installing post receive hooks.."
cp -rf $CURRENT_DIR/post-receive $REPO_BASE$NAME/hooks/
chmod +x $REPO_BASE$NAME/hooks/post-receive
echo "Your site $NAME has been created is ready for launch..."
}
function destory() {
echo "Destorying your repo & site..."
rm -rf $SITE_BASE$NAME
rm -rf $REPO_BASE$NAME
echo "Your $NAME repo & site has been successfully"
}
case $COMMAND in
--create)
create $NAME
;;
--destory)
destory $NAME
;;
--version)
echo "mungo "$VERSION
;;
*)
echo "No option is not recognized"
;;
esac