summaryrefslogtreecommitdiff
path: root/www/gitlab-ce/scripts/create-plist.php
blob: b1d4293ea66061ebaab8487d1d0ac9604db517ba (plain) (blame)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php

if(empty($argv[1]))
  die("please specify gitlab-worksrc\n");

$strGitLabDir = $argv[1];

if(!is_dir($strGitLabDir))
  die("given path is not a dir: $strGitLabDir\n");

if(!is_readable($strGitLabDir))
  die("given path is not readable: $strGitLabDir\n");

// remove last slash of path if given to easy
// path handling later
if(strrpos($strGitLabDir, '/') == (strlen($strGitLabDir) - 1))
  $strGitLabDir = substr($strGitLabDir, 0, strlen($strGitLabDir) - 1);

$objDir = new RecursiveDirectoryIterator($strGitLabDir);
$objDir = new RecursiveIteratorIterator($objDir);

$arrFiles = array();

// iterate through complete given work-dir
foreach($objDir AS $objFile) {

  // skip dirs, we only want files
  if(!$objFile->isFile())
    continue;

  // skip unwanted files
  if(in_array($objFile->getExtension(),
              array('orig', 'bak', 'gitkeep', 'gitignore')))
     continue;

  // skip lock file, it shoud be generated when GitLab is started
  if('Gemfile.lock' === $objFile->getFilename())
    continue;

  // strip given dir - we just want the aim-dir
  $intEndPosOfDir = strpos($objFile->getRealPath(), $strGitLabDir) + strlen($strGitLabDir);
  $strFilePath    = substr($objFile->getRealPath(), $intEndPosOfDir);

  // list of config files to ignore
  $arrConfigFiles = array('/config/database.yml.example',
                          '/config/gitlab.yml.example',
                          '/config/puma.rb.example',
                          '/config/resque.yml.example',
                          '/config/secrets.yml.example',
                          '/config/initializers/rack_attack.rb.example',
			  '/config/cable.yml.example',
			  '/config/initializers/devise_password_length.rb.example',
			  '/config/redis.cache.yml.example',
			  '/config/redis.queues.yml.example',
			  '/config/redis.shared_state.yml.example',
			  '/config/sidekiq.yml.example',
                          '/lib/support/nginx/gitlab',
                          '/lib/support/nginx/gitlab-ssl',
			  '/config/secrets.yml' );

  // skip config files
  if(in_array($strFilePath, $arrConfigFiles))
    continue;

  $arrFiles[] = "%%WWWDIR%%$strFilePath";

}

sort($arrFiles);

// go through the files and print them
foreach($arrFiles AS $strFile) {

  // if a file starts with /bin/ add executable rights
  if(is_int(strpos($strFile, '%%WWWDIR%%/bin/'))) {
    print "@(git,,544) $strFile\n";

  // schema.rb needs git-owner, because its written on updates
  } elseif ($strFile === '%%WWWDIR%%/db/schema.rb') {
    print "@(git,,) $strFile\n";

  // gitlab.po(t) files needs git-owner, because there were compiled on update/installation
  } elseif (fnmatch('*/gitlab.pot', $strFile) ||
            fnmatch('*/gitlab.po', $strFile) ||
            fnmatch('*/gitlab.po.time_stamp', $strFile)) {
    print "@(git,,) $strFile\n";

    // also there is javascript compiled on update/install which is localiced
  } elseif (fnmatch('*/locale/*/app.js', $strFile) ||
            fnmatch('*/locale/index.js', $strFile)) {
    print "@(git,,) $strFile\n";
    
  // everything else is just fine
  } else {
    print "$strFile\n";
  }
}

