#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.2.2 # Package: qemu #=========================== # DB commit: 48bb9ee31306c82c48dfaaad707eb4f6a926eb8a # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: qemu" 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/qemu/ #Saving start timestamp date +%s > /var/log/ulfs-packages/qemu/start.time #Going to source directory... cd /sources #Checking dependances... #Checking dtc... if [ ! -f /var/cache/ulfs-packages/dtc ]; then echo "Dependance \"dtc\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/dtc/install -O - | bash if [ ! -f /var/cache/ulfs-packages/dtc ]; then echo "Dependance \"dtc\" is not installed. Exiting..." exit fi fi #Checking virglrenderer... if [ ! -f /var/cache/ulfs-packages/virglrenderer ]; then echo "Dependance \"virglrenderer\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/virglrenderer/install -O - | bash if [ ! -f /var/cache/ulfs-packages/virglrenderer ]; then echo "Dependance \"virglrenderer\" 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 libssh2... if [ ! -f /var/cache/ulfs-packages/libssh2 ]; then echo "Dependance \"libssh2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libssh2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libssh2 ]; then echo "Dependance \"libssh2\" is not installed. Exiting..." exit fi fi #Checking curl... if [ ! -f /var/cache/ulfs-packages/curl ]; then echo "Dependance \"curl\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/curl/install -O - | bash if [ ! -f /var/cache/ulfs-packages/curl ]; then echo "Dependance \"curl\" is not installed. Exiting..." exit fi fi #Checking mesa... if [ ! -f /var/cache/ulfs-packages/mesa ]; then echo "Dependance \"mesa\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/mesa/install -O - | bash if [ ! -f /var/cache/ulfs-packages/mesa ]; then echo "Dependance \"mesa\" is not installed. Exiting..." exit fi fi #Checking gtk2... if [ ! -f /var/cache/ulfs-packages/gtk2 ]; then echo "Dependance \"gtk2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/gtk2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/gtk2 ]; then echo "Dependance \"gtk2\" is not installed. Exiting..." exit fi fi #Checking gtk3... if [ ! -f /var/cache/ulfs-packages/gtk3 ]; then echo "Dependance \"gtk3\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/gtk3/install -O - | bash if [ ! -f /var/cache/ulfs-packages/gtk3 ]; then echo "Dependance \"gtk3\" is not installed. Exiting..." exit fi fi #Checking vte... if [ ! -f /var/cache/ulfs-packages/vte ]; then echo "Dependance \"vte\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/vte/install -O - | bash if [ ! -f /var/cache/ulfs-packages/vte ]; then echo "Dependance \"vte\" is not installed. Exiting..." exit fi fi #Checking nettle... if [ ! -f /var/cache/ulfs-packages/nettle ]; then echo "Dependance \"nettle\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/nettle/install -O - | bash if [ ! -f /var/cache/ulfs-packages/nettle ]; then echo "Dependance \"nettle\" 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 vte-gtk2... if [ ! -f /var/cache/ulfs-packages/vte-gtk2 ]; then echo "Dependance \"vte-gtk2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/vte-gtk2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/vte-gtk2 ]; then echo "Dependance \"vte-gtk2\" 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 cyrus-sasl... if [ ! -f /var/cache/ulfs-packages/cyrus-sasl ]; then echo "Dependance \"cyrus-sasl\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/cyrus-sasl/install -O - | bash if [ ! -f /var/cache/ulfs-packages/cyrus-sasl ]; then echo "Dependance \"cyrus-sasl\" is not installed. Exiting..." exit fi fi #Checking alsa-lib... if [ ! -f /var/cache/ulfs-packages/alsa-lib ]; then echo "Dependance \"alsa-lib\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/alsa-lib/install -O - | bash if [ ! -f /var/cache/ulfs-packages/alsa-lib ]; then echo "Dependance \"alsa-lib\" is not installed. Exiting..." exit fi fi #Checking SDL2... if [ ! -f /var/cache/ulfs-packages/SDL2 ]; then echo "Dependance \"SDL2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/SDL2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/SDL2 ]; then echo "Dependance \"SDL2\" is not installed. Exiting..." exit fi fi #Checking pulseaudio... if [ ! -f /var/cache/ulfs-packages/pulseaudio ]; then echo "Dependance \"pulseaudio\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/pulseaudio/install -O - | bash if [ ! -f /var/cache/ulfs-packages/pulseaudio ]; then echo "Dependance \"pulseaudio\" is not installed. Exiting..." exit fi fi #Checking libusb... if [ ! -f /var/cache/ulfs-packages/libusb ]; then echo "Dependance \"libusb\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libusb/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libusb ]; then echo "Dependance \"libusb\" is not installed. Exiting..." exit fi fi #Checking bluez... if [ ! -f /var/cache/ulfs-packages/bluez ]; then echo "Dependance \"bluez\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/bluez/install -O - | bash if [ ! -f /var/cache/ulfs-packages/bluez ]; then echo "Dependance \"bluez\" is not installed. Exiting..." exit fi fi #Checking ALSA... if [ ! -f /var/cache/ulfs-packages/ALSA ]; then echo "Dependance \"ALSA\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/ALSA/install -O - | bash if [ ! -f /var/cache/ulfs-packages/ALSA ]; then echo "Dependance \"ALSA\" is not installed. Exiting..." exit fi fi #Checking lzo... if [ ! -f /var/cache/ulfs-packages/lzo ]; then echo "Dependance \"lzo\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/lzo/install -O - | bash if [ ! -f /var/cache/ulfs-packages/lzo ]; then echo "Dependance \"lzo\" is not installed. Exiting..." exit fi fi #Checking libslirp... if [ ! -f /var/cache/ulfs-packages/libslirp ]; then echo "Dependance \"libslirp\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libslirp/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libslirp ]; then echo "Dependance \"libslirp\" is not installed. Exiting..." exit fi fi #Checking spice-server... if [ ! -f /var/cache/ulfs-packages/spice-server ]; then echo "Dependance \"spice-server\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/spice-server/install -O - | bash if [ ! -f /var/cache/ulfs-packages/spice-server ]; then echo "Dependance \"spice-server\" is not installed. Exiting..." exit fi fi #Checking usbredir... if [ ! -f /var/cache/ulfs-packages/usbredir ]; then echo "Dependance \"usbredir\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/usbredir/install -O - | bash if [ ! -f /var/cache/ulfs-packages/usbredir ]; then echo "Dependance \"usbredir\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/qemu/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/q/qemu-9.0.2.tar.xz.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/q/qemu-9.0.2.tar.xz #Checking source package file existance if [ ! -f qemu-9.0.2.tar.xz ]; then echo "Error: Can't find qemu-9.0.2.tar.xz. Exiting!" exit fi #Checking source package file checksum if [ -f qemu-9.0.2.tar.xz.md5sum ]; then MD5=`LANG=C md5sum -c qemu-9.0.2.tar.xz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of qemu-9.0.2.tar.xz is wrong. Exiting!" exit fi fi #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/qemu/cleanup.time rm -rfv /sources/qemu-9.0.2/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/qemu/unpack.time #Extracting tar source package archive with default parameters... tar -xf qemu-9.0.2.tar.xz #Checking package directory size after unpack... du -s qemu-9.0.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/qemu/unpack.size #Going to source package directory... cd qemu-9.0.2 #Saving configuration timestamp date +%s > /var/log/ulfs-packages/qemu/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/qemu-9.0.2 \! -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 if [ \$(uname -m) = i686 ]; then QEMU_ARCH=i386-softmmu else QEMU_ARCH=x86_64-softmmu fi mkdir -vp build && cd build && ../configure --prefix=/usr \\ --sysconfdir=/etc \\ --localstatedir=/var \\ --target-list=\$QEMU_ARCH \\ --audio-drv-list=alsa,pa,sdl \\ --enable-slirp \\ --enable-spice \\ --enable-virglrenderer \\ --docdir=/usr/share/doc/qemu-9.0.2 unset QEMU_ARCH EOIS cat ulfs_configure.sh | bash 2>&1 | tee /var/log/ulfs-packages/qemu/configure.log #Saving build timestamp date +%s > /var/log/ulfs-packages/qemu/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 && make EOIS cat ulfs_build.sh | bash 2>&1 | tee /var/log/ulfs-packages/qemu/build.log #Saving install timestamp date +%s > /var/log/ulfs-packages/qemu/install.time #Running install script... cat > ulfs_install.sh << EOIS cd build && make install chgrp kvm /usr/libexec/qemu-bridge-helper && chmod 4750 /usr/libexec/qemu-bridge-helper ln -sv qemu-system-`uname -m` /usr/bin/qemu cat >> /etc/sysctl.d/60-net-forward.conf << EOF net.ipv4.ip_forward=1 EOF install -vdm 755 /etc/qemu && echo allow br0 > /etc/qemu/bridge.conf EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/qemu/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/qemu/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/qemu/finish.time #Checking package directory size after unpack... cd /sources du -s qemu-9.0.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/qemu/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/qemu/files.txt ]; then rm /var/log/ulfs-packages/qemu/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /sbin -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /usr -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /etc -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /opt -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /lib -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt find /var -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time \! -path "/var/log/ulfs-packages/qemu/*" >> /var/log/ulfs-packages/qemu/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time >> /var/log/ulfs-packages/qemu/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/qemu/configure.time \! -newer /var/log/ulfs-packages/qemu/finish.time \! -path "/var/log/ulfs-packages/qemu/*" >> /var/log/ulfs-packages/qemu/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/qemu else sudo touch /var/cache/ulfs-packages/qemu fi #Calculate delta size a=`cat /var/log/ulfs-packages/qemu/unpack.size` b=`cat /var/log/ulfs-packages/qemu/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/qemu/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/qemu/start.time` b=`cat /var/log/ulfs-packages/qemu/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/qemu/download.time` b=`cat /var/log/ulfs-packages/qemu/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/qemu/configure.time` b=`cat /var/log/ulfs-packages/qemu/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/qemu/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: qemu" 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