# cScm Configuration Daemon **cScm** Configuration Daemon – is a tool to convert SCM configuration files into binary format and store its in shared memory for reading by **cSvn-ui** and **cGit-ui** CGI scripts. ## Reqired packages **cScm** daemon depends on [libpcre2-32](https://www.pcre.org/) library. ArchLinux distribution has the **pcre2** binary package. On RPM based systems you can find somethink like **pcre2-devel** RPM. ## Installation The **cScm** package provides a regular Linux daemon with control scripts. ### Download Sources To obtain sources we have to checkout its from SVN repository: ```Bash svn checkout svn://radix.pro/cscm/tags/cscm-0.1.4 cscm-0.1.4 ``` and run the bootstrap script: ```Bash cd csvn-0.1.4 ./bootstrap ``` Also **cScm** source packages are available for download on the [Radix.pro FTP-server](https://ftp.radix.pro/pub/cscm/). #### Bootstrap Script The *bootstrap* script especialy created for *Autotools* install automation. To install *Autotools* into sourse directory on build machine (i.e. when **build** == **host**) the *bootstrap* script can be run without arguments. ```Bash ./bootstrap ``` I this case *Autotools* will be installed from current root file system. For the cross environment the `--target-dest-dir` option allows to install some stuff from development root file system: ```Bash TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2 \ ./bootstrap --target-dest-dir=${TARGET_DEST_DIR} ``` For example, in this case the *aclocal.m4* script will be collected from the `${TARGET_DEST_DIR}/usr/share/aclocal` directory. ### Configuring Sources ```Bash ./configure --prefix=/usr \ --sysconfdir=/etc \ --with-controldir=/etc/rc.d \ --with-logrotatedir=/etc/logrotate.d \ --with-homepath=/var/lib \ --with-logdir=/var/log \ --with-piddir=/var/run ``` #### Install on the Build Machine ```Bash make make install ``` #### Cross Compilation Example ```Bash #!/bin/sh TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2 TOOLCHAIN_PATH=/opt/toolchains/aarch64-S9XX-linux-glibc/1.1.4/bin TARGET=aarch64-s9xx-linux-gnu ./bootstrap --target-dest-dir=${TARGET_DEST_DIR} PKG_CONFIG=/usr/bin/pkg-config \ PKG_CONFIG_PATH=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \ PKG_CONFIG_LIBDIR=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \ STRIP="${TOOLCHAIN_PATH}/${TARGET}-strip" \ CC="${TOOLCHAIN_PATH}/${TARGET}-gcc --sysroot=${TARGET_DEST_DIR}" \ ./configure --prefix=/usr --build=x86_64-pc-linux-gnu \ --host=${TARGET} \ --sysconfdir=/etc \ --with-controldir=/etc/rc.d \ --with-logrotatedir=/etc/logrotate.d \ --with-homepath=/var/lib \ --with-logdir=/var/log \ --with-piddir=/var/run make make install DESTDIR=${TARGET_DEST_DIR} ``` Also we can make use of additional variables such as `CFLAGS`, `LDFLAGS`: ```Bash LDFLAGS="-L${TARGET_DEST_DIR}/lib -L${TARGET_DEST_DIR}/usr/lib" TARGET_INCPATH="-L${TARGET_DEST_DIR}/usr/include" CFLAGS="${TARGET_INCPATH}" CPPFLAGS="${TARGET_INCPATH}" ``` ### Post Install To run **cScm** daemon for some SCM engine we have to make control scripts executable: ```Bash chmod a+x /etc/rc.d/rc.csvnd chmod a+x /etc/rc.d/rc.cgitd ``` If you want to run the **cscmd** daemons on boot time then on systems with BSD-like initialization such as **Slackware** we have to add following lines to the */etc/rc.d/rc.M* and */etc/rc.d/rc.6* scripts correspondengly: **/etc/rc.d/rc.M:** ```Bash # Start cSvn SCM daemon: if [ -x /etc/rc.d/rc.csvnd ]; then /etc/rc.d/rc.csvnd start fi # Start cGit SCM daemon: if [ -x /etc/rc.d/rc.cgitd ]; then /etc/rc.d/rc.cgitd start fi ``` **/etc/rc.d/rc.6:** ```Bash # Stop cSvn SCM daemon: if [ -x /etc/rc.d/rc.csvnd ]; then /etc/rc.d/rc.csvnd stop fi # Stop cGit SCM daemon: if [ -x /etc/rc.d/rc.cgitd ]; then /etc/rc.d/rc.cgitd stop fi ``` For systems which uses systemd initialization you have to setup your own systemd unit like following: **/etc/systemd/system/csvnd.service:** ```ini [Unit] Description=The cSvn daemon After=network.target [Service] PIDFile=/var/run/csvnd.pid ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=svn --pid=/var/run/csvnd.pid --log=/var/log/csvnd.log --config=/etc/csvn-ui.rc ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target ``` **/etc/systemd/system/cgitd.service:** ```ini [Unit] Description=The cGit daemon After=network.target [Service] PIDFile=/var/run/cgitd.pid ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=git --pid=/var/run/cgitd.pid --log=/var/log/cgitd.log --config=/etc/cgit-ui.rc ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target ``` ## Binary Packages The instructions to build binary packages for popular Linux distributions are present in the [**Documentation**](https://csvn.radix.pro/cscm/trunk/doc/) directory where you can find **RPM** **spec** file and also **ArchLinux** Package Build script. ## See Also > [**cscmd(8)**](https://csvn.radix.pro/cscm/trunk/doc/cscmd.8.md),  > [**csvn-ui.rc(5)**](https://csvn.radix.pro/csvn-ui/trunk/doc/csvn-ui.rc.5.md),  > [**cgit-ui.rc(5)**](https://csvn.radix.pro/cgit-ui/trunk/doc/cgit-ui.rc.5.md). ## Copyright and License © Andrey V. Kosteltsev, 2019 – 2022.
Code and documentation released under [the **Radix.pro** License](https://csvn.radix.pro/cscm/trunk/LICENSE).