#!/bin/bash #=========================== # UMVIRT LINUX FROM SCRATCH #=========================== # Compilation script. # Network mode. #=========================== # Release: 0.1 # Package: openttd #=========================== # DB commit: d35a620850806ab581b32cb34d268a904c9c0a5f # APP commit: e905d50832f25d6e1ea1c062c557c2674e1072f0 #=========================== echo "ULFS Package installation start" echo "===============================" echo "Package: openttd" echo "Release: 0.1" 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/openttd/ #Saving start timestamp date +%s > /var/log/ulfs-packages/openttd/start.time #Going to source directory... cd /sources #Checking dependances... #Checking openttd-base... if [ ! -f /var/cache/ulfs-packages/openttd-base ]; then echo "Dependance \"openttd-base\" not found. Trying to install..."; if [[ "$ULFS_DOWNLOAD_APP" == "curl" ]]; then curl https://umvirt.com/linux/packages//0.1/openttd-base/install -k | bash else wget --no-check-certificate https://umvirt.com/linux/packages//0.1/openttd-base/install -O - | bash fi if [ ! -f /var/cache/ulfs-packages/openttd-base ]; then echo "Dependance \"openttd-base\" is not installed. Exiting..." exit fi fi #Downloadning add-ons... #Downloadning add-on "opengfx-0.6.0-all.zip"... downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/opengfx-0.6.0-all.zip.md5sum downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/opengfx-0.6.0-all.zip #Checking addon file existance if [ ! -f opengfx-0.6.0-all.zip ]; then echo "Error: Can't find opengfx-0.6.0-all.zip. Exiting!" exit fi #Checking add-on file checksum if [ -f opengfx-0.6.0-all.zip.md5sum ]; then MD5=`LANG=C md5sum -c opengfx-0.6.0-all.zip.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of opengfx-0.6.0-all.zip is wrong. Exiting!" exit fi fi #Downloadning add-on "opensfx-0.2.3-all.zip"... downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/opensfx-0.2.3-all.zip.md5sum downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/opensfx-0.2.3-all.zip #Checking addon file existance if [ ! -f opensfx-0.2.3-all.zip ]; then echo "Error: Can't find opensfx-0.2.3-all.zip. Exiting!" exit fi #Checking add-on file checksum if [ -f opensfx-0.2.3-all.zip.md5sum ]; then MD5=`LANG=C md5sum -c opensfx-0.2.3-all.zip.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of opensfx-0.2.3-all.zip is wrong. Exiting!" exit fi fi #Downloadning add-on "openmsx-0.3.1-all.zip"... downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/openmsx-0.3.1-all.zip.md5sum downloadFile https://umvirt.com/linux/downloads/0.1/packages/games/openmsx-0.3.1-all.zip #Checking addon file existance if [ ! -f openmsx-0.3.1-all.zip ]; then echo "Error: Can't find openmsx-0.3.1-all.zip. Exiting!" exit fi #Checking add-on file checksum if [ -f openmsx-0.3.1-all.zip.md5sum ]; then MD5=`LANG=C md5sum -c openmsx-0.3.1-all.zip.md5sum | grep OK` if [ "$MD5" == "" ] ; then echo "Error: Checksum of openmsx-0.3.1-all.zip is wrong. Exiting!" exit fi fi #Saving configuration timestamp date +%s > /var/log/ulfs-packages/openttd/configure.time #Saving build timestamp date +%s > /var/log/ulfs-packages/openttd/build.time #Saving install timestamp date +%s > /var/log/ulfs-packages/openttd/install.time #Running install script... cp -fv opengfx-0.6.0/* /usr/share/games/openttd/baseset/ cp -fv openmsx-0.3.1/* /usr/share/games/openttd/baseset/ cp -fv opensfx-0.2.3/* /usr/share/games/openttd/baseset/ #Saving finish timestamp date +%s > /var/log/ulfs-packages/openttd/finish.time #Marking package as installed... mkdir -p /var/cache/ulfs-packages USER=`whoami` if [ "$USER" == "root" ] ; then touch /var/cache/ulfs-packages/openttd else sudo touch /var/cache/ulfs-packages/openttd fi #Calculate prepare time a=`cat /var/log/ulfs-packages/openttd/start.time` b=`cat /var/log/ulfs-packages/openttd/configure.time` dp=$(($b-$a)) #Calculate delta time a=`cat /var/log/ulfs-packages/openttd/configure.time` b=`cat /var/log/ulfs-packages/openttd/finish.time` db=$(($b-$a)) echo $db > /var/log/ulfs-packages/openttd/delta.time #Report echo "" echo "ULFS Package installation report" echo "================================" echo "Package: openttd" echo "Release: 0.1" echo "Prepare time: $dp sec." echo "Build time: $db sec." #End of script