summaryrefslogtreecommitdiffstats
path: root/lib/install.sh
blob: 7abb558e9f3e02d16569490f4e23cf3f52d9a93f (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
# Functions for installing systems
#
# Copyright (C) 2013, 2014  Patrick "P. J." McDermott
#
# This file is part of the ProteanOS Development Kit.
#
# The ProteanOS Development Kit is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# The ProteanOS Development Kit is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the ProteanOS Development Kit.  If not, see
# <http://www.gnu.org/licenses/>.

[ "x${_INSTALL_SM+set}" = 'xset' ] && return 0
_INSTALL_SM=1

install_system()
{
	local mirror="${1}"
	local suite="${2}"
	local arch="${3}"
	local plat="${4}"

	info "$(get_msg 'cmd_install_setting_up_chroot')"
	if [ -d "${chroot}" ] && ! dir_is_empty "${chroot}" 'lost+found'; then
		error 2 "$(get_msg 'cmd_install_chroot_dir_exists')" "${chroot}"
	fi
	if ! mkdir -p "${chroot}/.prokit" "${chroot}/prokit"; then
		error 2 "$(get_msg 'cmd_install_mkdir_chroot_fail')" "${chroot}"
	fi
	>"${chroot}/prokit/installing"

	info "$(get_msg 'cmd_install_find_pkgs')"
	cmd_install_find_pkgs "${mirror}" "${suite}" "${arch}" "${plat}" \
		"${chroot}"
	cmd_install_get_pkgs "${chroot}"

	info "$(get_msg 'cmd_install_configuring')"
	if ! ${foreign}; then
		profile_configure_system_native "${chroot}" "${arch}" "${plat}"
	else
		profile_configure_system_foreign "${chroot}" "${arch}" "${plat}"
	fi

	rm "${chroot}/prokit/installing"
}