Home page Ubuntu C++ Hardware HTML i javascript Java Software SQL

Bash – opera, installing browser using the script.

Added: 2012-06-30

Browser Opera gives user many good solutions and this is a stable tool to browse the Internet. You can install it in many ways using Ubuntu Software Center or download package from page Opera.

Sometimes can not use Ubuntu Software Center to install browser or you not want it. Below is the script, which allows you to upgrade Opera to version 12 or download package *.tar.bz2 with another version for installation.

#!/bin/bash

echo "The script upgrade opera browser.";
echo "Opera will be downloaded to file *.tar.bz2 to /tmp/opera_tmp/opera.tar.bz2"
echo "";

if [ ! -d "/tmp/opera_tmp" ]; then
	mkdir /tmp/opera_tmp
fi

if [ -f /tmp/opera_tmp/opera.tar.bz2 ]; then
	echo "Deleting old files..."
	rm /tmp/opera_tmp/opera.tar.bz2
fi

function downloadData(){
	wget -O /tmp/opera_tmp/opera.tar.bz2 $1
	if [ "$?" -eq "0" ]; then
        	echo "Download file is ended.";
	else 
	        echo "Can not download file '"$1"'!!!";
        	exit 44;
	fi
}

function upgradePrompt(){
	read -p "If you want to upgrade browser to version 12.00 [y]:" option

	if [ "$option" = "y" ]; then
		downloadData "http://get.geo.opera.com/pub/opera/linux/1200/opera-12.00-1467.x86_64.linux.tar.bz2"
		return;
	fi


	read -p "Type address in server to browser: " option

	if [ "$option" = "" ]; then
		echo "The link is not specified!!!";
		exit 112;
	else
		downloadData $option;
	fi
}

if [ "$1" = "" ]; then
	upgradePrompt;
else
	downloadData $1;
fi

tar xvjf /tmp/opera_tmp/opera.tar.bz2 -C /tmp/opera_tmp
/tmp/opera_tmp/opera*/install


exit 0;