#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.2.2 # Package: ffmpeg #=========================== # DB commit: 48bb9ee31306c82c48dfaaad707eb4f6a926eb8a # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: ffmpeg" 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/ffmpeg/ #Saving start timestamp date +%s > /var/log/ulfs-packages/ffmpeg/start.time #Going to source directory... cd /sources #Checking dependances... #Checking xvidcore... if [ ! -f /var/cache/ulfs-packages/xvidcore ]; then echo "Dependance \"xvidcore\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/xvidcore/install -O - | bash if [ ! -f /var/cache/ulfs-packages/xvidcore ]; then echo "Dependance \"xvidcore\" is not installed. Exiting..." exit fi fi #Checking freetype-stage2... if [ ! -f /var/cache/ulfs-packages/freetype-stage2 ]; then echo "Dependance \"freetype-stage2\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/freetype-stage2/install -O - | bash if [ ! -f /var/cache/ulfs-packages/freetype-stage2 ]; then echo "Dependance \"freetype-stage2\" is not installed. Exiting..." exit fi fi #Checking nasm... if [ ! -f /var/cache/ulfs-packages/nasm ]; then echo "Dependance \"nasm\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/nasm/install -O - | bash if [ ! -f /var/cache/ulfs-packages/nasm ]; then echo "Dependance \"nasm\" is not installed. Exiting..." exit fi fi #Checking yasm... if [ ! -f /var/cache/ulfs-packages/yasm ]; then echo "Dependance \"yasm\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/yasm/install -O - | bash if [ ! -f /var/cache/ulfs-packages/yasm ]; then echo "Dependance \"yasm\" 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 libvorbis... if [ ! -f /var/cache/ulfs-packages/libvorbis ]; then echo "Dependance \"libvorbis\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libvorbis/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libvorbis ]; then echo "Dependance \"libvorbis\" is not installed. Exiting..." exit fi fi #Checking libtheora... if [ ! -f /var/cache/ulfs-packages/libtheora ]; then echo "Dependance \"libtheora\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libtheora/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libtheora ]; then echo "Dependance \"libtheora\" 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 libaom... if [ ! -f /var/cache/ulfs-packages/libaom ]; then echo "Dependance \"libaom\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libaom/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libaom ]; then echo "Dependance \"libaom\" is not installed. Exiting..." exit fi fi #Checking libass... if [ ! -f /var/cache/ulfs-packages/libass ]; then echo "Dependance \"libass\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libass/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libass ]; then echo "Dependance \"libass\" is not installed. Exiting..." exit fi fi #Checking fdk-aac... if [ ! -f /var/cache/ulfs-packages/fdk-aac ]; then echo "Dependance \"fdk-aac\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/fdk-aac/install -O - | bash if [ ! -f /var/cache/ulfs-packages/fdk-aac ]; then echo "Dependance \"fdk-aac\" is not installed. Exiting..." exit fi fi #Checking lame... if [ ! -f /var/cache/ulfs-packages/lame ]; then echo "Dependance \"lame\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/lame/install -O - | bash if [ ! -f /var/cache/ulfs-packages/lame ]; then echo "Dependance \"lame\" is not installed. Exiting..." exit fi fi #Checking opus... if [ ! -f /var/cache/ulfs-packages/opus ]; then echo "Dependance \"opus\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/opus/install -O - | bash if [ ! -f /var/cache/ulfs-packages/opus ]; then echo "Dependance \"opus\" is not installed. Exiting..." exit fi fi #Checking x264... if [ ! -f /var/cache/ulfs-packages/x264 ]; then echo "Dependance \"x264\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/x264/install -O - | bash if [ ! -f /var/cache/ulfs-packages/x264 ]; then echo "Dependance \"x264\" is not installed. Exiting..." exit fi fi #Checking x265... if [ ! -f /var/cache/ulfs-packages/x265 ]; then echo "Dependance \"x265\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/x265/install -O - | bash if [ ! -f /var/cache/ulfs-packages/x265 ]; then echo "Dependance \"x265\" is not installed. Exiting..." exit fi fi #Checking libva... if [ ! -f /var/cache/ulfs-packages/libva ]; then echo "Dependance \"libva\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libva/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libva ]; then echo "Dependance \"libva\" is not installed. Exiting..." exit fi fi #Checking libvdpau... if [ ! -f /var/cache/ulfs-packages/libvdpau ]; then echo "Dependance \"libvdpau\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libvdpau/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libvdpau ]; then echo "Dependance \"libvdpau\" is not installed. Exiting..." exit fi fi #Checking libvpx... if [ ! -f /var/cache/ulfs-packages/libvpx ]; then echo "Dependance \"libvpx\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.2.2/libvpx/install -O - | bash if [ ! -f /var/cache/ulfs-packages/libvpx ]; then echo "Dependance \"libvpx\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/ffmpeg/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/f/ffmpeg-7.0.2.tar.xz.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/packages/f/ffmpeg-7.0.2.tar.xz #Checking source package file existance if [ ! -f ffmpeg-7.0.2.tar.xz ]; then echo "Error: Can't find ffmpeg-7.0.2.tar.xz. Exiting!" exit fi #Checking source package file checksum if [ -f ffmpeg-7.0.2.tar.xz.md5sum ]; then MD5=`LANG=C md5sum -c ffmpeg-7.0.2.tar.xz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of ffmpeg-7.0.2.tar.xz is wrong. Exiting!" exit fi fi #Downloadning patches... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.2.2/patches/ffmpeg-6.1.1-chromium_method-1.patch #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/ffmpeg/cleanup.time rm -rfv /sources/ffmpeg-7.0.2/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/ffmpeg/unpack.time #Extracting tar source package archive with default parameters... tar -xf ffmpeg-7.0.2.tar.xz #Checking package directory size after unpack... du -s ffmpeg-7.0.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/ffmpeg/unpack.size #Going to source package directory... cd ffmpeg-7.0.2 #Applying patches... patch -Np1 -i ../ffmpeg-6.1.1-chromium_method-1.patch #Saving configuration timestamp date +%s > /var/log/ulfs-packages/ffmpeg/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/ffmpeg-7.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 ./configure --prefix=/usr \\ --enable-gpl \\ --enable-version3 \\ --enable-nonfree \\ --disable-static \\ --enable-shared \\ --disable-debug \\ --enable-libaom \\ --enable-libass \\ --enable-libfdk-aac \\ --enable-libfreetype \\ --enable-libmp3lame \\ --enable-libopus \\ --enable-libvorbis \\ --enable-libvpx \\ --enable-libx264 \\ --enable-libx265 \\ --enable-openssl \\ --ignore-tests=enhanced-flv-av1 \\ --docdir=/usr/share/doc/ffmpeg-7.0.2 EOIS cat ulfs_configure.sh | bash 2>&1 | tee /var/log/ulfs-packages/ffmpeg/configure.log #Saving build timestamp date +%s > /var/log/ulfs-packages/ffmpeg/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 && gcc tools/qt-faststart.c -o tools/qt-faststart EOIS cat ulfs_build.sh | bash 2>&1 | tee /var/log/ulfs-packages/ffmpeg/build.log #Saving install timestamp date +%s > /var/log/ulfs-packages/ffmpeg/install.time #Running install script... cat > ulfs_install.sh << EOIS make install && install -v -m755 tools/qt-faststart /usr/bin && install -v -m755 -d /usr/share/doc/ffmpeg-7.0.2 && install -v -m644 doc/*.txt /usr/share/doc/ffmpeg-7.0.2 EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/ffmpeg/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/ffmpeg/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/ffmpeg/finish.time #Checking package directory size after unpack... cd /sources du -s ffmpeg-7.0.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/ffmpeg/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/ffmpeg/files.txt ]; then rm /var/log/ulfs-packages/ffmpeg/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /sbin -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /usr -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /etc -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /opt -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /lib -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt find /var -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time \! -path "/var/log/ulfs-packages/ffmpeg/*" >> /var/log/ulfs-packages/ffmpeg/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time >> /var/log/ulfs-packages/ffmpeg/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/ffmpeg/configure.time \! -newer /var/log/ulfs-packages/ffmpeg/finish.time \! -path "/var/log/ulfs-packages/ffmpeg/*" >> /var/log/ulfs-packages/ffmpeg/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/ffmpeg else sudo touch /var/cache/ulfs-packages/ffmpeg fi #Calculate delta size a=`cat /var/log/ulfs-packages/ffmpeg/unpack.size` b=`cat /var/log/ulfs-packages/ffmpeg/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/ffmpeg/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/ffmpeg/start.time` b=`cat /var/log/ulfs-packages/ffmpeg/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/ffmpeg/download.time` b=`cat /var/log/ulfs-packages/ffmpeg/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/ffmpeg/configure.time` b=`cat /var/log/ulfs-packages/ffmpeg/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/ffmpeg/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: ffmpeg" 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