00-pre-initialisation.sh 1.56 KB
Newer Older
1 2
#!/bin/bash

3
# assuming use of hrmpf [ https://github.com/leahneukirchen/hrmpf/ ] or Ubuntu livecd
4 5
# - none of this is perhaps strictly necessary and may change

6 7
# TODO: add system-detection

8 9 10
USERNAME=`whoami`

if [ ${USERNAME} == "root" ]
11 12 13
then
    echo "This script sets up the needed tools for preparing a ZFS LUKS encrypted partition."
    DISTROUSED=`lsb_release -si`
14

15 16 17 18
    if [ ${DISTROUSED} == "VoidLinux" ]
    then
	# get rid of old kernel to save dkms compilation time
	xbps-remove linux4.9 linux4.9-headers 
19

20 21
	# update essential things - xbps
	xbps-install -Su
22

23 24
	# warn user about time
	echo "You may want to go and put the kettle on; this can take a bit"
25

26 27
	# then install up-to-date zfs (the long bit)
	xbps-install zfs
28

29 30
	# modprobe: activate zfs
	/sbin/modprobe zfs
31

32 33 34 35
	# message to user
	echo "You have installed the needed tools on the chroot-host machine."
	echo "You are now ready to proceed to the next step; execute the following in the terminal:"
	echo ". 01-cryptsetup.sh"
36

37 38
    elif [ ${DISTROUSED} == "Ubuntu" ]
    then
39

40 41 42 43 44
	# update repos
	apt update

	# install zfs components
	apt install zfsutils-linux
45
         
46 47
	# modprobe: activate zfs
	/sbin/modprobe zfs
48

49 50 51 52 53 54 55 56
	# message to user
	echo "You have installed the needed tools on the chroot-host machine."
	echo "You are now ready to proceed to the next step; execute the following in the terminal:"
	echo ". 01-cryptsetup.sh"

    else
	echo "I'm not sure what system you're using. You probably know. Do what you need to and move to the next script."
    fi
57

58 59 60
else
    echo "You need to be root. Please become root and try again."
fi