#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.1 # Package: lua #=========================== # DB commit: d35a620850806ab581b32cb34d268a904c9c0a5f # APP commit: f0568a86eced844506f88e1faa2e7a1c73783ddf #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: lua" echo "Release: 0.1" echo "Install with chimp: NO" downloadFile() { local filename=$1 echo "Downloading $filename ..." if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl -k -O $filename else wget --no-check-certificate -nc $filename fi } echo "loading environment settings(profile)" . /etc/profile 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/lua/ #Saving start timestamp date +%s > /var/log/ulfs-packages/lua/start.time #Going to source directory... cd /sources #Saving downloading timestamp date +%s > /var/log/ulfs-packages/lua/download.time #Downloading source package archive... downloadFile https://umvirt.com/linux/downloads/0.1/packages/l/lua-5.3.5.tar.gz.md5sum downloadFile https://umvirt.com/linux/downloads/0.1/packages/l/lua-5.3.5.tar.gz #Checking source package file existance if [ ! -f lua-5.3.5.tar.gz ]; then echo "Error: Can't find lua-5.3.5.tar.gz. Exiting!" exit fi #Checking source package file checksum if [ -f lua-5.3.5.tar.gz.md5sum ]; then MD5=`LANG=C md5sum -c lua-5.3.5.tar.gz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of lua-5.3.5.tar.gz is wrong. Exiting!" exit fi fi #Downloadning patches... downloadFile https://umvirt.com/linux/downloads/0.1/patches/lua-5.3.5-shared_library-1.patch #Checking patch file existance if [ ! -f lua-5.3.5-shared_library-1.patch ]; then echo -e "Error: Can't find patch \"lua-5.3.5-shared_library-1.patch\". Exiting!" exit fi #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/lua/cleanup.time rm -rfv /sources/lua-5.3.5/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/lua/unpack.time #Extracting tar source package archive with default parameters... tar -xf lua-5.3.5.tar.gz #Checking package directory size after unpack... du -s lua-5.3.5 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/lua/unpack.size #Going to source package directory... cd lua-5.3.5 #Applying patches... patch -Np -i ../lua-5.3.5-shared_library-1.patch #Saving configuration timestamp date +%s > /var/log/ulfs-packages/lua/configure.time #Sleep 1 second sleep 1 #Running configuration script... cat > lua.pc << "EOF" V=5.3 R=5.3.5 prefix=/usr INSTALL_BIN=\${prefix}/bin INSTALL_INC=\${prefix}/include INSTALL_LIB=\${prefix}/lib INSTALL_MAN=\${prefix}/share/man/man1 INSTALL_LMOD=\${prefix}/share/lua/\${V} INSTALL_CMOD=\${prefix}/lib/lua/\${V} exec_prefix=\${prefix} libdir=\${exec_prefix}/lib includedir=\${prefix}/include Name: Lua Description: An Extensible Extension Language Version: \${R} Requires: Libs: -L\${libdir} -llua -lm -ldl Cflags: -I\${includedir} EOF sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h && #Saving build timestamp date +%s > /var/log/ulfs-packages/lua/build.time #Running build script... make MYCFLAGS="-DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1" linux #Saving install timestamp date +%s > /var/log/ulfs-packages/lua/install.time #Running install script... cat > ulfs_install.sh << EOIS make INSTALL_TOP=/usr \ INSTALL_DATA="cp -d" \ INSTALL_MAN=/usr/share/man/man1 \ TO_LIB="liblua.so liblua.so.5.3 liblua.so.5.3.4" \ install && mkdir -pv /usr/share/doc/lua-5.3.5 && cp -v doc/*.{html,css,gif,png} /usr/share/doc/lua-5.3.5 && install -v -m644 -D lua.pc /usr/lib/pkgconfig/lua.pc EOIS echo "/sbin/ldconfig" >> ulfs_install.sh USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/lua/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/lua/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/lua/finish.time #Checking package directory size after unpack... cd /sources du -s lua-5.3.5 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/lua/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/lua/files.txt ]; then rm /var/log/ulfs-packages/lua/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /sbin -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /usr -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /etc -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time \! -path /etc/ld.so.cache >> /var/log/ulfs-packages/lua/files.txt find /opt -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /lib -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt find /var -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time \! -path "/var/log/ulfs-packages/lua/*" \! -path /var/cache/ldconfig/aux-cache >> /var/log/ulfs-packages/lua/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time \! -path /etc/ld.so.cache >> /var/log/ulfs-packages/lua/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time >> /var/log/ulfs-packages/lua/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/lua/configure.time \! -newer /var/log/ulfs-packages/lua/finish.time \! -path "/var/log/ulfs-packages/lua/*" \! -path /var/cache/ldconfig/aux-cache >> /var/log/ulfs-packages/lua/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/lua else sudo touch /var/cache/ulfs-packages/lua fi #Calculate delta size a=`cat /var/log/ulfs-packages/lua/unpack.size` b=`cat /var/log/ulfs-packages/lua/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/lua/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/lua/start.time` b=`cat /var/log/ulfs-packages/lua/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/lua/download.time` b=`cat /var/log/ulfs-packages/lua/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/lua/configure.time` b=`cat /var/log/ulfs-packages/lua/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/lua/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: lua" echo "Release: 0.1" echo "Build size: $c" echo "Prepare time: $dp sec." echo "Download time: $dd sec." echo "Build time: $db sec." #End of script