The problem: you still need Windows every now and then (even I have this 'problem'). Those games that just refuse to run in Wine, or those applications, or something just is not there in Linux free or not free (like multimedia apps comparable to Logic or Pro Tools, or even FL Studio).
Of course you'll notice that when you boot back into Windows, your Firefox there is completely different from your Firefox in Linux. How do we keep these in sync?
I have found that the easiest way to do this is with rsync. Most distros have it installed by default as it is a very useful tool. If not, get it from your repository. No need for a GUI here. It is all console here. This is ONLY for the case where you are syncing from Linux->Windows. Any changes made in Windows are deleted on the next sync.
What I like to do is sync on shut down. So I have an init script for Gentoo that looks like the following:
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
before xdm
}
start() {
einfo "Deleting Windows temporary files ..."
bash /home/tatsh/usr/bin/delwintemp
eend 0
}
stop() {
einfo "Syncing program preferences to Windows ..."
bash /home/tatsh/usr/bin/sync2win-firefox
eend 0
}
So you may copy this script to something like /etc/init.d/sync2win and then run something like rc-update add sync2win default (on Gentoo; find out the correct command for your init system). The path may need to be fixed for wherever you store the scripts below.
And yes, this script does run sync2win-firefox as root. And it even cleans up Windows temporary files on start up of Linux. 90% of the time nothing useful is there and it just gets filled up. I find it useful to have this delete everything there (especially stuff Windows cannot delete while it is running).
The delwintemp Bash script looks like:
#!/bin/sh rm -fR /mnt/winxp/Config.Msi rm -fR /mnt/winxp/Temp/* rm -fR /mnt/winxp/WINDOWS/Temp/*
I use XP as you can probably tell, so these will have to be adjusted for Windows Vista and 7. I have set my local variables to have C:\Temp as the temporary files directory regardless of whether they are system or user. Regardless of this, some applications (like setups) have their path hard-coded (stupidly) to C:\Windows\Temp. So you might as well never have Windows on another drive letter because otherwise those applications might completely fail.
Now onto what we are really after: syncing bookmarks and settings between Windows and Linux. Here is what the sync2win-firefox script looks like:
#!/bin/sh rsync --progress --force --delete-before -rltqd /home/tatsh/.mozilla/firefox/8w1x79w1.default/ /mnt/winxp/Users/Tatsh/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default > /dev/null 2>&1 rm -R \ /mnt/winxp/Users/Tatsh/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default/OfflineCache \ > /dev/null 2>&1 cp /home/tatsh/.mozilla/firefox/8w1x79w1.default/urlclassifier3.sqlite /mnt/winxp/Users/Tatsh/Local\ Settings/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default > /dev/null 2>&1 cp /home/tatsh/.mozilla/firefox/8w1x79w1.default/XPC.mfasl /mnt/winxp/Users/Tatsh/Local\ Settings/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default/XPC.mfl > /dev/null 2>&1 cp /home/tatsh/.mozilla/firefox/8w1x79w1.default/XUL.mfasl /mnt/winxp/Users/Tatsh/Local\ Settings/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default/XUL.mfl > /dev/null 2>&1
This script makes sure there is no output whatsoever even if there is an error (hence the < /dev/null 2<&1 on each command). There are some key differences between a Firefox profile stored on Linux and one stored on Windows:
You will need to fix the script above to have the correct paths. Windows Vista does not store the Local Settings data in the same place as XP. And since I have Windows XP (thanks to nLite) set to use Users directory instead of 'Documents and Settings' you need to fix that as well. (On Vista, the directory is Users).
One stumbling point: how do you keep paths right? Obviously Windows has no idea what /home/tatsh/downloads means. So Firefox will revert this back to default, which is your Documents\Downloads directory. If this is okay, then all is done. If not, you can try to sed the path from prefs.js file.
sed -e 's/\/home\/tatsh\/move/D\:\\temp\\move/' -i /mnt/winxp/Users/Tatsh/Application\ Data/Mozilla/Firefox/Profiles/8w1x79w1.default/prefs.js
On Windows, I store downloads in D:\temp\move. On Linux it is the same directory except it is a symlink in my home path named 'move' that points to /mnt/share/temp/move. So this will replace /home/tatsh/move to D:\temp\move if successful.
If you wish to sync back to Linux on reboot after using Windows, you need to kind of reverse the script above and place the code within start().
So there you have it. While you still need Windows, keep things in sync so you are not so annoyed. Firefox requires a few tricks to be 100% in-sync. You could of course just copy over your profile in Windows from Linux, but then you have some problems like the 'awesome bar' being out of sync.
If there was an automated way for Firefox to import preferences I would do it that way but I have not seen anything to migrate profiles between different OS's yet and it would still need some interaction (unless it would accept stdin from say echo). Maybe I will get to coding such an app, since it does require parsing the JS settings file, and perhaps the SQLite file as well.
Comments
Post new comment