#!/bin/bash depend_procedure core base var_RUNTIME_PACKAGES="svn" phase_preparation () { # All things that need to be done manually first notify "A few manual things need to happen first..." execute worker runtime_network SVN_USERNAME=dieter ask_password svn #TODO: if user entered incorrect password, the install process will just fail.. SVN="svn --username $SVN_USERNAME --password $SVN_PASSWORD" SVN_BASE=https://192.168.1.2/svn/repos TARGET_HOST=desktop-a7n8x #TODO: prompt user for this, or let him pass it as cmdline argument (and check with svn info) notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: you need pass for dm_crypt _accept_ssl_cert execute worker select_source execute worker runtime_packages #TODO: i should have extra,community,.. (actually even yaourt/aur) available } phase_finish () { execute worker configure_home } worker_runtime_network () { if ask_yesno "Do you want to (re)-configure your networking?" then #TODO: which function do i need here? donetwork #configure network by using library else notify "Ok. skipping network config" fi } worker_prepare_disks () { modprobe dm-crypt || die_error "Cannot modprobe dm-crypt" modprobe -q aes-x86-64 || modprobe aes-i586 || die_error "Cannot modprobe aes-x86-64 or aes-i586" # Cleanup whatever state the disk is in (that includes previous, failed runs of this script) umount /dev/mapper/cryptpool-* 2>/dev/null vgremove -f cryptpool 2>/dev/null pvremove /dev/mapper/sda2_crypt 2>/dev/null cryptsetup luksClose sda2_crypt 2>/dev/null dd if=/dev/urandom of=/dev/sda bs=512 count=1 #TODO: integrate this stuff into the functions in the libs + do error checking and handling sfdisk /dev/sda 2>&1 | grep -v 'not have an msdos signature' << EOF ,10,L,* ,,L EOF #TODO: when sfdisk is done, i still have an invalid partition table? cryptsetup --batch-mode -c aes-xts-plain -y -s 512 luksFormat /dev/sda2 cryptsetup luksOpen /dev/sda2 sda2_crypt pvcreate /dev/mapper/sda2_crypt vgcreate cryptpool /dev/mapper/sda2_crypt lvcreate -L 2G -n swap cryptpool lvcreate -L 500M -n tmp cryptpool lvcreate -L 10G -n home cryptpool lvcreate -L 10G -n root cryptpool lvcreate -L 3G -n var cryptpool for i in home root tmp var do mkdir -p $var_TARGET_DIR/$i mke2fs -j /dev/cryptpool/$i && mount /dev/cryptpool/$i $var_TARGET_DIR/$i done #TODO fstab? auto-add to fstab with libs? auto mkdir's on target_dir? true } worker_package_list () { $SVN export $SVN_BASE/ddm-configs/$TARGET_HOST/trunk/package-list $var_PKG_FILE || die_error "Could not export package list!" TARGET_PACKAGES=`cat $var_PKG_FILE` # beware, there are newlines in it now TARGET_PACKAGES=`echo $TARGET_PACKAGES` # not anymore :) } worker_configure_home () { #checkout from svn true } worker_set_clock () { #timezone="Europe/Brussels" #Not doing anything. hwclock is set already and configs are coming from svn anyway.. true } worker_install_bootloader () { install-grub /dev/sda }