cScm Configuration Daemon

cScm – 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

2 Commits   0 Branches   1 Tag
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   1) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   2) # cScm Configuration Daemon
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   3) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   4) **cScm** Configuration Daemon – is a tool to convert SCM configuration files into binary format and store its in shared memory
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   5) for reading by **cSvn-ui** and **cGit-ui** CGI scripts.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   6) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   7) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   8) ## Reqired packages
12c7b1c5 (kx 2023-03-24 02:53:04 +0300   9) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  10) **cScm** daemon depends on [libpcre2-32](https://www.pcre.org/) library. ArchLinux distribution has the **pcre2** binary package.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  11) On RPM based systems you can find somethink like **pcre2-devel** RPM.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  12) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  13) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  14) ## Installation
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  15) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  16) The **cScm** package provides a regular Linux daemon with control scripts.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  17) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  18) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  19) ### Download Sources
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  20) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  21) To obtain sources we have to checkout its from SVN repository:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  22) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  23) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  24) svn checkout svn://radix.pro/cscm/tags/cscm-0.1.4 cscm-0.1.4
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  25) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  26) and run the bootstrap script:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  27) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  28) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  29) cd csvn-0.1.4
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  30) ./bootstrap
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  31) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  32) Also **cScm** source packages are available for download on the
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  33) [Radix.pro FTP-server](https://ftp.radix.pro/pub/cscm/).
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  34) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  35) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  36) #### Bootstrap Script
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  37) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  38) The *bootstrap* script especialy created for *Autotools* install automation. To install
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  39) *Autotools* into sourse directory on build machine (i.e. when **build** == **host**) the *bootstrap*
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  40) script can be run without arguments.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  41) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  42) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  43) ./bootstrap
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  44) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  45) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  46) I this case *Autotools* will be installed from current root file system.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  47) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  48) For the cross environment the `--target-dest-dir` option allows to install some stuff from
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  49) development root file system:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  50) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  51) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  52) TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2 \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  53)        ./bootstrap --target-dest-dir=${TARGET_DEST_DIR}
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  54) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  55) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  56) For example, in this case the *aclocal.m4* script will be collected from the
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  57) `${TARGET_DEST_DIR}/usr/share/aclocal` directory.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  58) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  59) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  60) ### Configuring Sources
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  61) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  62) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  63) ./configure --prefix=/usr \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  64)             --sysconfdir=/etc \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  65)             --with-controldir=/etc/rc.d \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  66)             --with-logrotatedir=/etc/logrotate.d \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  67)             --with-homepath=/var/lib \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  68)             --with-logdir=/var/log \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  69)             --with-piddir=/var/run
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  70) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  71) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  72) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  73) #### Install on the Build Machine
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  74) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  75) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  76) make
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  77) make install
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  78) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  79) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  80) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  81) #### Cross Compilation Example
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  82) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  83) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  84) #!/bin/sh
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  85) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  86) TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  87) TOOLCHAIN_PATH=/opt/toolchains/aarch64-S9XX-linux-glibc/1.1.4/bin
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  88) TARGET=aarch64-s9xx-linux-gnu
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  89) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  90) ./bootstrap --target-dest-dir=${TARGET_DEST_DIR}
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  91) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  92) PKG_CONFIG=/usr/bin/pkg-config \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  93) PKG_CONFIG_PATH=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  94) PKG_CONFIG_LIBDIR=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  95) STRIP="${TOOLCHAIN_PATH}/${TARGET}-strip" \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  96) CC="${TOOLCHAIN_PATH}/${TARGET}-gcc --sysroot=${TARGET_DEST_DIR}" \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  97) ./configure --prefix=/usr
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  98)   --build=x86_64-pc-linux-gnu \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300  99)   --host=${TARGET} \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 100)   --sysconfdir=/etc \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 101)   --with-controldir=/etc/rc.d \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 102)   --with-logrotatedir=/etc/logrotate.d \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 103)   --with-homepath=/var/lib \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 104)   --with-logdir=/var/log \
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 105)   --with-piddir=/var/run
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 106) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 107) make
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 108) make install DESTDIR=${TARGET_DEST_DIR}
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 109) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 110) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 111) Also we can make use of additional variables such as `CFLAGS`, `LDFLAGS`:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 112) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 113) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 114) LDFLAGS="-L${TARGET_DEST_DIR}/lib -L${TARGET_DEST_DIR}/usr/lib"
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 115) TARGET_INCPATH="-L${TARGET_DEST_DIR}/usr/include"
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 116) CFLAGS="${TARGET_INCPATH}"
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 117) CPPFLAGS="${TARGET_INCPATH}"
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 118) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 119) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 120) ### Post Install
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 121) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 122) To run **cScm** daemon for some SCM engine we have to make control scripts executable:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 123) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 124) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 125) chmod a+x /etc/rc.d/rc.csvnd
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 126) chmod a+x /etc/rc.d/rc.cgitd
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 127) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 128) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 129) If you want to run the **cscmd** daemons on boot time then on systems with BSD-like initialization such as **Slackware** we have
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 130) to add following lines to the */etc/rc.d/rc.M* and */etc/rc.d/rc.6* scripts correspondengly:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 131) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 132) **/etc/rc.d/rc.M:**
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 133) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 134) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 135) # Start cSvn SCM daemon:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 136) if [ -x /etc/rc.d/rc.csvnd ]; then
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 137)   /etc/rc.d/rc.csvnd start
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 138) fi
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 139) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 140) # Start cGit SCM daemon:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 141) if [ -x /etc/rc.d/rc.cgitd ]; then
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 142)   /etc/rc.d/rc.cgitd start
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 143) fi
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 144) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 145) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 146) **/etc/rc.d/rc.6:**
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 147) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 148) ```Bash
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 149) # Stop cSvn SCM daemon:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 150) if [ -x /etc/rc.d/rc.csvnd ]; then
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 151)   /etc/rc.d/rc.csvnd stop
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 152) fi
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 153) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 154) # Stop cGit SCM daemon:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 155) if [ -x /etc/rc.d/rc.cgitd ]; then
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 156)   /etc/rc.d/rc.cgitd stop
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 157) fi
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 158) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 159) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 160) For systems which uses systemd initialization you have to setup your own systemd unit like following:
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 161) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 162) **/etc/systemd/system/csvnd.service:**
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 163) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 164) ```ini
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 165) [Unit]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 166) Description=The cSvn daemon
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 167) After=network.target
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 168) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 169) [Service]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 170) PIDFile=/var/run/csvnd.pid
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 171) ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=svn --pid=/var/run/csvnd.pid --log=/var/log/csvnd.log --config=/etc/csvn-ui.rc
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 172) ExecReload=/bin/kill -s HUP $MAINPID
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 173) ExecStop=/bin/kill -s TERM $MAINPID
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 174) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 175) [Install]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 176) WantedBy=multi-user.target
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 177) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 178) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 179) **/etc/systemd/system/cgitd.service:**
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 180) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 181) ```ini
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 182) [Unit]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 183) Description=The cGit daemon
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 184) After=network.target
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 185) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 186) [Service]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 187) PIDFile=/var/run/cgitd.pid
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 188) ExecStart=/usr/sbin/cscmd --daemonize --inotify --scm=git --pid=/var/run/cgitd.pid --log=/var/log/cgitd.log --config=/etc/cgit-ui.rc
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 189) ExecReload=/bin/kill -s HUP $MAINPID
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 190) ExecStop=/bin/kill -s TERM $MAINPID
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 191) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 192) [Install]
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 193) WantedBy=multi-user.target
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 194) ```
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 195) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 196) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 197) ## Binary Packages
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 198) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 199) The instructions to build binary packages for popular Linux distributions are present in the
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 200) [**Documentation**](https://csvn.radix.pro/cscm/trunk/doc/) directory where you can find **RPM** **spec** file and also
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 201) **ArchLinux** Package Build script.
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 202) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 203) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 204) ## See Also
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 205) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 206) > [**cscmd(8)**](https://csvn.radix.pro/cscm/trunk/doc/cscmd.8.md), 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 207) > [**csvn-ui.rc(5)**](https://csvn.radix.pro/csvn-ui/trunk/doc/csvn-ui.rc.5.md), 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 208) > [**cgit-ui.rc(5)**](https://csvn.radix.pro/cgit-ui/trunk/doc/cgit-ui.rc.5.md).
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 209) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 210) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 211) ## Copyright and License
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 212) 
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 213) &#169; Andrey V. Kosteltsev, 2019 &#8211; 2022.<br/>
12c7b1c5 (kx 2023-03-24 02:53:04 +0300 214) Code and documentation released under [the **Radix.pro** License](https://csvn.radix.pro/cscm/trunk/LICENSE).