summaryrefslogtreecommitdiff
path: root/libexec/appstore-init-server
blob: 141746992bbcf7ff8e7aadd98882de079d8ba801 (plain)
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
#!/bin/bash

set -e
set -u

APPSTORE_HOME=$(cd $(dirname "$0")/.. && pwd)

. $APPSTORE_HOME/lib/common
# HEADER END

root=$1; shift
name=$1; shift

echo "Creating appstore $name"

repo="$root/repos/$name"
apps="$root/appstores/$name"

if [ -e "$repo" ]
then
  echo "$name already exist!"
  exit 1
fi

# Create the git repository
git init -q --bare "$repo"

# Clone the repository
git init -q "$apps"
cd "$apps"

# Copy the template project
cp -r "$APPSTORE_HOME/template/"* .
git add -A
git config user.name "Appstore Bot"
git config user.email nobody@example.org
git commit -q -m "Created new appstore: $name."
git push -q "$repo" master
cd ..

# Install the hooks
cd "$repo"
pwd
rm hooks/*
rmdir hooks
ln -s "$APPSTORE_HOME/hooks" hooks
git config appstore.home "$APPSTORE_HOME"
git config appstore.apps "$apps"

echo "config: repo.path=$repo"