automate/101_livecd-add-zfs.sh

49 lines
1.2 KiB
Bash

# add automate scripts
#git clone http://git.devuan.org/cyteen/automate
cd automate
# Add contrib to sources.list
bash 001_apt-sources.sh
# Add zfs
bash 010_zfs.sh
# Mount the hdd
ZFS_HOME=/mnt
zpool import -a -R ${ZFS_HOME}
mkdir -p ${ZFS_HOME}/dev
mount -o bind /dev ${ZFS_HOME}/dev
mkdir -p ${ZFS_HOME}/dev/pts
mount -o bind /dev/pts ${ZFS_HOME}/dev/pts
mkdir -p ${ZFS_HOME}/sys
mount -o bind /sys ${ZFS_HOME}/sys
mkdir -p ${ZFS_HOME}/proc
mount -t proc /proc ${ZFS_HOME}/proc
mkdir -p ${ZFS_HOME}/run
mount -o bind /run ${ZFS_HOME}/run
# Rebuild drivers
chroot ${ZFS_HOME} dpkg-reconfigure spl-dkms
chroot ${ZFS_HOME} dpkg-reconfigure zfs-dkms
# Update initramfs
# Error: live system without live media mounted as /lib/live/mount/medium
chroot ${ZFS_HOME} bash -c 'apt-get remove -y live-tools'
chroot ${ZFS_HOME} bash -c 'apt-get install -y initramfs-tools'
chroot ${ZFS_HOME} bash -c 'update-initramfs -v -u -t -k all'
# Update grub menu
chroot ${ZFS_HOME} grub-mkdevicemap
chroot ${ZFS_HOME} grub-probe /
chroot ${ZFS_HOME} update-grub
umount ${ZFS_HOME}/dev
umount ${ZFS_HOME}/dev/pts
umount ${ZFS_HOME}/sys
umount ${ZFS_HOME}/proc
umount ${ZFS_HOME}/run
umount ${ZFS_HOME}