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 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:
svn checkout svn://radix.pro/scm-tools/cscm/tags/cscm-0.1.4 cscm-0.1.4
and run the bootstrap script:
cd csvn-0.1.4
./bootstrap
Also cScm source packages are available for download on the Radix.pro FTP-server.
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.
./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:
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
./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
make
make install
Cross Compilation Example
#!/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
:
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:
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:
# 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:
# 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:
[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:
[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 directory where you can find RPM spec file and also ArchLinux Package Build script.
See Also
Copyright and License
© Andrey V. Kosteltsev, 2019 – 2022.
Code and documentation released under the Radix.pro License.