[arch-general] Updating iputils over NFS

Thomas Bächler thomas at archlinux.org
Mon Oct 1 11:19:40 EDT 2012


Am 01.10.2012 15:50, schrieb Paul Gideon Dann:
> Makes sense.  I would certainly think twice for something as complex as a full 
> interactive desktop setup.  I hold by NFS for this cluster, though.

If you don't run a desktop, then you may be fine.

> I really like your sync-on-boot solution.  I'd like to store this information 
> away for future use.  How did you implement it?  Something in an initrd hook?

sysupgrade install hook (run without autodetect):

build() {
    add_binary rsync
    add_binary findmnt
    add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"
    add_runscript
    add_checked_modules "/drivers/net"
    add_module nfs
    add_file "/root/sync/sync-include-file" "/sync-include-file"
}

help() {
    cat <<HELPEOF
Custom Arch Linux Update on Boot
HELPEOF
}

sysupgrade run hook:

run_hook() {
    ipconfig ip=dhcp

    mount_handler="sysupgrade_mount_handler"
}

sysupgrade_mount_handler() {
    default_mount_handler "$@"

    # mount /boot if it exists
    realtab=/new_root/etc/fstab
    if [ -f "$realtab" ]; then
        if boot_source=$(findmnt -snero source --tab-file="$realtab"
/boot); then
            mountopts=$(findmnt -snero options --tab-file="$realtab" /boot)
            fsck_device "$boot_source"
            msg ":: mounting '$boot_source' on /boot"
            mount "$boot_source" /new_root/boot -o "$mountopts"
        fi
    fi

    rsync --delete -ahvuHPAXE \
          --include-from /sync-include-file \
          192.168.0.1::arch_sysupgrade/ /new_root/

    msg ":: umounting '$boot_source' from /boot"
    umount /new_root/boot
}

my sync_include_file looks like this:

# System files
- /boot/syslinux/ldlinux.sys
- /boot/lost+found/
+ /dev/
- /dev/*
+ /home/
- /home/*
- /lost+found/
+ /media/
- /media/*
+ /mnt/
- /mnt/*
+ /proc/
- /proc/*
+ /run/
- /run/*
- /root/.*
+ /sys/
- /sys/*
+ /tmp/
- /tmp/*
+ /usr/local/
- /usr/local/*
- /var/tmp/**/
+ /var/**/
+ /var/lock
+ /var/run
+ /var/mail
+ /var/lib/pacman/**
+ /var/lib/texmf/**
- /var/**

# Site-specific config files
- /boot/syslinux/syslinux.cfg
- /etc/hostname
- /etc/fstab
- /etc/resolv.conf
- /etc/ssh/ssh_host_*
- /etc/udev/rules.d/01-site-input.rules
- /etc/X11/xorg.conf_*
- /etc/X11/xorg.conf.d/05-local-keyboard.conf
- /usr/share/config/kdm/kdmrc

Note that this syncs the whole content of /var/lib/{pacman,texmf}, but
otherwise only recreates the directory structure of /var and does not
sync any files.

Also note that you must load the kernel and initramfs from the network
when running sysupgrade, so you can boot directly into the updated
system when finished without a further reboot.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/arch-general/attachments/20121001/eb468203/attachment.asc>


More information about the arch-general mailing list