mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
git-srv-admin.sh: Beautify code
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
98e7606029
commit
53a75a70a7
1 changed files with 13 additions and 11 deletions
|
|
@ -15,7 +15,9 @@ usage()
|
|||
| commands are:
|
||||
|
|
||||
| create-repo name
|
||||
| update-descriptions
|
||||
| list-repos
|
||||
| create-repo-dir
|
||||
| list-maintainers
|
||||
|
|
||||
EOT
|
||||
|
|
@ -69,7 +71,7 @@ md_p()
|
|||
md $@
|
||||
}
|
||||
|
||||
create_repo_dir()
|
||||
cmd_cmd_create_repo_dir()
|
||||
{
|
||||
if [ "$UID" != 0 ]; then
|
||||
fatal "tried to create directory \"$dir\" as `whoami`, needs to be done as root"
|
||||
|
|
@ -81,7 +83,7 @@ create_repo_dir()
|
|||
md_p $dir 02750 $id `id -g $id`
|
||||
}
|
||||
|
||||
create_repo()
|
||||
cmd_create_repo()
|
||||
{
|
||||
[ -e $dir ] && {
|
||||
err "$dir already exists"
|
||||
|
|
@ -101,12 +103,12 @@ read_project_metadata()
|
|||
git -C $pd show HEAD:make/project.conf | sed -n "/^\[$field\]/,/^\[/ p" | grep -v '\[' | cat -s | sed '${/^$/d;}'
|
||||
}
|
||||
|
||||
update_descriptions()
|
||||
cmd_update_descriptions()
|
||||
{
|
||||
[ -d $pdir ] || return 0
|
||||
cd $pdir || return 1
|
||||
local projs="$*"
|
||||
[ "$projs" = all ] && projs=`list_repos`
|
||||
[ "$projs" = all ] && projs=`cmd_list_repos`
|
||||
local proj
|
||||
for proj in $projs; do
|
||||
umask 0022
|
||||
|
|
@ -129,7 +131,7 @@ update_descriptions()
|
|||
done
|
||||
}
|
||||
|
||||
list_repos()
|
||||
cmd_list_repos()
|
||||
{
|
||||
[ -d $pdir ] || return 0
|
||||
cd $pdir || return 1
|
||||
|
|
@ -137,7 +139,7 @@ list_repos()
|
|||
return $?
|
||||
}
|
||||
|
||||
list_maintainers()
|
||||
cmd_list_maintainers()
|
||||
{
|
||||
local dev_chief=jan
|
||||
local master_dir=/srv/git/$dev_chief/proj
|
||||
|
|
@ -223,21 +225,21 @@ dir=$pdir/$p
|
|||
case $cmd in
|
||||
create-personal-project|create-repo)
|
||||
check_user_is_self
|
||||
create_repo "$@"
|
||||
cmd_create_repo "$@"
|
||||
;;
|
||||
update-descriptions|update-descr)
|
||||
update_descriptions "$@"
|
||||
cmd_update_descriptions "$@"
|
||||
;;
|
||||
list-personal-projects|list-repos)
|
||||
list_repos "$@"
|
||||
cmd_list_repos "$@"
|
||||
;;
|
||||
create-project-dir|create-repo-dir)
|
||||
dir=$1 # this is all a horrible variable and usage mess
|
||||
check_user_is_self
|
||||
create_repo_dir "$@"
|
||||
cmd_cmd_create_repo_dir "$@"
|
||||
;;
|
||||
list-maintainers|maintainers)
|
||||
list_maintainers
|
||||
cmd_list_maintainers
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue