#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.2.2 # Package: docbook-xml #=========================== # DB commit: 48bb9ee31306c82c48dfaaad707eb4f6a926eb8a # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: docbook-xml" echo "Release: 0.2.2" echo "checking config file" if [ -f $ULFS_CONFIG_FILE ] then echo "loading config file $ULFS_CONFIG_FILE..." . $ULFS_CONFIG_FILE fi #Creating log directory mkdir -p /var/log/ulfs-packages/docbook-xml/ #Saving start timestamp date +%s > /var/log/ulfs-packages/docbook-xml/start.time #Going to source directory... cd /sources #Checking dependances... #Checking libxml2... if [ ! -f /var/cache/ulfs-packages/libxml2 ]; then echo "Dependance \"libxml2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libxml2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libxml2 ]; then echo "Dependance \"libxml2\" is not installed. Exiting..." exit fi fi #Checking sgml-common... if [ ! -f /var/cache/ulfs-packages/sgml-common ]; then echo "Dependance \"sgml-common\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/sgml-common/install -O - | bash if [ ! -f /var/cache/ulfs-packages/sgml-common ]; then echo "Dependance \"sgml-common\" is not installed. Exiting..." exit fi fi #Checking unzip... if [ ! -f /var/cache/ulfs-packages/unzip ]; then echo "Dependance \"unzip\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/unzip/install -O - | bash if [ ! -f /var/cache/ulfs-packages/unzip ]; then echo "Dependance \"unzip\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/docbook-xml/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/d/docbook-xml-4.5.zip.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/d/docbook-xml-4.5.zip #Checking source package file existance if [ ! -f docbook-xml-4.5.zip ]; then echo "Error: Can't find docbook-xml-4.5.zip. Exiting!" exit fi #Checking source package file checksum if [ -f docbook-xml-4.5.zip.md5sum ]; then MD5=`LANG=C md5sum -c docbook-xml-4.5.zip.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of docbook-xml-4.5.zip is wrong. Exiting!" exit fi fi #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/docbook-xml/cleanup.time rm -rfv /sources/docbook-xml-4.5/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/docbook-xml/unpack.time #Extracting source package with previously defined commands... unzip docbook-xml-4.5.zip -d docbook-xml-4.5 #Checking package directory size after unpack... du -s docbook-xml-4.5 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/docbook-xml/unpack.size #Going to source package directory... cd docbook-xml-4.5 #Saving configuration timestamp date +%s > /var/log/ulfs-packages/docbook-xml/configure.time #Sleep 1 second sleep 1 if [[ "$ULFS_PKG_DATERESET" == "YES" ]] then #Changing all files creation time (except build configuration files) in source directory to find them after installation find /sources/docbook-xml-4.5 \! -path "*/configure*" \! -path "*/Makefile*" \! -path "*.make" \! -path "*.m4" \! -path "*.am" \! -path "*.mk" \! -path "*.stamp" \! -path "*gentpl.py" -exec touch -m {} + fi #Running configuration script... echo "checking config file" if [ -f $ULFS_CONFIG_FILE ] then echo "loading config file $ULFS_CONFIG_FILE..." . $ULFS_CONFIG_FILE fi cat > ulfs_configure.sh << EOIS echo "Initializing distributed build environment... " if [[ "\$ULFS_ICECC" == "YES" ]] then export PATH="\$ULFS_ICECC_PATH:\$PATH" echo "ICECC" fi echo "Environment debug..." echo "PATH: \$PATH" echo "MAKEFLAGS: \$MAKEFLAGS" echo "NINJAJOBS: \$NINJAJOBS" env | grep ULFS # EOIS cat ulfs_configure.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-xml/configure.log #Saving build timestamp date +%s > /var/log/ulfs-packages/docbook-xml/build.time #Running build script... echo "checking config file" if [ -f $ULFS_CONFIG_FILE ] then echo "loading config file $ULFS_CONFIG_FILE..." . $ULFS_CONFIG_FILE fi cat > ulfs_build.sh << EOIS echo "Initializing distributed build environment... " if [[ "\$ULFS_ICECC" == "YES" ]] then export PATH="\$ULFS_ICECC_PATH:\$PATH" echo "ICECC" fi echo "Environment debug..." echo "PATH: \$PATH" echo "MAKEFLAGS: \$MAKEFLAGS" echo "NINJAJOBS: \$NINJAJOBS" env | grep ULFS # EOIS cat ulfs_build.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-xml/build.log #Saving install timestamp date +%s > /var/log/ulfs-packages/docbook-xml/install.time #Running install script... cat > ulfs_install.sh << EOIS install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.5 && install -v -d -m755 /etc/xml && cp -v -af --no-preserve=ownership docbook.cat *.dtd ent/ *.mod \ /usr/share/xml/docbook/xml-dtd-4.5 #/etc/xml/docbook if [ ! -e /etc/xml/docbook ]; then xmlcatalog --noout --create /etc/xml/docbook fi && xmlcatalog --noout --add "public" \ "-//OASIS//DTD DocBook XML V4.5//EN" \ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "public" \ "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \ "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \ /etc/xml/docbook && xmlcatalog --noout --add "rewriteSystem" \ "http://www.oasis-open.org/docbook/xml/4.5" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook && xmlcatalog --noout --add "rewriteURI" \ "http://www.oasis-open.org/docbook/xml/4.5" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook #/etc/xml/catalog if [ ! -e /etc/xml/catalog ]; then xmlcatalog --noout --create /etc/xml/catalog fi && xmlcatalog --noout --add "delegatePublic" \ "-//OASIS//ENTITIES DocBook XML" \ "file:///etc/xml/docbook" \ /etc/xml/catalog && xmlcatalog --noout --add "delegatePublic" \ "-//OASIS//DTD DocBook XML" \ "file:///etc/xml/docbook" \ /etc/xml/catalog && xmlcatalog --noout --add "delegateSystem" \ "http://www.oasis-open.org/docbook/" \ "file:///etc/xml/docbook" \ /etc/xml/catalog && xmlcatalog --noout --add "delegateURI" \ "http://www.oasis-open.org/docbook/" \ "file:///etc/xml/docbook" \ /etc/xml/catalog for DTDVERSION in 4.1.2 4.2 4.3 4.4 do xmlcatalog --noout --add "public" \ "-//OASIS//DTD DocBook XML V\$DTDVERSION//EN" \ "http://www.oasis-open.org/docbook/xml/\$DTDVERSION/docbookx.dtd" \ /etc/xml/docbook xmlcatalog --noout --add "rewriteSystem" \ "http://www.oasis-open.org/docbook/xml/\$DTDVERSION" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook xmlcatalog --noout --add "rewriteURI" \ "http://www.oasis-open.org/docbook/xml/\$DTDVERSION" \ "file:///usr/share/xml/docbook/xml-dtd-4.5" \ /etc/xml/docbook xmlcatalog --noout --add "delegateSystem" \ "http://www.oasis-open.org/docbook/xml/\$DTDVERSION/" \ "file:///etc/xml/docbook" \ /etc/xml/catalog xmlcatalog --noout --add "delegateURI" \ "http://www.oasis-open.org/docbook/xml/\$DTDVERSION/" \ "file:///etc/xml/docbook" \ /etc/xml/catalog done EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-xml/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/docbook-xml/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/docbook-xml/finish.time #Checking package directory size after unpack... cd /sources du -s docbook-xml-4.5 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/docbook-xml/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/docbook-xml/files.txt ]; then rm /var/log/ulfs-packages/docbook-xml/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /sbin -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /usr -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /etc -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /opt -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /lib -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt find /var -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time \! -path "/var/log/ulfs-packages/docbook-xml/*" >> /var/log/ulfs-packages/docbook-xml/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time >> /var/log/ulfs-packages/docbook-xml/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/docbook-xml/configure.time \! -newer /var/log/ulfs-packages/docbook-xml/finish.time \! -path "/var/log/ulfs-packages/docbook-xml/*" >> /var/log/ulfs-packages/docbook-xml/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/docbook-xml else sudo touch /var/cache/ulfs-packages/docbook-xml fi #Calculate delta size a=`cat /var/log/ulfs-packages/docbook-xml/unpack.size` b=`cat /var/log/ulfs-packages/docbook-xml/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/docbook-xml/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/docbook-xml/start.time` b=`cat /var/log/ulfs-packages/docbook-xml/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/docbook-xml/download.time` b=`cat /var/log/ulfs-packages/docbook-xml/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/docbook-xml/configure.time` b=`cat /var/log/ulfs-packages/docbook-xml/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/docbook-xml/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: docbook-xml" echo "Release: 0.2.2" echo "Build size: $c" echo "Prepare time: $dp sec." echo "Download time: $dd sec." echo "Build time: $db sec." #End of script