Skip navigation.

Ruari's thoughts

Testing Opera under UNIX/Linux, without changing your main profile settings

, , , , ,

People often like to try new snapshot or beta builds of Opera but are cautious about messing up their main profile with a build that could be unstable. They need a way to get back to their previous state. I'll outline a few of ways this can be done. I won't list all possible ways, just three simple ones that I hope that most UNIX/Linux users could use without too much fuss. I should also mention that all of these methods have been outlined elsewhere both officially and unofficially, so I am not saying anything new here. If you are an advanced user don't be shocked if I teach you nothing new. However not everyone knows these methods and sometimes it helps to rewrite these things so that people get a more rounded idea of how it all works. Also by placing it on my own blog post, people can ask me directly about any part they are unsure of.

Method 1

The first method is as simple as they come (and should be done anyway, even when trying the other methods). The short version is: Backup your profile settings directory before you start testing! :wink:

If you are unsure about how to do this I'll explain (if you know how it is done skip to Method 2). By default the UNIX/Linux version of Opera stores its profile settings in the directory ~/.opera (where '~' refers to your home directory). To backup you simply make a copy of this hidden directory. This can be done via the GUI (graphical user interface) using a file manager such as Gnome's Nautilus. You just have to display hidden files first. In Nautilus this is done via 'View > Show Hidden Files' (or the keyboard shortcut ctrl+h). Similar options are also available under other file managers such as Konqueror or Dolphin. Simply copy the ~/.opera directory to something suitable like 'opera_profile_backup'. Alternatively on the command line you could issue a command such as the following:

$ cp -r ~/.opera ~/opera_profile_backup

Now you can update Opera to the latest test build and test away. When you have done testing either keep the new snapshot/beta, or if you want to downgrade then simply do so. If you suspect any issues with your profile following the testing you can restore it by removing the corrupted ~/.opera and renaming ~/opera_profile_backup to ~/.opera. Done ... simple!

Note: Before you can backup your profile settings you must shut down Opera first. If Opera is running you may not get a good backup as files made be in the middle of being altered.

Method 2

This is a slight improvement on Method 1 and as an added bonus it also a great way of testing if a suspected bug is really an Opera issue or some problem with your profile. Before you upgrade make a backup copy of your profile settings as outlined in Method 1. Just to be sure! :wink:

This method utilises the '-pd' switch. The '-pd' switch allows you to specify a different Profile (settings) Directory. As you now know, Opera stores its profile settings in the directory ~/.opera by default. To specify a different directory you simply follow the '-pd' switch with one of your choice and if the directory doesn't exist, Opera will create it! :happy:

To actually test a build using this method simply upgrade to the Opera package you want to test and run Opera from the command line using the '-pd' switch to specify a test directory, e.g.

$ opera -pd /tmp/opera_snapshot_test &

A directory called 'opera_snapshot_test' will be created as a sub-directory of '/tmp/' to house your profile settings.

If you wanted to test your current profile settings without messing them up, you could copy ~/.opera to /tmp/opera_snapshot_test first before running Opera with the '-pd' switch, i.e.:

$ cp -r ~/.opera /tmp/opera_snapshot_test
$ opera -pd /tmp/opera_snapshot_test &

When you are done testing you can delete this whole directory and either keep this build or downgrade as you see fit.

Note: Earlier I mentioned that the '-pd' switch can be used to test if a suspected bug is really an Opera issue or some problem with your profile. This is true because you can use it to specify a clean profile. Therefore, before submitting an Opera bug try testing first with the '-pd' switch set to some new unused directory.

Method 3

This is the cleanest and best method (in my opinion), as it does not require you to upgrade or even 'install' the version you want to test. Instead of using one of the RPM or DEB packages, download one of the tarballs instead. A 'tarball' is a tar archive, which is typically compressed with gzip or bzip2. Hence the relevant Opera packages will end with .tar.gz or .tar.bz2. The tar packages are primarily provided for users of distributions that don't use the RPM or Debian based package managers. These could be distributions like Slackware, one of the smaller cut down distributions like Puppy Linux or even a setup where an advance user has manually created their own install (such as Linux from Scratch). These packages require no package manager and include an install script to assist installation.

