summaryrefslogtreecommitdiff
path: root/unofficial/modules/dieter/procedures/automatic
blob: 9bea7a6c47d6ecc67c5c4af10974970931b5dc22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/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..."
	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
	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=mbp-santa-rosa #TODO: prompt user for this, or let him pass it as cmdline argument (and check with svn info)

	_accept_ssl_cert
	notify "**** From now on. everything will be automatic. Enjoy the show!" # not true: you need pass for dm_crypt

        execute worker runtime_packages
        #TODO: i should have extra,community,.. (actually even yaourt/aur) available
}

phase_finish ()
{
	execute worker configure_home
}


worker_prepare_disks ()
{
	#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
	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"
	cryptsetup -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!"
}


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
}


_accept_ssl_cert ()
{
	mkdir -p /root/.subversion/auth/svn.ssl.server
	cat > /root/.subversion/auth/svn.ssl.server/1123d3c8b27895efee3848cc779e526a << EOF
K 10
ascii_cert
V 716
MIICFTCCAX6gAwIBAgIBAjANBgkqhkiG9w0BAQQFADBVMRswGQYDVQQKExJBcGFjaGUgSFRUUCBTZXJ2ZXIxIjAgBgNVBAsTGUZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkxEjAQBgNVBAMTCWxvY2FsaG9zdDAeFw0wNjA3MjQxMjUwMzdaFw0wNzA3MjQxMjUwMzdaMEwxGzAZBgNVBAoTEkFwYWNoZSBIVFRQIFNlcnZlcjEZMBcGA1UECxMQVGVzdCBDZXJ0aWZpY2F0ZTESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDF5PB1NnUve2jkisDTGsxKC9qzpnl+eX8UIR/1s+yX2ZIPNnIryeqTc6sS3cBHz2/AufIr0xbpXkTa4V5Es5bXA7W1D7+ZzuFHjjyi4E2eqYVkhkv1sRL5TpAovfjAA+96iaFHp3yKYiuw/nWwQTSW9M1VrDEym4ODxyJOtNdgQQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABY0bnBf9tL1WMC1sLxB1eDXvs5qNY96mny+EKGAbyQROPaXwsRQB0HrAkuWfHzQlgIdD6AfGsd+YMcEuqSPzIz6t6mA45jl++WvI6we9t3eYChtdPD2xjgHti0aSiDyVLTJbXPnkdgzKvIjYZcXBwbmbQSrg0STO5m+cSYt3chx
K 8
failures
V 2
14
K 15
svn:realmstring
V 23
https://192.168.1.2:443
END
EOF

}