#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.1 # Package: systemd #=========================== # DB commit: d35a620850806ab581b32cb34d268a904c9c0a5f # APP commit: 1ca4178aea919e4c9e869e3d650ff8af9678bd6f #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: systemd" echo "Release: 0.1" 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/systemd/ #Saving start timestamp date +%s > /var/log/ulfs-packages/systemd/start.time #Going to source directory... cd /sources #Checking dependances... #Checking polkit... if [ ! -f /var/cache/ulfs-packages/polkit ]; then echo "Dependance \"polkit\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.1/polkit/install -O - | bash if [ ! -f /var/cache/ulfs-packages/polkit ]; then echo "Dependance \"polkit\" is not installed. Exiting..." exit fi fi #Checking Linux-PAM... if [ ! -f /var/cache/ulfs-packages/Linux-PAM ]; then echo "Dependance \"Linux-PAM\" not found. Trying to install..."; wget --no-check-certificate https://umvirt.com/linux/packages//0.1/Linux-PAM/install -O - | bash if [ ! -f /var/cache/ulfs-packages/Linux-PAM ]; then echo "Dependance \"Linux-PAM\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/systemd/download.time #Downloading source package archive... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.1/packages/s/systemd-239.tar.gz.md5sum wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.1/packages/s/systemd-239.tar.gz #Checking source package file existance if [ ! -f systemd-239.tar.gz ]; then echo "Error: Can't find systemd-239.tar.gz. Exiting!" exit fi #Checking source package file checksum if [ -f systemd-239.tar.gz.md5sum ]; then MD5=`LANG=C md5sum -c systemd-239.tar.gz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of systemd-239.tar.gz is wrong. Exiting!" exit fi fi #Downloadning patches... wget --no-check-certificate -nc https://umvirt.com/linux/downloads/0.1/patches/systemd-239-glibc_statx_fix-1.patch #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/systemd/cleanup.time rm -rfv /sources/systemd-239/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/systemd/unpack.time #Extracting tar source package archive with default parameters... tar -xf systemd-239.tar.gz #Checking package directory size after unpack... du -s systemd-239 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/systemd/unpack.size #Going to source package directory... cd systemd-239 #Applying patches... patch -Np -i ../systemd-239-glibc_statx_fix-1.patch #Saving configuration timestamp date +%s > /var/log/ulfs-packages/systemd/configure.time #Sleep 1 second sleep 1 #Running configuration script... sed -i 's/GROUP="render", //' rules/50-udev-default.rules.in mkdir build && cd build && meson --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ -Dblkid=true \ -Dbuildtype=release \ -Ddefault-dnssec=no \ -Dfirstboot=false \ -Dinstall-tests=false \ -Dldconfig=false \ -Drootprefix= \ -Drootlibdir=/lib \ -Dsplit-usr=true \ -Dsysusers=false \ -Db_lto=false \ .. #Saving build timestamp date +%s > /var/log/ulfs-packages/systemd/build.time #Running build script... ninja #Saving install timestamp date +%s > /var/log/ulfs-packages/systemd/install.time #Running install script... cat > ulfs_install.sh << EOIS ninja install rm -rfv /usr/lib/rpm cat >> /etc/pam.d/system-session << "EOF" # Begin Systemd addition session required pam_loginuid.so session optional pam_systemd.so # End Systemd addition EOF cat > /etc/pam.d/systemd-user << "EOF" # Begin /etc/pam.d/systemd-user account required pam_access.so account include system-account session required pam_env.so session required pam_limits.so session include system-session auth required pam_deny.so password required pam_deny.so # End /etc/pam.d/systemd-user EOF systemctl daemon-reload systemctl start multi-user.target EOIS USER=`whoami` if [ "$USER" == "root" ] ; then cat ulfs_install.sh | bash 2>&1 | tee /var/log/ulfs-packages/systemd/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/systemd/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/systemd/finish.time #Checking package directory size after unpack... cd /sources du -s systemd-239 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/systemd/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/systemd/files.txt ]; then rm /var/log/ulfs-packages/systemd/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /sbin -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /usr -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /etc -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /opt -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /lib -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt find /var -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time \! -path "/var/log/ulfs-packages/systemd/*" >> /var/log/ulfs-packages/systemd/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time >> /var/log/ulfs-packages/systemd/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/systemd/configure.time \! -newer /var/log/ulfs-packages/systemd/finish.time \! -path "/var/log/ulfs-packages/systemd/*" >> /var/log/ulfs-packages/systemd/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/systemd else sudo touch /var/cache/ulfs-packages/systemd fi #Calculate delta size a=`cat /var/log/ulfs-packages/systemd/unpack.size` b=`cat /var/log/ulfs-packages/systemd/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/systemd/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/systemd/start.time` b=`cat /var/log/ulfs-packages/systemd/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/systemd/download.time` b=`cat /var/log/ulfs-packages/systemd/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/systemd/configure.time` b=`cat /var/log/ulfs-packages/systemd/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/systemd/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: systemd" 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