summaryrefslogtreecommitdiff
path: root/devobsserver/script/repos.sh
blob: 2d3ae3d848c611383551bacd2c83fdddbe14d0b5 (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
#!/bin/sh
#===============================================================================
# Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
# Author onstudy@samsung.com
#
# 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; version 2 of the License
#
# 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.
#===============================================================================

status () {
  echo "---> ${@}" >&2
}

if [ ! -e /srv/obs/docker_bootstrapped ]; then
  if [ ! -z "$1" ];then
      reposfolder=$1
  else
      reposfolder="/srv/obs/repos"
  fi

  if [ ! -e "$reposfolder" ];then
     mkdir -p $reposfolder
  fi

  status "chown for first run"
  chown -R obsrun:obsrun /srv/obs/
  chown -R wwwrun:www /srv/www/obs/api/
  chown -R wwwrun:www /srv/www/obs/webui/

  touch /srv/obs/docker_bootstrapped
else
  status "found docker_bootstrapped"
fi