# InterMezzo
# ==========
# Unless otherwise notified, do everything on the client and on the server.
# They can be the same computer, but in most cases they won't be.
# InterMezzo was added to Linus' kernel as of version 2.4.15 Enable
# CONFIG_INTERMEZZO_FS in your kernel. If you set it as a module, run
# 'modprobe intermezzo'. If you turned it on, reboot to run your new
# kernel.
# Now install the intersync package. It includes various utils and the
# intersync daemon. Intersync uses a copy of Apache running on alternate
# ports on both ends to handle things. This other copy of Apache can
# co-exist with a normal running Apache bound to port 80. If you have
# iptables set up on the server, open up tcp port 370 from the client.
cd
test -f installed/intersync-0.9.5-3.tar.gz &&
mv installed/intersync-0.9.5-3.tar.gz .
test ! -f intersync-0.9.5-3.tar.gz &&
wget ftp://ftp.inter-mezzo.org/pub/intermezzo/intersync-0.9.5-3.tar.gz
cd /usr/local/src
find -type d -maxdepth 1 -name "intersync-*" -exec rm -r {} \;
tar xzvf ~/intersync-0.9.5-3.tar.gz
cd intersync-0.9.5
chown -R root.root .
# Apply a patch to fix up some things:
# * Install the init script into /etc/rc.d/init.d (instead of /etc/init.d)
# * In the init script:
# - Fix various paths
# - Only try to source files if they exist
# - Quote $NETWORKING to avoid an error if it's not set
# - Removed status, which doesn't do anything if you don't have a status
# executable (which I don't - is that part of daemontools?)
# * In intersync/intersync.c, fix the path of the Apache binary from
# /usr/sbin/httpd or /usr/sbin/apache to /usr/sbin/httpd or
# /usr/local/apache/bin/httpd
# * Because --without-apache-modules just sets the module prefix dir to "no",
# in lib/config.c I set the LoadModule lines to be created in
# intersync-httpd.conf as commented out. This way it won't try to load them
# causing a fatal error if they don't exist (because mod_alias, mod_cgi, and
# mod_log_config are all built in on every Apache installation I've
# done/seen for at least the last few years)
# * I ran "autoreconf -f -i" before creating the patch so the files have
# been updated from autoconf 2.57 to 2.59 and automake 1.6.3 to 1.8.2
wget -nc http://englanders.cc/pub/linux/patches/intersync-0.9.5.patch &&
patch -p1 < intersync-0.9.5.patch
./configure
make
rm -f /usr/lib/libintermezzo.*
make install
ldconfig
cd
mkdir -p -m 0700 installed
rm -f installed/intersync-*.tar.*
mv intersync-0.9.5-3.tar.gz installed/
# intersync installs the startup script where it thinks it should go
# (/etc/init.d) without first checking to see if that directory exists (in
# Slackware, /etc/init.d doesn't). The patch applied above changes the
# path to /etc/rc.d/init.d I probably should've truly fixed it to work for
# either case, maybe next time :-)
#
# If you have the SysV-style directories set up (/etc/rc.d/init.d,
# /etc/rc.d/rc[0-6].d) this will set up the necessary symlinks so the script
# will be run on boot-up. If you don't have them set up, move the script
# to /etc/rc.d/rc.intersync, rmdir /etc/rc.d/init.d, and add something to
# /etc/rc.d/rc.local to run "/etc/rc.d/rc.intersync start" on boot-up.
cd /etc/rc.d
test -d rc0.d && ln -sf ../init.d/intersync rc0.d/K1intersync
for num in 2 3 4 5 ; do test -d rc$num.d && ln -sf ../init.d/intersync \
rc$num.d/S99intersync ; done
test -d rc6.d && ln -sf ../init.d/intersync rc6.d/K1intersync
cd
# Create an 'intermezzo' user and group:
getent group | grep "^intermezzo:" > /dev/null || groupadd intermezzo
id intermezzo > /dev/null 2>&1 || useradd -g intermezzo intermezzo
# Create a directory where the filesystem will be mounted. Some people like
# to use mount directory names like /exports/foo on the server and
# /imports/foo on the client, especially when there are lots of mounts, but
# here we just use /mnt/intermezzo on both.
mkdir -p /mnt/intermezzo
# Now mount the InterMezzo filesystem on the client and on the server.
# The filesystem type 'intermezzo' is used for device-based filesystems,
# 'vintermezzo' for others like loop and tmpfs.
# If both computers have a filesystem on /dev/hda3 that you want to share,
# mount it on both like so:
# mount -t intermezzo /dev/hda3 /mnt/intermezzo
# If you want to share a 10 meg loopback filesystem (a file with a filesystem
# in it) on both, first make sure you have CONFIG_BLK_DEV_LOOP turned on
# in your kernel (and run 'modprobe loop' if it's a module), then create it
# and mount it like so:
dd if=/dev/zero of=~/loopfile bs=1k count=10000
chmod 600 ~/loopfile
losetup /dev/loop0 ~/loopfile
mkfs -t ext3 /dev/loop0
mkdir -p /mnt/loop
mount /dev/loop0 /mnt/loop
mount -t vintermezzo /dev/loop0 /mnt/intermezzo
# Open up the init script (/etc/rc.d/init.d/intersync or
# /etc/rc.d/rc.intersync) on both computers and set CACHE to the mount point
# (the patch set it to /mnt/intermezzo).
#
# On the client only, set CLIENT_OPTS to "--server=foo.yourdomain.org" where
# foo.yourdomain.org is the server's FQDN or IP address.
#
# Now run "/etc/rc.d/init.d/intersync start" (or "/etc/rc.d/rc.intersync
# start") to fire it up.
# Now put a file into /mnt/intermezzo on either end and watch it appear in
# the other.