瀏覽代碼

Allow for parameters passed to ssh-keygen.

This is to allow for '-t ed25519'. #2
master
Chris McCormick 6 年之前
父節點
當前提交
b0dcaf8b26
共有 1 個檔案被更改,包括 6 行新增4 行删除
  1. 6
    4
      gitnonymous-setup

+ 6
- 4
gitnonymous-setup 查看文件

@@ -22,16 +22,18 @@ sshwrapperfile="${confdir}/git-ssh-wrap"
22 22
 
23 23
 if [ "$1" = "" -o '-h' = "$1" -o '--help' = "$1" ]
24 24
 then
25
-  echo "Usage: $0 KEYNAME"
25
+  echo "Usage: $0 KEYNAME [SSH-KEYGEN-PARAMETERS]"
26 26
 else
27
-  comment="${1}@anonymous"
27
+  id="${1}"
28
+  shift
29
+  comment="id@anonymous"
28 30
   echo "-> Creating ${confdir}."
29 31
   mkdir -p "${confdir}/ssh"
30 32
   echo "-> Creating SSH key '${sshfile}'."
31 33
   echo "SSH key comment (public) is '${comment}'."
32
-  ssh-keygen -C "${comment}" -f "${sshfile}"
34
+  ssh-keygen -C "${comment}" -f "${sshfile}" "$@"
33 35
   echo "-> Creating SSH wrapper '${sshwrapperfile}'."
34
-  cat "${dir}/git-ssh-wrap" | sed "s/KEYNAME/${1}/" > "${sshwrapperfile}"
36
+  cat "${dir}/git-ssh-wrap" | sed "s/KEYNAME/${id}/" > "${sshwrapperfile}"
35 37
   chmod 755 "${sshwrapperfile}"
36 38
   echo "-> Creating config file '${configfile}'."
37 39
   cp ${dir}/config "${configfile}"

Loading…
取消
儲存