#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.1 # Package: exim #=========================== # DB commit: d35a620850806ab581b32cb34d268a904c9c0a5f # APP commit: f0568a86eced844506f88e1faa2e7a1c73783ddf #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: exim" 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/exim/ #Saving start timestamp date +%s > /var/log/ulfs-packages/exim/start.time #Going to source directory... cd /sources #Checking dependances... #Checking gnutls... if [ ! -f /var/cache/ulfs-packages/gnutls ]; then echo "Dependance \"gnutls\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/gnutls/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/gnutls/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/gnutls ]; then echo "Dependance \"gnutls\" is not installed. Exiting..." exit fi fi #Checking sqlite... if [ ! -f /var/cache/ulfs-packages/sqlite ]; then echo "Dependance \"sqlite\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/sqlite/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/sqlite/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/sqlite ]; then echo "Dependance \"sqlite\" 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..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/Linux-PAM/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/Linux-PAM/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/Linux-PAM ]; then echo "Dependance \"Linux-PAM\" is not installed. Exiting..." exit fi fi #Checking X... if [ ! -f /var/cache/ulfs-packages/X ]; then echo "Dependance \"X\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/X/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/X/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/X ]; then echo "Dependance \"X\" 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..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/cyrus-sasl/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/cyrus-sasl/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/cyrus-sasl ]; then echo "Dependance \"cyrus-sasl\" is not installed. Exiting..." exit fi fi #Checking openldap-client... if [ ! -f /var/cache/ulfs-packages/openldap-client ]; then echo "Dependance \"openldap-client\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/openldap-client/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/openldap-client/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/openldap-client ]; then echo "Dependance \"openldap-client\" is not installed. Exiting..." exit fi fi #Checking postgresql-client... if [ ! -f /var/cache/ulfs-packages/postgresql-client ]; then echo "Dependance \"postgresql-client\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/postgresql-client/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/postgresql-client/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/postgresql-client ]; then echo "Dependance \"postgresql-client\" is not installed. Exiting..." exit fi fi #Checking postgresql-server... if [ ! -f /var/cache/ulfs-packages/postgresql-server ]; then echo "Dependance \"postgresql-server\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/postgresql-server/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/postgresql-server/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/postgresql-server ]; then echo "Dependance \"postgresql-server\" is not installed. Exiting..." exit fi fi #Checking mariadb-client... if [ ! -f /var/cache/ulfs-packages/mariadb-client ]; then echo "Dependance \"mariadb-client\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/mariadb-client/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/mariadb-client/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/mariadb-client ]; then echo "Dependance \"mariadb-client\" is not installed. Exiting..." exit fi fi #Checking dovecot... if [ ! -f /var/cache/ulfs-packages/dovecot ]; then echo "Dependance \"dovecot\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/dovecot/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/dovecot/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/dovecot ]; then echo "Dependance \"dovecot\" is not installed. Exiting..." exit fi fi #Checking libnsl... if [ ! -f /var/cache/ulfs-packages/libnsl ]; then echo "Dependance \"libnsl\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/libnsl/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/libnsl/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/libnsl ]; then echo "Dependance \"libnsl\" is not installed. Exiting..." exit fi fi #Saving downloading timestamp date +%s > /var/log/ulfs-packages/exim/download.time #Downloading source package archive... downloadFile https://umvirt.com/linux/downloads/0.1/packages/e/exim-4.92.2.tar.xz.md5sum downloadFile https://umvirt.com/linux/downloads/0.1/packages/e/exim-4.92.2.tar.xz #Checking source package file existance if [ ! -f exim-4.92.2.tar.xz ]; then echo "Error: Can't find exim-4.92.2.tar.xz. Exiting!" exit fi #Checking source package file checksum if [ -f exim-4.92.2.tar.xz.md5sum ]; then MD5=`LANG=C md5sum -c exim-4.92.2.tar.xz.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of exim-4.92.2.tar.xz is wrong. Exiting!" exit fi fi #Saving cleanup timestamp date +%s > /var/log/ulfs-packages/exim/cleanup.time rm -rfv /sources/exim-4.92.2/ #Saving extracting timestamp date +%s > /var/log/ulfs-packages/exim/unpack.time #Extracting tar source package archive with default parameters... tar -xf exim-4.92.2.tar.xz #Checking package directory size after unpack... du -s exim-4.92.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/exim/unpack.size #Going to source package directory... cd exim-4.92.2 #Saving configuration timestamp date +%s > /var/log/ulfs-packages/exim/configure.time #Sleep 1 second sleep 1 #Running configuration script... sed -e 's,^BIN_DIR.*\$,BIN_DIRECTORY=/usr/sbin,' \ -e 's,^CONF.*\$,CONFIGURE_FILE=/etc/exim.conf,' \ -e 's,^EXIM_USER.*\$,EXIM_USER=exim,' \ -e '/SUPPORT_TLS=/s,^#,,' \ -e '/USE_OPENSSL/s,^#,,' \ -e '/AUTH_DOVECOT=/s,^#,,' \ -e '/AUTH_PLAINTEXT=/s,^#,,' \ -e '/LOOKUP_MYSQL/s,^#,,' \ -e '/LOOKUP_PGSQL/s,^#,,' \ -e 's,^EXIM_MONITOR,#EXIM_MONITOR,' src/EDITME > Local/Makefile && printf "USE_GDBM = yes\nDBMLIB = -lgdbm\n" >> Local/Makefile #Saving build timestamp date +%s > /var/log/ulfs-packages/exim/build.time #Running build script... make #Saving install timestamp date +%s > /var/log/ulfs-packages/exim/install.time #Running install script... cat > ulfs_install.sh << EOIS groupadd -g 31 exim && useradd -d /dev/null -c "Exim Daemon" -g exim -s /bin/false -u 31 exim make install && install -v -m644 doc/exim.8 /usr/share/man/man8 ln -sfv exim /usr/sbin/sendmail && install -v -d -m750 -o exim -g exim /var/spool/exim 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/exim/install.log else cat ulfs_install.sh | sudo bash 2>&1 | tee /var/log/ulfs-packages/exim/install.log fi #Saving finish timestamp date +%s > /var/log/ulfs-packages/exim/finish.time #Checking package directory size after unpack... cd /sources du -s exim-4.92.2 | awk 'NR==1 {print $1}' > /var/log/ulfs-packages/exim/install.size echo "ULFS package installation completed." #Producing files list echo "Looking for installed files..." if [ -f /var/log/ulfs-packages/exim/files.txt ]; then rm /var/log/ulfs-packages/exim/files.txt fi USER=`whoami` if [ "$USER" == "root" ] ; then find /bin -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /sbin -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /usr -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /etc -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time \! -path /etc/ld.so.cache >> /var/log/ulfs-packages/exim/files.txt find /opt -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /lib -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /lib64 -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt find /var -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time \! -path "/var/log/ulfs-packages/exim/*" \! -path /var/cache/ldconfig/aux-cache >> /var/log/ulfs-packages/exim/files.txt else sudo find /bin -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /sbin -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /usr -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /etc -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time \! -path /etc/ld.so.cache >> /var/log/ulfs-packages/exim/files.txt sudo find /opt -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /lib -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /lib64 -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time >> /var/log/ulfs-packages/exim/files.txt sudo find /var -type f -newer /var/log/ulfs-packages/exim/configure.time \! -newer /var/log/ulfs-packages/exim/finish.time \! -path "/var/log/ulfs-packages/exim/*" \! -path /var/cache/ldconfig/aux-cache >> /var/log/ulfs-packages/exim/files.txt fi #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/exim else sudo touch /var/cache/ulfs-packages/exim fi #Calculate delta size a=`cat /var/log/ulfs-packages/exim/unpack.size` b=`cat /var/log/ulfs-packages/exim/install.size` c=$(($b-$a)) echo $c > /var/log/ulfs-packages/exim/delta.size #Calculate prepare time a=`cat /var/log/ulfs-packages/exim/start.time` b=`cat /var/log/ulfs-packages/exim/configure.time` dp=$(($b-$a)) #Calculate download time a=`cat /var/log/ulfs-packages/exim/download.time` b=`cat /var/log/ulfs-packages/exim/unpack.time` dd=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/exim/configure.time` b=`cat /var/log/ulfs-packages/exim/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/exim/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: exim" 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