// at least print static block of dirs and config files
print "@owner git
@group www
@dir(git,git) %%WWWDIR%%/
@dir %%WWWDIR%%/app/assets/images/auth_buttons/
@dir %%WWWDIR%%/app/assets/javascripts/locale/
@dir(git,git,554) %%WWWDIR%%/bin
@dir %%WWWDIR%%/config
@dir(,,700) %%WWWDIR%%/builds
@dir(,,744) %%WWWDIR%%/locale
@dir %%WWWDIR%%/lib/assets
@dir(,,744) %%WWWDIR%%/locale/bg
@dir(,,744) %%WWWDIR%%/locale/de
@dir(,,744) %%WWWDIR%%/locale/eo
@dir(,,744) %%WWWDIR%%/locale/es
@dir(,,744) %%WWWDIR%%/locale/fil_PH
@dir(,,744) %%WWWDIR%%/locale/fr
@dir(,,744) %%WWWDIR%%/locale/id_ID
@dir(,,744) %%WWWDIR%%/locale/it
@dir(,,744) %%WWWDIR%%/locale/ja
@dir(,,744) %%WWWDIR%%/locale/ko
@dir(,,744) %%WWWDIR%%/locale/nl_NL
@dir(,,744) %%WWWDIR%%/locale/pl_PL
@dir(,,744) %%WWWDIR%%/locale/pt_BR
@dir(,,744) %%WWWDIR%%/locale/ru
@dir(,,744) %%WWWDIR%%/locale/tr_TR
@dir(,,744) %%WWWDIR%%/locale/uk
@dir(,,744) %%WWWDIR%%/locale/zh_CN
@dir(,,744) %%WWWDIR%%/locale/zh_HK
@dir(,,744) %%WWWDIR%%/locale/zh_TW
@dir(,,744) %%WWWDIR%%/log
@dir %%WWWDIR%%/public
@dir %%WWWDIR%%/public/assets
@dir(,,700) %%WWWDIR%%/public/uploads
@dir %%WWWDIR%%/qa/qa/specs/features/api/2_plan
@dir %%WWWDIR%%/qa/qa/specs/features/api/4_verify
@dir %%WWWDIR%%/qa/qa/specs/features/api/5_package
@dir %%WWWDIR%%/qa/qa/specs/features/api/6_release
@dir %%WWWDIR%%/qa/qa/specs/features/api/7_configure
@dir %%WWWDIR%%/qa/qa/specs/features/api/8_monitor
@dir %%WWWDIR%%/qa/qa/specs/features/browser_ui/5_package
@dir %%WWWDIR%%/spec/support/gitlab-git-test.git/refs/heads
@dir %%WWWDIR%%/spec/support/gitlab-git-test.git/refs/tags
@dir(,,700) %%WWWDIR%%/shared
@dir(,,700) %%WWWDIR%%/shared/artifacts
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/cache
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/uploads
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/work
@dir(,,770) %%WWWDIR%%/shared/pages
@dir(,,700) %%WWWDIR%%/shared/tmp
@dir(,,700) %%WWWDIR%%/shared/lfs-objects
@dir(,,700) %%WWWDIR%%/shared/registry
@dir(,,700) %%WWWDIR%%/spec/javascripts/fixtures
@dir(,,770) %%WWWDIR%%/tmp
@dir(,,770) %%WWWDIR%%/tmp/backups
@dir(,,770) %%WWWDIR%%/tmp/cache
@dir(,,770) %%WWWDIR%%/tmp/feature_flags
@dir(,,770) %%WWWDIR%%/tmp/pids
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/puma
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/sidekiq
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/unicorn
@dir(,,770) %%WWWDIR%%/tmp/sessions
@dir(,,770) %%WWWDIR%%/tmp/sockets
@dir(,,770) %%WWWDIR%%/tmp/sockets/private
@dir(,,770) %%WWWDIR%%/vendor
@dir(,,770) %%WWWDIR%%/vendor/assets
@dir(,,770) %%WWWDIR%%/vendor/assets/stylesheets
@dir(,,770) %%WWWDIR%%/workhorse/changelogs/unreleased
@sample %%WWWDIR%%/config/puma.rb.sample
@sample(git,www,0600) %%WWWDIR%%/config/secrets.yml.sample
@sample %%WWWDIR%%/config/redis.cache.yml.sample
@sample %%WWWDIR%%/config/sidekiq.yml.sample
@sample %%WWWDIR%%/config/cable.yml.sample
@sample %%WWWDIR%%/config/gitlab.yml.sample
@sample %%WWWDIR%%/config/redis.queues.yml.sample
@sample %%WWWDIR%%/config/initializers/devise_password_length.rb.sample
@sample %%WWWDIR%%/config/redis.shared_state.yml.sample
@sample %%WWWDIR%%/config/resque.yml.sample
@sample %%WWWDIR%%/config/database.yml.sample
@sample %%WWWDIR%%/lib/support/nginx/gitlab.sample
@sample %%WWWDIR%%/lib/support/nginx/gitlab-ssl.sample";

print "\n";