As no package manager is needed, these versions do not handle full dependency checking. That may sound like a problem but it really isn't. Typically everything will already be in place on a modern distro anyway. The only part that might be missing in some modern distributions is the correct version of the Qt toolkit. However even this is not such a problem. If you have installed Opera previously via one of the package managers then Qt will have been installed already. In which case you just need to know if it is Qt3 or Qt4 and then pick the appropriate tar package. Even if you don't know this, it still doesn't matter, just try the Qt3 version first and if that doesn't work try Qt4. If you are really stuck just pick one of the static or bundled packages as these include a copy of Qt, so that you don't need to install it! :wink: There is no real risk of picking the wrong version anyway as we aren't going to actually 'install' a new copy of Opera as you'll see in a moment.

The key to how this works is that in addition to the install script, another handy script is included with the tar packages. It is a 'wrapper' script that allows opera to run 'in place', without editing or updating files outside of its own directory. The wrapper script is called 'opera' and is in the top level directory of the untarred package. As no files outside of the test directory are touched, when you are done testing you can simply delete the whole directory to revert to your setup before you began testing. Cool eh?

It might help if I gave you an example. I will test in the /tmp directory. Here is how I could quickly test 10.00-4464.gcc4-qt4.i386 without messing up my setup:

$ cd /tmp
$ wget http://snapshot.opera.com/unix/snapshot-4464/intel-linux/opera-10.00-4464.gcc4-qt4.i386.tar.bz2
$ tar -xjf opera-10.00-4464.gcc4-qt4.i386.tar.bz2
$ cd opera-10.00-4464.gcc4-qt4.i386
$ ./opera &

This will start opera and the wrapper script will create a new (clean) profile as a sub-directory of /tmp/opera-10.00-4464.gcc4-qt4.i386 called 'profile', i.e. /tmp/opera-10.00-4464.gcc4-qt4.i386/profile

Bear in mind that although the wrapper script does not update any files outside of its home directory by default, you can force it to do so if you desire, e.g. if you wanted to test your regular profile you could do the following instead after the step of cd'ing into the opera-10.00-4464.gcc4-qt4.i386 directory:

$ ./opera -pd ~/.opera &

There isn't much point in doing it this way though as it would alter your main profile, which is the very thing we are trying to avoid! I just wanted to demonstrate that the '-pd' switch still works even when running the wrapper script. A safer way would be to make a copy of your profile first and test on that copy, i.e. after the step of cd'ing into the opera-10.00-4464.gcc4-qt4.i386 directory, you would do the following:

$ cp -r ~/.opera profile
$ ./opera &

Here are the full set of steps again:

$ cd /tmp
$ wget http://snapshot.opera.com/unix/snapshot-4464/intel-linux/opera-10.00-4464.gcc4-qt4.i386.tar.bz2
$ tar -xjf opera-10.00-4464.gcc4-qt4.i386.tar.bz2
$ cd opera-10.00-4464.gcc4-qt4.i386
$ cp -r ~/.opera profile
$ ./opera &

Then after I have finished testing I could do the following to clean up after myself:

$ cd /tmp
$ rm -fr opera-10.00-4464.gcc4-qt4.i386*

In this case not only was your main profile settings folder not altered, we didn't even have to upgrade the installed copy of Opera!

Ok, that is all for now. If you have any questions ask below and I'll do my best to help.

Flash and Ubuntu

Comments

minusf 8. July 2009, 00:27

hi there

i have recently made experimental ports for opera10 for openbsd (uses linux emulation to run the linux version) so it can be installed alongside 9.64 for testriding.

to make it simple, i have decided to install everything (mozilla style) into /usr/local/opera10 and modify the startup script so it always uses .opera10 as the profile directory by adding

OPERA_PERSONALDIR=.opera10
export OPERA_PERSONALDIR

at the beginning of install.sh (as it generates the wrapper).

until i played with install.sh i didn't realize that opera will happily create a profile in every single directory it is started from -- i'd say the accepted behaviour (at least in the unix world) is to get one's home directory and work with that...

