#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.2.2 # Package: wireshark #=========================== # DB commit: 48bb9ee31306c82c48dfaaad707eb4f6a926eb8a # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: wireshark" 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/wireshark/ #Saving start timestamp date +%s > /var/log/ulfs-packages/wireshark/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 libxslt... if [ ! -f /var/cache/ulfs-packages/libxslt ]; then echo "Dependance \"libxslt\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libxslt/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libxslt ]; then echo "Dependance \"libxslt\" is not installed. Exiting..." exit fi fi #Checking glib... if [ ! -f /var/cache/ulfs-packages/glib ]; then echo "Dependance \"glib\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/glib/install -O - | bash if [ ! -f /var/cache/ulfs-packages/glib ]; then echo "Dependance \"glib\" is not installed. Exiting..." exit fi fi #Checking git... if [ ! -f /var/cache/ulfs-packages/git ]; then echo "Dependance \"git\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/git/install -O - | bash if [ ! -f /var/cache/ulfs-packages/git ]; then echo "Dependance \"git\" is not installed. Exiting..." exit fi fi #Checking cmake... if [ ! -f /var/cache/ulfs-packages/cmake ]; then echo "Dependance \"cmake\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/cmake/install -O - | bash if [ ! -f /var/cache/ulfs-packages/cmake ]; then echo "Dependance \"cmake\" is not installed. Exiting..." exit fi fi #Checking krb5... if [ ! -f /var/cache/ulfs-packages/krb5 ]; then echo "Dependance \"krb5\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/krb5/install -O - | bash if [ ! -f /var/cache/ulfs-packages/krb5 ]; then echo "Dependance \"krb5\" is not installed. Exiting..." exit fi fi #Checking gnutls... if [ ! -f /var/cache/ulfs-packages/gnutls ]; then echo "Dependance \"gnutls\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/gnutls/install -O - | bash if [ ! -f /var/cache/ulfs-packages/gnutls ]; then echo "Dependance \"gnutls\" is not installed. Exiting..." exit fi fi #Checking libgcrypt... if [ ! -f /var/cache/ulfs-packages/libgcrypt ]; then echo "Dependance \"libgcrypt\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libgcrypt/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libgcrypt ]; then echo "Dependance \"libgcrypt\" is not installed. Exiting..." exit fi fi #Checking nghttp2... if [ ! -f /var/cache/ulfs-packages/nghttp2 ]; then echo "Dependance \"nghttp2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/nghttp2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/nghttp2 ]; then echo "Dependance \"nghttp2\" is not installed. Exiting..." exit fi fi #Checking brotli... if [ ! -f /var/cache/ulfs-packages/brotli ]; then echo "Dependance \"brotli\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/brotli/install -O - | bash if [ ! -f /var/cache/ulfs-packages/brotli ]; then echo "Dependance \"brotli\" is not installed. Exiting..." exit fi fi #Checking speex... if [ ! -f /var/cache/ulfs-packages/speex ]; then echo "Dependance \"speex\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/speex/install -O - | bash if [ ! -f /var/cache/ulfs-packages/speex ]; then echo "Dependance \"speex\" is not installed. Exiting..." exit fi fi #Checking libnl... if [ ! -f /var/cache/ulfs-packages/libnl ]; then echo "Dependance \"libnl\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libnl/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libnl ]; then echo "Dependance \"libnl\" is not installed. Exiting..." exit fi fi #Checking libpcap... if [ ! -f /var/cache/ulfs-packages/libpcap ]; then echo "Dependance \"libpcap\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libpcap/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libpcap ]; then echo "Dependance \"libpcap\" is not installed. Exiting..." exit fi fi #Checking sbc... if [ ! -f /var/cache/ulfs-packages/sbc ]; then echo "Dependance \"sbc\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/sbc/install -O - | bash if [ ! -f /var/cache/ulfs-packages/sbc ]; then echo "Dependance \"sbc\" is not installed. Exiting..." exit fi fi #Checking qt5... if [ ! -f /var/cache/ulfs-packages/qt5 ]; then echo "Dependance \"qt5\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/qt5/install -O - | bash if [ ! -f /var/cache/ulfs-packages/qt5 ]; then echo "Dependance \"qt5\" is not installed. Exiting..." exit fi fi #Checking lua-5.2... if [ ! -f /var/cache/ulfs-packages/lua-5.2 ]; then echo "Dependance \"lua-5.2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/lua-5.2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/lua-5.2 ]; then echo "Dependance \"lua-5.2\" is not installed. Exiting..." exit fi fi #Checking c-ares... if [ ! -f /var/cache/ulfs-packages/c-ares ]; then echo "Dependance \"c-ares\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/c-ares/install -O - | bash if [ ! -f /var/cache/ulfs-packages/c-ares ]; then echo "Dependance \"c-ares\" is not installed. Exiting..." exit fi fi #Checking asciidoctor... if [ ! -f /var/cache/ulfs-packages/asciidoctor ]; then echo "Dependance \"asciidoctor\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/asciidoctor/install -O - | bash if [ ! -f /var/cache/ulfs-packages/asciidoctor ]; then echo "Dependance \"asciidoctor\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/wireshark/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/w/wireshark-4.2.6.tar.xz.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/w/wireshark-4.2.6.tar.xz #Checking source package file existance if [ ! -f wireshark-4.2.6.tar.xz ]; then echo "Error: Can't find wireshark-4.2.6.tar.xz. Exiting!" exit fi #Checking source package file checksum if [ -f wireshark-4.2.6.tar.xz.md5sum ]; then MD5=`LANG=C md5sum -c wireshark-4.2.6.tar.xz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of wireshark-4.2.6.tar.xz is wrong. Exiting!" exit fi fi #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/wireshark/cleanup.time rm -rfv /sources/wireshark-4.2.6/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/wireshark/unpack.time #Extracting tar source package archive with default parameters... tar -xf wireshark-4.2.6.tar.xz #Checking package directory size after unpack... du -s wireshark-4.2.6 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/wireshark/unpack.size #Going to source package directory... cd wireshark-4.2.6 #Saving configuration timestamp date +%s > /var/log/ulfs-packages/wireshark/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/wireshark-4.2.6 \! -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 groupadd -g 62 wireshark mkdir build && cd build && cmake -D CMAKE_INSTALL_PREFIX=/usr \\ -D CMAKE_BUILD_TYPE=Release \\ -D CMAKE_INSTALL_DOCDIR=/usr/share/doc/wireshark-4.2.6 \\ -G Ninja \\ .. EOIS cat ulfs_configure.sh | bash 2>&1 | tee /var/log/ulfs-packages/wireshark/configure.log #Saving build timestamp date +%s > /var/log/ulfs-packages/wireshark/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 cd build && ninja EOIS cat ulfs_build.sh | bash 2>&1 | tee /var/log/ulfs-packages/wireshark/build.log #Saving install timestamp date +%s > /var/log/ulfs-packages/wireshark/install.time #Running install script... cat > ulfs_install.sh << EOIS cd build && ninja install install -v -m755 -d /usr/share/doc/wireshark-4.2.6 && install -v -m644 ../README.linux ../doc/README.* ../doc/randpkt.txt \ /usr/share/doc/wireshark-4.2.6 && pushd /usr/share/doc/wireshark-4.2.6 && for FILENAME in ../../wireshark/*.html; do ln -s -v -f \$FILENAME . done && popd unset FILENAME chown -v root:wireshark /usr/bin/{tshark,dumpcap} && chmod -v 6550 /usr/bin/{tshark,dumpcap} EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/wireshark/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/wireshark/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/wireshark/finish.time #Checking package directory size after unpack... cd /sources du -s wireshark-4.2.6 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/wireshark/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/wireshark/files.txt ]; then rm /var/log/ulfs-packages/wireshark/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /sbin -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /usr -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /etc -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /opt -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /lib -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt find /var -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time \! -path "/var/log/ulfs-packages/wireshark/*" >> /var/log/ulfs-packages/wireshark/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time >> /var/log/ulfs-packages/wireshark/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/wireshark/configure.time \! -newer /var/log/ulfs-packages/wireshark/finish.time \! -path "/var/log/ulfs-packages/wireshark/*" >> /var/log/ulfs-packages/wireshark/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/wireshark else sudo touch /var/cache/ulfs-packages/wireshark fi #Calculate delta size a=`cat /var/log/ulfs-packages/wireshark/unpack.size` b=`cat /var/log/ulfs-packages/wireshark/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/wireshark/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/wireshark/start.time` b=`cat /var/log/ulfs-packages/wireshark/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/wireshark/download.time` b=`cat /var/log/ulfs-packages/wireshark/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/wireshark/configure.time` b=`cat /var/log/ulfs-packages/wireshark/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/wireshark/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: wireshark" 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