Re: Updating iputils over NFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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.


Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux