summaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
Diffstat (limited to 'run')
-rwxr-xr-xrun47
1 files changed, 5 insertions, 42 deletions
diff --git a/run b/run
index 44f505e..01751a7 100755
--- a/run
+++ b/run
@@ -1,45 +1,8 @@
#!/usr/bin/env fish
-argparse 'u/users=+' 'r/repos=+' -- $argv
-or exit 1;
+# echo check for permissions
+set -l USER (whoami)
+#cat /srv/repos/permission | grep -E "^
-# create users and copy keys in correct location, set permissions
-for user in (string split ',' $_flag_u)
- echo "Setting up user: $user"
- set -l HOME "/home/$user"
- adduser --home $HOME -D "$user" --shell "/usr/bin/git-shell"
- passwd -u "$user"
- mkdir "$HOME/.ssh"
- cp "/var/keys/$user/authorized_keys" "$HOME/.ssh/"
- chown -R $user "$HOME"
- chmod -R 700 "$HOME"
-end
-
-for repoConfig in (string split ',' $_flag_r)
- set -l parsedConfig (string split ':' $repoConfig)
- set -l repo $parsedConfig[1]
-
- # we assume all repos to be in /srv/repos
- set -l repoDir "/srv/repos/$repo"
- echo "Setting up repo: $repo"
- addgroup "$repo"
-
- # assign groups to user
- for user in $parsedConfig[2..]
- adduser "$user" "$repo"
- id "$user"
- end
-
- # setup repo dir
- if not test -d $repoDir
- mkdir -p $repoDir
- git init --bare $repoDir -b trunk
- end
- chgrp -R "$repo" "$repoDir"
-end
-
-echo "Setting up server"
-# generate host keys in case
-mkdir -p /var/keys/etc/ssh/ && ssh-keygen -A -f /var/keys
-# run ssh daemon
-/usr/sbin/sshd -D -e
+# run command
+/usr/bin/sudo -u git /usr/bin/git-shell -c "$argv"