Author: thomas Date: Fri Jan 8 05:27:53 2021 New Revision: 24090 Log: Remove bootscript, add git-shell paragraph
Modified: trunk/BOOK/general/prog/gitserver.xml Modified: trunk/BOOK/general/prog/gitserver.xml ============================================================================== --- trunk/BOOK/general/prog/gitserver.xml Fri Jan 8 02:44:01 2021 (r24089) +++ trunk/BOOK/general/prog/gitserver.xml Fri Jan 8 05:27:53 2021 (r24090) @@ -92,6 +92,16 @@ <screen role="nodump"><userinput>git config --global init.defaultBranch trunk</userinput></screen> + <para> + Finally add the <filename>/usr/bin/git-shell</filename> entry to + the <filename>/etc/shells</filename> configuration file. This shell + has been set in the <systemitem class='username'>git</systemitem> + user profile and is to make sure that only git related actions + can be executed: + </para> + +<screen role="root"><userinput>echo "/usr/bin/git-shell" >> /etc/shells</userinput></screen> + </sect3> <sect3> @@ -193,7 +203,7 @@ </sect3> - <sect3> + <sect3 id="gitserver-init"> <title>4. Configure the Server</title> <para> @@ -218,124 +228,31 @@ </para> </note> - <para> - As user <systemitem class='username'>root</systemitem> do: + <para revision="sysv"> + To start the server at boot time, install the git-daemon + bootscript included in the <xref linkend="bootscripts"/> package: </para> -<screen role="root" revision="sysv"><userinput>cat > /etc/rc.d/init.d/git-daemon <<"EOF" -#!/bin/sh -######################################################################## -# Begin /etc/rc.d/init.d/git-daemon -# -# Description : Start/Stop git as a daemon -# -# Authors : -# -# Version : LFS 10.0 -# -# Notes : -# -######################################################################## - -### BEGIN INIT INFO -# Provides: git-daemon -# Required-Start: network -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: -# Default-Stop: -# Short-Description: git as daemon -# Description: -# X-LFS-Provided-By: -### END INIT INFO - -. /lib/lsb/init-functions - -GIT_BIN="/usr/bin/git" -DFT_REPO_DIR="/srv/git/" -PID_FILE="/run/git-daemon.pid" - -case "${1}" in - start) - log_info_msg "Starting git-daemon ..." - $GIT_BIN daemon \ - --detach \ - --pid-file=$PID_FILE \ - --user=git \ - --group=git \ - --reuseaddr \ - --base-path=$DFT_REPO_DIR $DFT_REPO_DIR - evaluate_retval - ;; - - stop) - log_info_msg "Stopping git-daemon ..." - killproc -p $PID_FILE $GIT_BIN - evaluate_retval - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - *) - echo "Usage: ${0} {start|stop|restart}" - exit 1 - ;; -esac - -exit 0 - -# End /etc/rc.d/init.d/git-daemon -EOF - -chmod 755 /etc/rc.d/init.d/git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc0.d/K29git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc1.d/K29git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc2.d/K29git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc3.d/S50git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc4.d/S50git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc5.d/S50git-daemon -ln -v -sf ../init.d/git-daemon /etc/rc.d/rc6.d/K29git-daemon</userinput></screen> - -<screen role="root" revision="systemd"><userinput>cat > /etc/systemd/system/git-daemon.service <<EOF -[Unit] -Description=Start Git Daemon - -[Service] -ExecStart=/usr/bin/git daemon --reuseaddr --base-path=/srv/git/ /srv/git/ - -Restart=always -RestartSec=500ms - -StandardOutput=syslog -StandardError=syslog -SyslogIdentifier=git-daemon + <indexterm zone="gitserver gitserver-init" revision="sysv"> + <primary sortas="f-git">git</primary> + </indexterm> -User=git -Group=git - -[Install] -WantedBy=multi-user.target -EOF</userinput></screen> +<screen role="root" revision="sysv"><userinput>make install-git-daemon</userinput></screen> <para revision="systemd"> - Enable and start the daemon by executing: + To start the server at boot time, install the + <filename>git-daemon.service</filename> unit from the + <xref linkend="systemd-units"/> package: </para> -<screen role="root" revision="systemd"><userinput>systemctl enable git-daemon && -systemctl start git-daemon</userinput></screen> - - <para revision="sysv"> - Start the daemon be executing - </para> -<screen role="root" revision="sysv"><userinput>/etc/rc.d/init.d/git-daemon start</userinput></screen> - + <indexterm zone="gitserver gitserver-init" revision="systemd"> + <primary sortas="f-gitserve">gitserve</primary> + </indexterm> + +<screen role="root" revision="systemd"><userinput>make install-git-daemon</userinput></screen> + <para> - In order to allow <application>git</application> to export a + In order to make <application>git</application> exporting a repository, a file named <filename>git-daemon-export-ok</filename> is required in each repository directory on the server. The file needs no content, just its existance enables, its absence @@ -344,6 +261,13 @@ <screen role="root"><userinput>touch /srv/git/project1.git/git-daemon-export-ok</userinput></screen> + <para> + Also review the configuration file + <filename revision="sysv">/etc/sysconfig/git-daemon</filename> + <filename revision="systemd">/etc/default/git-daemon</filename> + for valid repository paths. + </para> + </sect3> </sect2> -- http://lists.linuxfromscratch.org/listinfo/blfs-book FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page