Ignore:
Timestamp:
01/08/2021 01:27:53 PM (3 years ago)
Author:
Thomas Trepl <thomas@…>
Branches:
10.1, 11.0, 11.1, 11.2, 11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, upgradedb, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
Children:
c5e3c1c
Parents:
00c165f2
Message:

Remove bootscript, add git-shell paragraph

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@24090 af4574ff-66df-0310-9fd7-8a98e5e911e0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • general/prog/gitserver.xml

    r00c165f2 rc4908df  
    9292
    9393<screen role="nodump"><userinput>git config --global init.defaultBranch trunk</userinput></screen>
     94
     95      <para>
     96        Finally add the <filename>/usr/bin/git-shell</filename> entry to
     97        the <filename>/etc/shells</filename> configuration file. This shell
     98        has been set in the <systemitem class='username'>git</systemitem>
     99        user profile and is to make sure that only git related actions
     100        can be executed:
     101      </para>
     102     
     103<screen role="root"><userinput>echo "/usr/bin/git-shell" &gt;&gt; /etc/shells</userinput></screen>
    94104
    95105    </sect3>
     
    194204    </sect3>
    195205
    196     <sect3>
     206    <sect3 id="gitserver-init">
    197207      <title>4. Configure the Server</title>
    198208
     
    219229      </note>
    220230
    221       <para>
    222         As user <systemitem class='username'>root</systemitem> do:
    223       </para>
    224 
    225 <screen role="root" revision="sysv"><userinput>cat &gt; /etc/rc.d/init.d/git-daemon &lt;&lt;"EOF"
    226 #!/bin/sh
    227 ########################################################################
    228 # Begin /etc/rc.d/init.d/git-daemon
    229 #
    230 # Description : Start/Stop git as a daemon
    231 #
    232 # Authors     :
    233 #
    234 # Version     : LFS 10.0
    235 #
    236 # Notes       :
    237 #
    238 ########################################################################
    239 
    240 ### BEGIN INIT INFO
    241 # Provides:            git-daemon
    242 # Required-Start:      network
    243 # Should-Start:
    244 # Required-Stop:
    245 # Should-Stop:
    246 # Default-Start:
    247 # Default-Stop:
    248 # Short-Description:   git as daemon
    249 # Description:
    250 # X-LFS-Provided-By:
    251 ### END INIT INFO
    252 
    253 . /lib/lsb/init-functions
    254 
    255 GIT_BIN="/usr/bin/git"
    256 DFT_REPO_DIR="/srv/git/"
    257 PID_FILE="/run/git-daemon.pid"
    258 
    259 case "${1}" in
    260    start)
    261       log_info_msg "Starting git-daemon ..."
    262       $GIT_BIN daemon               \
    263                --detach             \
    264                --pid-file=$PID_FILE \
    265                --user=git           \
    266                --group=git          \
    267                --reuseaddr          \
    268                --base-path=$DFT_REPO_DIR $DFT_REPO_DIR
    269       evaluate_retval
    270       ;;
    271 
    272    stop)
    273       log_info_msg "Stopping git-daemon ..."
    274       killproc -p $PID_FILE $GIT_BIN
    275       evaluate_retval
    276       ;;
    277 
    278    restart)
    279       ${0} stop
    280       sleep 1
    281       ${0} start
    282       ;;
    283 
    284    *)
    285       echo "Usage: ${0} {start|stop|restart}"
    286       exit 1
    287       ;;
    288 esac
    289 
    290 exit 0
    291 
    292 # End /etc/rc.d/init.d/git-daemon
    293 EOF
    294 
    295 chmod 755 /etc/rc.d/init.d/git-daemon
    296 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc0.d/K29git-daemon
    297 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc1.d/K29git-daemon
    298 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc2.d/K29git-daemon
    299 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc3.d/S50git-daemon
    300 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc4.d/S50git-daemon
    301 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc5.d/S50git-daemon
    302 ln -v -sf ../init.d/git-daemon /etc/rc.d/rc6.d/K29git-daemon</userinput></screen>
    303 
    304 <screen role="root" revision="systemd"><userinput>cat &gt; /etc/systemd/system/git-daemon.service &lt;&lt;EOF
    305 [Unit]
    306 Description=Start Git Daemon
    307 
    308 [Service]
    309 ExecStart=/usr/bin/git daemon --reuseaddr --base-path=/srv/git/ /srv/git/
    310 
    311 Restart=always
    312 RestartSec=500ms
    313 
    314 StandardOutput=syslog
    315 StandardError=syslog
    316 SyslogIdentifier=git-daemon
    317 
    318 User=git
    319 Group=git
    320 
    321 [Install]
    322 WantedBy=multi-user.target
    323 EOF</userinput></screen>
     231      <para revision="sysv">
     232        To start the server at boot time, install the git-daemon
     233        bootscript included in the <xref linkend="bootscripts"/> package:
     234      </para>
     235
     236      <indexterm zone="gitserver gitserver-init" revision="sysv">
     237        <primary sortas="f-git">git</primary>
     238      </indexterm>
     239
     240<screen role="root" revision="sysv"><userinput>make install-git-daemon</userinput></screen>
    324241
    325242      <para revision="systemd">
    326         Enable and start the daemon by executing:
    327       </para>
    328 
    329 <screen role="root" revision="systemd"><userinput>systemctl enable git-daemon &amp;&amp;
    330 systemctl start git-daemon</userinput></screen>
    331      
    332       <para revision="sysv">
    333         Start the daemon be executing
    334       </para>
    335 <screen role="root" revision="sysv"><userinput>/etc/rc.d/init.d/git-daemon start</userinput></screen>
    336      
    337       <para>
    338         In order to allow <application>git</application> to export a
     243        To start the server at boot time, install the
     244        <filename>git-daemon.service</filename> unit from the
     245        <xref linkend="systemd-units"/> package:
     246      </para>
     247
     248      <indexterm zone="gitserver gitserver-init" revision="systemd">
     249        <primary sortas="f-gitserve">gitserve</primary>
     250      </indexterm>
     251
     252<screen role="root" revision="systemd"><userinput>make install-git-daemon</userinput></screen>
     253
     254      <para>
     255        In order to make <application>git</application> exporting a
    339256        repository, a file named <filename>git-daemon-export-ok</filename>
    340257        is required in each repository directory on the server. The
     
    345262<screen role="root"><userinput>touch /srv/git/project1.git/git-daemon-export-ok</userinput></screen>
    346263
     264      <para>
     265        Also review the configuration file
     266        <filename revision="sysv">/etc/sysconfig/git-daemon</filename>
     267        <filename revision="systemd">/etc/default/git-daemon</filename>
     268        for valid repository paths.
     269      </para>
     270
    347271    </sect3>
    348272
Note: See TracChangeset for help on using the changeset viewer.