#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.2.2 # Package: docbook-utils #=========================== # DB commit: 48bb9ee31306c82c48dfaaad707eb4f6a926eb8a # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: docbook-utils" 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-utils/ #Saving start timestamp date +%s > /var/log/ulfs-packages/docbook-utils/start.time #Going to source directory... cd /sources #Checking dependances... #Checking openjade... if [ ! -f /var/cache/ulfs-packages/openjade ]; then echo "Dependance \"openjade\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/openjade/install -O - | bash if [ ! -f /var/cache/ulfs-packages/openjade ]; then echo "Dependance \"openjade\" is not installed. Exiting..." exit fi fi #Checking docbook-dsssl... if [ ! -f /var/cache/ulfs-packages/docbook-dsssl ]; then echo "Dependance \"docbook-dsssl\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/docbook-dsssl/install -O - | bash if [ ! -f /var/cache/ulfs-packages/docbook-dsssl ]; then echo "Dependance \"docbook-dsssl\" is not installed. Exiting..." exit fi fi #Checking docbook-3.1-dtd... if [ ! -f /var/cache/ulfs-packages/docbook-3.1-dtd ]; then echo "Dependance \"docbook-3.1-dtd\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/docbook-3.1-dtd/install -O - | bash if [ ! -f /var/cache/ulfs-packages/docbook-3.1-dtd ]; then echo "Dependance \"docbook-3.1-dtd\" is not installed. Exiting..." exit fi fi #Checking perl-SGMLSpm... if [ ! -f /var/cache/ulfs-packages/perl-SGMLSpm ]; then echo "Dependance \"perl-SGMLSpm\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/perl-SGMLSpm/install -O - | bash if [ ! -f /var/cache/ulfs-packages/perl-SGMLSpm ]; then echo "Dependance \"perl-SGMLSpm\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/docbook-utils/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/d/docbook-utils-0.6.14.tar.gz.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/d/docbook-utils-0.6.14.tar.gz #Checking source package file existance if [ ! -f docbook-utils-0.6.14.tar.gz ]; then echo "Error: Can't find docbook-utils-0.6.14.tar.gz. Exiting!" exit fi #Checking source package file checksum if [ -f docbook-utils-0.6.14.tar.gz.md5sum ]; then MD5=`LANG=C md5sum -c docbook-utils-0.6.14.tar.gz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of docbook-utils-0.6.14.tar.gz is wrong. Exiting!" exit fi fi #Downloadning patches... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/patches/docbook-utils-0.6.14-grep_fix-1.patch #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/docbook-utils/cleanup.time rm -rfv /sources/docbook-utils-0.6.14/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/docbook-utils/unpack.time #Extracting tar source package archive with default parameters... tar -xf docbook-utils-0.6.14.tar.gz #Checking package directory size after unpack... du -s docbook-utils-0.6.14 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/docbook-utils/unpack.size #Going to source package directory... cd docbook-utils-0.6.14 #Applying patches... patch -Np1 -i ../docbook-utils-0.6.14-grep_fix-1.patch #Saving configuration timestamp date +%s > /var/log/ulfs-packages/docbook-utils/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-utils-0.6.14 \! -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 sed -i 's:/html::' doc/HTML/Makefile.in && ./configure --prefix=/usr --mandir=/usr/share/man EOIS cat ulfs_configure.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-utils/configure.log #Saving build timestamp date +%s > /var/log/ulfs-packages/docbook-utils/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 make EOIS cat ulfs_build.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-utils/build.log #Saving install timestamp date +%s > /var/log/ulfs-packages/docbook-utils/install.time #Running install script... cat > ulfs_install.sh << EOIS make docdir=/usr/share/doc install for doctype in html ps dvi man pdf rtf tex texi txt do ln -svf docbook2\$doctype /usr/bin/db2\$doctype done EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/docbook-utils/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/docbook-utils/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/docbook-utils/finish.time #Checking package directory size after unpack... cd /sources du -s docbook-utils-0.6.14 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/docbook-utils/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/docbook-utils/files.txt ]; then rm /var/log/ulfs-packages/docbook-utils/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /sbin -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /usr -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /etc -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /opt -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /lib -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt find /var -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time \! -path "/var/log/ulfs-packages/docbook-utils/*" >> /var/log/ulfs-packages/docbook-utils/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time >> /var/log/ulfs-packages/docbook-utils/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/docbook-utils/configure.time \! -newer /var/log/ulfs-packages/docbook-utils/finish.time \! -path "/var/log/ulfs-packages/docbook-utils/*" >> /var/log/ulfs-packages/docbook-utils/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-utils else sudo touch /var/cache/ulfs-packages/docbook-utils fi #Calculate delta size a=`cat /var/log/ulfs-packages/docbook-utils/unpack.size` b=`cat /var/log/ulfs-packages/docbook-utils/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/docbook-utils/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/docbook-utils/start.time` b=`cat /var/log/ulfs-packages/docbook-utils/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/docbook-utils/download.time` b=`cat /var/log/ulfs-packages/docbook-utils/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/docbook-utils/configure.time` b=`cat /var/log/ulfs-packages/docbook-utils/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/docbook-utils/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: docbook-utils" 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