Commit Diff


commit - 13b2bc374c1870ec27b2eeb40efe68fd465f64bb
commit + bc854c7bc75429b27c69c3d76a040b8c428799ad
blob - c1a000c41f1170b02f9c21852f7ae112290e359a
blob + 493cc0be21876ef98254e54b19fae46bd2694f8c
--- gotsh/Makefile
+++ gotsh/Makefile
@@ -2,9 +2,6 @@
 
 .include "../got-version.mk"
 
-PREFIX ?=	/usr/local
-BINDIR ?=	${PREFIX}/bin
-
 PROG=		gotsh
 SRCS=		gotsh.c error.c pkt.c sha1.c serve.c path.c gitproto.c \
 		imsg.c pollfd.c reference_parse.c
@@ -24,8 +21,12 @@ DPADD = ${LIBZ} ${LIBUTIL}
 NOMAN = Yes
 .endif
 
+.if "${GOT_RELEASE}" != "Yes"
 realinstall:
 	${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
 	-m ${BINMODE} ${PROG} ${BINDIR}/${PROG}
+	-ln -s ${PROG} ${BINDIR}/git-receive-pack
+	-ln -s ${PROG} ${BINDIR}/git-upload-pack
+.endif
 
 .include <bsd.prog.mk>
blob - b12b0ba51bbe016f648cf3e84bd1c9bd1923fa51
blob + 8ce17258a21a3ca6d85936911d04356f49fd6535
--- gotsh/gotsh.1
+++ gotsh/gotsh.1
@@ -37,6 +37,13 @@ is not an interactive shell.
 is intended to be configured as the login shell of Git repository
 user accounts on servers running
 .Xr gotd 8 .
+If users require a different login shell,
+.Nm
+can be installed in the command search patch under the names
+.Cm git-receive-pack
+and
+.Cm git-upload-pack .
+.Pp
 The users can then interact with
 .Xr gotd 8
 over the network.
blob - bcad03d7f0b1bac247ec4be71f63f13760cefef8
blob + 5a2b73f904f22fa621428bd0c020578588edbdf3
--- gotsh/gotsh.c
+++ gotsh/gotsh.c
@@ -67,18 +67,29 @@ main(int argc, char *argv[])
 	char *unix_socket_path_env = getenv("GOTD_UNIX_SOCKET");
 	int gotd_sock = -1;
 	struct sockaddr_un	 sun;
+	char *gitcmd = NULL;
 
 #ifndef PROFILE
 	if (pledge("stdio recvfd unix unveil", NULL) == -1)
 		err(1, "pledge");
 #endif
-	if (argc != 3 ||
-	    strcmp(argv[1], "-c") != 0 ||
-	    (strncmp(argv[2], GOT_SERVE_CMD_SEND,
-	    strlen(GOT_SERVE_CMD_SEND)) != 0 &&
-	    (strncmp(argv[2], GOT_SERVE_CMD_FETCH,
-	    strlen(GOT_SERVE_CMD_FETCH)) != 0)))
-		usage();
+	if (strcmp(argv[0], GOT_SERVE_CMD_SEND) == 0 ||
+	    strcmp(argv[0], GOT_SERVE_CMD_FETCH) == 0) {
+		if (argc != 2)
+			usage();
+		if (asprintf(&gitcmd, "%s %s", argv[0], argv[1]) == -1)
+			err(1, "asprintf");
+	} else {
+		if (argc != 3 || strcmp(argv[1], "-c") != 0 ||
+		    (strncmp(argv[2], GOT_SERVE_CMD_SEND,
+		    strlen(GOT_SERVE_CMD_SEND)) != 0 &&
+		    (strncmp(argv[2], GOT_SERVE_CMD_FETCH,
+		    strlen(GOT_SERVE_CMD_FETCH)) != 0)))
+			usage();
+		gitcmd = strdup(argv[2]);
+		if (gitcmd == NULL)
+			err(1, "strdup");
+	}
 
 	if (unix_socket_path_env) {
 		if (strlcpy(unix_socket_path, unix_socket_path_env,
@@ -112,9 +123,10 @@ main(int argc, char *argv[])
 	if (pledge("stdio recvfd", NULL) == -1)
 		err(1, "pledge");
 #endif
-	error = got_serve(STDIN_FILENO, STDOUT_FILENO, argv[2], gotd_sock,
+	error = got_serve(STDIN_FILENO, STDOUT_FILENO, gitcmd, gotd_sock,
 	    chattygot);
 done:
+	free(gitcmd);
 	if (gotd_sock != -1)
 		close(gotd_sock);
 	if (error) {