#! /bin/sh echo Starting SVivaldi initscript ##to be done, i must integrate some security checks before ##installing the rpm(checking the link(url) with .signature) # logging: mark when the initscript started running date > /tmp/svivaldi_initscript_stage1.log # URL for Sviavldi rpm initscript PACKAGE_URL="http://build.one-lab.org/Svivaldi/Viv-0.1-1.i386.rpm" DELAY=1 RETRY=1 while [ $RETRY -eq 1 ]; do # break out of loop by default RETRY=0 # install the Svivaldi rpm sudo rpm -Uvh $PACKAGE_URL if [ $? -ne 0 ] then rpm -qa Viv* if [ $? -eq 0 ] then RETRY=0 else echo "Failed to download $PACKAGE_URL" RETRY=1 fi fi # if something went wrong, then retry. This covers connection errors as # well as problems with the Svivaldi repository itself. If the repository is # offline, then the script will keep retrying until it comes online. if [ $RETRY -eq 1 ]; then echo "Delaying $DELAY seconds" sleep $DELAY # exponential backoff, up to 1 hour between retrievals DELAY=`expr $DELAY \* 2` if [ $DELAY -gt 3600 ]; then DELAY=3600 fi fi done