summaryrefslogtreecommitdiff
path: root/src/core/procedures/base
blob: 7d56b098da271b14539b6dff6c8e58cf3fc1ca72 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#!/bin/bash

#TODO: make this profile work on itself, eg some stuff from inheriting profiles should be moved in, stuff implemented etc
var_DEFAULTFS="/boot:32:ext2:+ swap:256:swap /:7500:ext3 /home:*:ext3"
var_TARGET_DIR="/mnt" # When overriding this, do _not_ add a trailing /.  It's not needed and maybe you could even break something
var_RUNTIME_REPOSITORIES= # array like this ('name1' 'location of repo 1' ['name2' 'location of repo2',..])
var_RUNTIME_PACKAGES=
var_PKG_FILE=$RUNTIME_DIR/aif-package-list # not used by default in base/interactive. can be used by custom procedures or profiles for the automatic procedure
var_MIRRORLIST="/etc/pacman.d/mirrorlist"
var_UI_TYPE="cli" # set to cli or dia for dialog
var_ARCH=`uname -m` #i686 or x86_64. NOTE: this assumes you want to install the same arch as the installation environment you're using. maybe we could decouple those someday..
[ -z "$var_ARCH" ] && die_error "Could not determine your architecture"

###### Phases ( can be overridden by more specific procedures) ######
phase_preparation=(\
	configure \
	intro \
	sysprep \
	select_source \
	runtime_network \
	runtime_repositories \
	runtime_packages)

phase_basics=(\
	set_clock \
	prepare_disks)

phase_system=(\
	package_list \
	install_packages \
	auto_fstab \
	auto_network \
	auto_locale \
	auto_keymap_font \
	configure_system \
	mkinitcpio \
	locales \
	install_bootloader)

phase_finish=(msg_report)



###### Workers ( can be overridden by more specific procedures) ######
worker_intro ()
{
	ask_yesno "This is a low-interactivity 'common defaults' installation.  Do you really want to do this?  We may overwrite your data."
	if [ $? -gt 0 ]
	then
		die_error "User aborted base profile execution"
	fi
}


worker_sysprep ()
{
	mount -o remount,rw / &>/dev/null
}


worker_configure ()
{
	var_UI_TYPE=${arg_ui_type:-cli}
}


worker_select_source ()
{
	var_PKG_SOURCE_TYPE='cd'
	var_FILE_URL="file:///src/core/pkg"
	var_SYNC_URL= # optional, points to a repository string something like ftp://ftp.belnet.be/mirror/archlinux.org/$repo/os/i686 (eg the same format as what you find in /etc/pacman.conf)
	# if you override to use ftp (or ask user and he chooses ftp) don't forget to configure the network and to select_mirrors
}


worker_select_source_extras_menu ()
{
	select_source_extras_menu
}


worker_runtime_network ()
{
	#network is assumed to be functional for now because we do it first with /arch/setup. once that falls away, we'll need to implement it here
	true
}


worker_runtime_repositories ()
{
	for i in `seq 0 $((${#var_RUNTIME_REPOSITORIES[@]}/2-1))`
	do
		repo=${var_RUNTIME_REPOSITORIES[$(($i*2))]}
		location=${var_RUNTIME_REPOSITORIES[$(($i*2+1))]}
		list_pacman_repos runtime | grep -q $repo || add_pacman_repo runtime $repo "$location"
	done
}


worker_runtime_packages ()
{
	for pkg in $var_RUNTIME_PACKAGES
	do
		$PACMAN -Sy --noconfirm --needed $pkg
	done
}


worker_set_clock ()
{
	NEXTITEM=
        while true; do
                default=no
                [ -n "$NEXTITEM" ] && default="$NEXTITEM"
                ask_option $default "Date/time configuration" '' required \
                "1" "Select region and timezone" \
                "2" "Set time and date" \
                "3" "Return to Main Menu"
                [ "$ANSWER_OPTION" = 1 ] && execute worker interactive_timezone && NEXTITEM=2
                [ "$ANSWER_OPTION" = 2 ] && check_depend worker interactive_timezone && execute worker interactive_time && NEXTITEM=3
                [ "$ANSWER_OPTION" = 3 ] && break
        done
}


worker_interactive_timezone ()
{
	interactive_timezone
}


worker_interactive_time ()
{
	interactive_time
}


worker_prepare_disks ()
{
	partition # use lib-archboot function by default
	# in official installer: autoprepare or diy first partitions, then mountpoints
}


# Put the list of packages to be installed in $var_TARGET_PACKAGES and $var_TARGET_GROUPS
worker_package_list ()
{
	var_TARGET_GROUPS=base
}


worker_install_packages ()
{
	target_prepare_pacman core #TODO: it would be better if this was a separate worker, i think
	installpkg
}


worker_auto_fstab ()
{
	target_configure_fstab
}


worker_auto_network ()
{
	[ "$S_DHCP" = 1 ] && target_configure_network dhcp "$PROXY_HTTP" "$PROXY_FTP"
	[ "$S_DHCP" != 1 ] && target_configure_network fixed "$PROXY_HTTP" "$PROXY_FTP"
}


worker_auto_locale ()
{
	target_configure_initial_locale
}


worker_auto_keymap_font ()
{
	target_configure_initial_keymap_font
}

worker_configure_system ()
{
	#TODO: what to do here?
	true
}


worker_mkinitcpio ()
{
	run_mkinitcpio
}


worker_locales ()
{
	target_locale-gen
}


worker_initialtime ()
{
	cp /etc/localtime ${var_TARGET_DIR}/etc/localtime
}


worker_install_bootlader ()
{
	#TODO: ask which disk, install grub on it
	true
}

worker_msg_report ()
{
	show_report
}