i hope the script will get some loving because i find it bloated and doing stuff in roundabout ways... forgive me saying so but install.sh is quite a terrible read :[

filbo 10. July 2009, 02:19

Thanks! I know about "-pd", my issue was getting a 2nd Opera installed without overwriting the existing one (don't feel like installing / testing / rolling back).

So to summarize: the tarball editions have a ./opera script in the tar-root directory, which runs the extracted Opera without needing to install it anywhere, using a scratch profile in the extract directory.

ruario 10. July 2009, 05:51

Originally posted by filbo:

So to summarize: the tarball editions have a ./opera script in the tar-root directory, which runs the extracted Opera without needing to install it anywhere, using a scratch profile in the extract directory.



Nice summary ... perhaps I should have written just that! p:

That wrapper script is handy for testing. I have 167 different builds of Opera on the main machine I use for testing but I have only been working here since January. A colleague sitting near by has 264. :wink:

ruario 10. July 2009, 17:48

Originally posted by minusf:

i hope the script will get some loving because i find it bloated and doing stuff in roundabout ways... forgive me saying so but install.sh is quite a terrible read :[



That's a fair point and it is known the script is not ideal. The script has a couple of bugs and lacks an uninstaller.

The reason for the lack of 'love' is that we aren't sure to what extent the install script is actually used. Personally I doubt it is very often. Most users are likely to install via rpm or deb, hence we have been more focused on other issues that would affect larger numbers of users. However I believe there are some plans for this script to be reviewed.

ruario 10. July 2009, 17:51

Originally posted by minusf:

until i played with install.sh i didn't realize that opera will happily create a profile in every single directory it is started from -- i'd say the accepted behaviour (at least in the unix world) is to get one's home directory and work with that...



The wrapper script (called opera in the root of the tarball) will create a profile in the same folder as itself. However a normal install of Opera will place its profile in ~/.opera by default (just like other UNIX programs).

minusf 12. July 2009, 22:52

Originally posted by ruario:

The reason for the lack of 'love' is that we aren't sure to what extent the install script is actually used. Personally I doubt it is very often. Most users are likely to install via rpm or deb, hence we have been more focused on other issues that would affect larger numbers of users.



your doubt is miscplaced... actually it is used every single time an opera port (package) is made. let me walk you through the process very quickly:

1. the static qt3 tar.bz2 (or tar.gz) is fetched
2. it is unpacked and local patches are applied
(3. in a non-binary situation the program is configured and built)
4. the program is installed _using its own install target_ and/or install script into a jail, a simulated unix hierarchy; then a list is made about the files that have been installed into various places. finally this list is used to generate a package with absolute paths.

in my understanding every system does something vaguely similar, starting at the bsd's, through the rpm spec files and so on. "make install" is the starting point for every package out there -- that is your install.sh

finally i invite you to have a quick look at the infrastructure at
http://www.openbsd.org/cgi-bin/cvsweb/ports/www/opera/

Originally posted by ruario:

The wrapper script (called opera in the root of the tarball) will create a profile in the same folder as itself. However a normal install of Opera will place its profile in ~/.opera by default (just like other UNIX programs).



yes, it seems my own change brought about this behaviour. sorry about the noise.

ruario 13. July 2009, 06:34

Originally posted by minusf:

your doubt is miscplaced... actually it is used every single time an opera port (package) is made.



Ok I admit I hadn't considered users making unofficial packages for non supported, emulated environments! :wink:

Even taking that into account, relative to the total Opera UNIX/Linux installed base, I still suspect that it is not that many users making use of install.sh. Though I would be happy to be proved wrong! :D

However, if I am reading your comments correctly it would seem that you are implying that RPM users also make use of this script. That isn't true. None of the officially provided .rpm or .deb packages make use of this script. Indeed the file is not even included within the .rpm or .deb package contents. It is only found in the tarballs. You can check this yourself with the following commands (on systems with dpkg and rpm installed):

$ rpm -q --list -p [opera rpm package]
$ dpkg-deb -c [opera deb package]

Compare this specifically to:

$ tar tf [opera tar package]

(Note: With come variants of tar you may need to decompress the tarball first, but the above will work with GNU tar)

The RPM or deb packages have their own (seperately maintained) scripts for the postinstall, preuninstall and postuninstall stages. If you have a system with rpm or dkpg installed, you can use package query commands to see the contents of these scripts, e.g.:

$ rpm -q --scripts -p [opera rpm package]

or

$ dpkg-deb -e [opera deb package]
$ cat DEBIAN/postinst
$ cat DEBIAN/prerm
$ cat DEBIAN/postrm

ruario 13. July 2009, 07:06

Another thought on the usage of install.sh. I have also come across Slackware users (one of the bigger Linux distros to not make use of the dpkg or rpm packages managers by default) still favouring the rpm and deb packages over the tar packages. My understanding of why they do this is because our tar packages are not formatted like Slackare's own (specifically they lack the install/ directory containing the slack-desc and doinst.sh files) and they don't want to use install.sh directly because of the lack of an uninstaller. Instead it would seem that these users are actually using the .rpm or .deb packages and converting them with alien or rpm2tgz. I even came across at least one Slackware user who installed rpm and then used 'rpm -ivh --nodeps [package]' to install Opera.

When even Slackware users are avoiding the tar packages you realise that install.sh probably has a pretty small user base (amongst Linux users at least). That said, even without install.sh, the tar packages are useful for several reasons. Firstly an advanced user can create their own install/uninstall script. Secondly the wrapper script (outlined in the original blog posting), makes them really handy for testing snapshots. Finally, the wrapper script can also be used for running Opera off a portable disk like a USB flash drive. :D

All that said, I do hope we can update install.sh soon and add an unistaller. I'll certainly push for it internally! :smile:

minusf 13. July 2009, 13:03

Originally posted by ruario:

Even taking that into account, relative to the total Opera UNIX/Linux installed base, I still suspect that it is not that many users making use of install.sh. Though I would be happy to be proved wrong!



it is only the port (package) maintainer who "uses" the script, users install the ready-made package.. so yes, "few" people use it directly, but all users benefit from it.

Originally posted by ruario:

However, if I am reading your comments correctly it would seem that you are implying that RPM users also make use of this script. That isn't true. None of the officially provided .rpm or .deb packages make use of this script. Indeed the file is not even included within the .rpm or .deb package contents.



what i meant was: one needs an install target ("make install") so that one knows actually where the product wants to place its files in the system. then the packaging system (rpm, deb, bsd ports) makes use of that information (in some way) and constructs a package based on that -- the means to get that information (install.sh, makefiles, source) are not included in the package itself anymore..

if you look at an rpm spec file to build a package from source, you will see the build scripts that will normally call "make install". the other scripts (pre, post, etc) just augment this process, not replace it.

opera's install target is 'install.sh'. by running it, we know where opera wants its stuff relative to the filesystem, so we can create a package. oftentimes installing is just mirroring a structure from inside the archive, sometimes it takes more to "integrate" it more properly into the system. that is what the post, pre and the other scripts do. but it is actually (in .deb) md5sums and the actual CONTENT that is based on install.sh's "output" or result (in one way or another). of course you have the source, so perhaps your .deb's and .rpm's are created by running "make install"... but if i were a maintainer of another less known linux distribution with funny path names, i would have to do the same: take your binary package and create another one to suit my needs, most likely playing around with 'install.sh'.

minusf 13. July 2009, 13:10

Originally posted by ruario:

When even Slackware users are avoiding the tar packages you realise that install.sh probably



but that is because 'install.sh' is crippled :] it's not that they don't want to use it -- they can't use it...

although an uninstall function for install.sh is not a showstopper as all the information needed to remove all the opera files is contained in the filelist (generated by running install.sh) -- and so ultimately in the package itself.

ruario 13. July 2009, 13:32

Originally posted by minusf:

opera's install target is 'install.sh'



For third party packages perhaps. Within Opera the file that you see in the tarballs called 'install.sh' is not the original file that was used in the creation of our debs or rpms, it was seperately created.

Originally posted by minusf:

although an uninstall function for install.sh is not a showstopper as all the information needed to remove all the opera files is contained in the filelist (generated by running install.sh) -- and so ultimately in the package itself.



For you (the way you are using it) it is not a problem. It is a problem for some less experienced users who call it directly to perform an install and later decided they no longer want Opera and need to return to a clean setup. They expect a more straight forward way to uninstall than looking at the list of files installed by the script and manually deleting them.

But we are going way off topic now though. To go right back to your first point (again):

Originally posted by minusf:

i hope the script will get some loving because i find it bloated and doing stuff in roundabout ways... forgive me saying so but install.sh is quite a terrible read :[



I am pushing for a full review but it could get delayed by 'more important' stuff.

minusf 16. July 2009, 16:29

thanks in any case for looking into this.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

Download Opera, the fastest and most secure browser
December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31