[ltp] Syncing various data with a desktop (configs, bookmarks and such)

Greg Meyer linux-thinkpad@linux-thinkpad.org
Mon, 29 Mar 2004 21:18:44 -0500


On Monday 29 March 2004 07:45 pm, Tom von Schwerdtner wrote:
> There are a few things I've been wanting in terms of moving between my
> laptop and my desktop PC.
>
> 1) I'd like to be able to sync some key items, such as my Epiphany
> bookmarks and maybe my ~/Graphics/ or ~/Documents/ directories.
>
> 2) I'd like to be able to have some automagic mounting going on with my
> laptop when it is booted on my home network.  I'm not sure where to
> start with this but I would at very least like my laptop to auto-mount
> some share directories if it can figure out that it is running on my
> home network.  Ideally, I'd like my desktop to mount my laptop when the
> laptop boots on the network.
>
> I don't know of any existing projects for this sorta stuff, but I
> thought maybe you folks might have some ideas or directions you could
> point me in before I try to go out and blindly script some ugliness.
>
Here is a script I use to start my network connections based upon my location.  
You probably will not be able to use it as is, but I think you will find some 
of it useful to achieve what you are trying to do.

#!/bin/bash
#This is the network startup script that is handy for a laptop
#computer that has to move between different networks.

#Define variables
#Set the profile
PROFILE=$1

#These are the kernel modules that need to be loaded for the various 
interfaces
WIRED=e1000
WIRELESS=airo_mpi

#You must be root to run this script, so we test and then exit if
#whoami does not return root
if test `whoami` != root ; then
        echo "You must be the system administrator to run this script"
        echo "Please become root user and try again"
        exit
fi

#Test and make sure a profile was specified
if test "$PROFILE" = "" ; then
        echo "You must specify a valid network profile"
        echo "Syntax: network.sh <profile>"
        exit
fi

#Give some feedback to the user
echo "Setting parameters for $PROFILE networking profile"

#Set up hosts and modules.conf
#The related hosts.$PROFILE files should contain the addresses on the local 
net
#that need to be resolved by name.  The related modprobe.conf.$PROFILE files 
should
#contain the proper aliases for the order we want the network interfaces to 
load.

cp /etc/hosts.base /etc/hosts
cat /etc/hosts.$PROFILE >> /etc/hosts
echo "Creating hosts file... done."


#The copying of modules base must be done as part of the initscripts so that
#a basic modules.conf file is available at boot.  Perhaps this can always be 
done at
#shutdown, but is probably better as part of rc.sysinit.
cp /etc/modprobe.conf.base /etc/modprobe.conf
cat /etc/modprobe.conf.$PROFILE >> /etc/modprobe.conf
echo "Creating module aliases... done."

#Load kernel modules for network adapters
#This section is commented out because I find it unnecessary, everything works
#fine without it and it just adds unecessary complexity

#if test "$WIRED" = "" ; then
#       echo "No wired interface specified -- skipping"
#fi
#
#if test "$WIRED" != "" ; then
#       echo "Loading module $WIRED... done."
#       modprobe $WIRED
#fi
#
#if test "$WIRELESS" = "" ; then
#       echo "No wireless interface specified -- skipping"
#fi
#
#if test "$WIRELESS" != "" ; then
#       echo "Loading module $WIRELESS... done."
#       modprobe $WIRELESS
#fi


#If we get this far we can bring up the interfaces
echo "Bringing up the network interfaces... "
ifup eth0.$PROFILE
ifup eth1.$PROFILE
echo "done"

#Set up resolv.conf
#Not actually necessary since ifup script accomplishes this
#cp /etc/resolv.conf.$PROFILE /etc/resolv.conf
echo "Creating Nameserver entries... done."

#Set date and time
/usr/local/bin/dt

#Update dnsalias ip address
echo "Updating Dynamic DNS Record"
/usr/local/bin/ipcheck.sh

#Restart Win4Lin
service Win4Lin restart

#Update the files in the postfix chroot jail and start postfix
postfix-chroot.sh update

#Mount appropriate network shares depending on profile selected
if test "$PROFILE" = "home" ; then
        mount /mnt/music
        mount /mnt/samba
        mount /mnt/dist
        echo "Mounting network shares... done."
fi

if test "$PROFILE" = "work" ; then
        mount /mnt/share
        echo "Mounting network shares... done."
fi

-- 
/g