Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
eb626edd
Commit
eb626edd
authored
Jan 12, 2013
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace all stat command line calls with ruby equivalents
parent
4d0af232
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+8
-9
lib/tasks/gitlab/task_helpers.rake
lib/tasks/gitlab/task_helpers.rake
+9
-0
No files found.
lib/tasks/gitlab/check.rake
View file @
eb626edd
...
@@ -502,7 +502,7 @@ namespace :gitlab do
...
@@ -502,7 +502,7 @@ namespace :gitlab do
return
return
end
end
if
`stat --printf %a
#{
gitolite_config_path
}
`
==
"750"
if
File
.
stat
(
gitolite_config_path
).
mode
.
to_s
(
8
).
ends_with?
(
"750"
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
...
@@ -526,12 +526,11 @@ namespace :gitlab do
...
@@ -526,12 +526,11 @@ namespace :gitlab do
return
return
end
end
if
`stat --printf %U
#{
gitolite_config_path
}
`
==
gitolite_ssh_user
&&
# user
if
File
.
stat
(
gitolite_config_path
).
uid
==
uid_for
(
gitolite_ssh_user
)
&&
`stat --printf %G
#{
gitolite_config_path
}
`
==
gitolite_ssh_user
#group
File
.
stat
(
gitolite_config_path
).
gid
==
gid_for
(
gitolite_ssh_user
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
puts
"
#{
gitolite_config_path
}
is not owned by
#{
gitolite_ssh_user
}
"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
gitolite_config_path
}
"
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
gitolite_config_path
}
"
)
)
...
@@ -722,7 +721,7 @@ namespace :gitlab do
...
@@ -722,7 +721,7 @@ namespace :gitlab do
return
return
end
end
if
`stat --printf %a
#{
repo_base_path
}
`
==
"6770"
if
File
.
stat
(
repo_base_path
).
mode
.
to_s
(
8
).
ends_with?
(
"6770"
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
...
@@ -746,12 +745,11 @@ namespace :gitlab do
...
@@ -746,12 +745,11 @@ namespace :gitlab do
return
return
end
end
if
`stat --printf %U
#{
repo_base_path
}
`
==
gitolite_ssh_user
&&
# user
if
File
.
stat
(
repo_base_path
).
uid
==
uid_for
(
gitolite_ssh_user
)
&&
`stat --printf %G
#{
repo_base_path
}
`
==
gitolite_ssh_user
#group
File
.
stat
(
repo_base_path
).
gid
==
gid_for
(
gitolite_ssh_user
)
puts
"yes"
.
green
puts
"yes"
.
green
else
else
puts
"no"
.
red
puts
"no"
.
red
puts
"
#{
repo_base_path
}
is not owned by
#{
gitolite_ssh_user
}
"
.
red
try_fixing_it
(
try_fixing_it
(
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
repo_base_path
}
"
"sudo chown -R
#{
gitolite_ssh_user
}
:
#{
gitolite_ssh_user
}
#{
repo_base_path
}
"
)
)
...
@@ -832,7 +830,8 @@ namespace :gitlab do
...
@@ -832,7 +830,8 @@ namespace :gitlab do
next
next
end
end
if
run_and_match
(
"stat --format %N
#{
project_hook_file
}
"
,
/
#{
hook_file
}
.+->.+
#{
gitolite_hook_file
}
/
)
if
File
.
lstat
(
project_hook_file
).
symlink?
&&
File
.
realpath
(
project_hook_file
)
==
File
.
realpath
(
gitolite_hook_file
)
puts
"ok"
.
green
puts
"ok"
.
green
else
else
puts
"not a link to Gitolite's hook"
.
red
puts
"not a link to Gitolite's hook"
.
red
...
...
lib/tasks/gitlab/task_helpers.rake
View file @
eb626edd
...
@@ -45,6 +45,15 @@ namespace :gitlab do
...
@@ -45,6 +45,15 @@ namespace :gitlab do
end
end
end
end
def
uid_for
(
user_name
)
run
(
"id -u
#{
user_name
}
"
).
chomp
.
to_i
end
def
gid_for
(
group_name
)
group_line
=
File
.
read
(
"/etc/group"
).
lines
.
select
{
|
l
|
l
.
start_with?
(
"
#{
group_name
}
:"
)}.
first
group_line
.
split
(
":"
)[
2
].
to_i
end
def
warn_user_is_not_gitlab
def
warn_user_is_not_gitlab
unless
@warned_user_not_gitlab
unless
@warned_user_not_gitlab
current_user
=
run
(
"whoami"
).
chomp
current_user
=
run
(
"whoami"
).
chomp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment