summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/install.sh85
1 files changed, 42 insertions, 43 deletions
diff --git a/src/install.sh b/src/install.sh
index 4daeb70..27b2a33 100644
--- a/src/install.sh
+++ b/src/install.sh
@@ -30,7 +30,7 @@ install_system()
local suite="${2}"
local arch="${3}"
local plat="${4}"
- local chroot="${5}"
+ local root="${5}"
local foreign="${6}"
if [ "x${arch}" = 'x' ]; then
@@ -54,27 +54,26 @@ install_system()
info "$(get_msg 'install_selected_mirror')" "${mirror}"
info "$(get_msg 'install_setting_up_chroot')"
- if [ -d "${chroot}" ] && ! dir_is_empty "${chroot}" 'lost+found'; then
- error 2 "$(get_msg 'install_chroot_dir_exists')" "${chroot}"
+ if [ -d "${root}" ] && ! dir_is_empty "${root}" 'lost+found'; then
+ error 2 "$(get_msg 'install_chroot_dir_exists')" "${root}"
fi
- if ! mkdir -p "${chroot}/.prokit" "${chroot}/prokit"; then
- error 2 "$(get_msg 'install_mkdir_chroot_fail')" "${chroot}"
+ if ! mkdir -p "${root}/.prokit" "${root}/prokit"; then
+ error 2 "$(get_msg 'install_mkdir_chroot_fail')" "${root}"
fi
- >"${chroot}/prokit/installing"
+ >"${root}/prokit/installing"
info "$(get_msg 'install_find_pkgs')"
- install_find_pkgs "${mirror}" "${suite}" "${arch}" "${plat}" \
- "${chroot}"
- install_get_pkgs "${chroot}"
+ install_find_pkgs "${mirror}" "${suite}" "${arch}" "${plat}" "${root}"
+ install_get_pkgs "${root}"
info "$(get_msg 'install_configuring')"
if ! ${foreign}; then
- profile_configure_system_native "${chroot}" "${arch}" "${plat}"
+ profile_configure_system_native "${root}" "${arch}" "${plat}"
else
- profile_configure_system_foreign "${chroot}" "${arch}" "${plat}"
+ profile_configure_system_foreign "${root}" "${arch}" "${plat}"
fi
- rm "${chroot}/prokit/installing"
+ rm "${root}/prokit/installing"
}
install_find_pkgs()
@@ -83,7 +82,7 @@ install_find_pkgs()
local suite="${2}"
local arch="${3}"
local plat="${4}"
- local chroot="${5}"
+ local root="${5}"
local opkg_conf_fd=
local pkgs_fd=
local opt=
@@ -92,8 +91,8 @@ install_find_pkgs()
local gzip=
local pkgs=
- mkdir -p "${chroot}/etc/opkg" "${chroot}/var/lib/opkg/lists"
- fopen "${chroot}/etc/opkg/opkg.conf" 'w'
+ mkdir -p "${root}/etc/opkg" "${root}/var/lib/opkg/lists"
+ fopen "${root}/etc/opkg/opkg.conf" 'w'
opkg_conf_fd=${FD}
install_deps=
@@ -101,7 +100,7 @@ install_find_pkgs()
install_md5sums=
install_sha256sums=
- fopen "${chroot}/.prokit/packages" 'w'
+ fopen "${root}/.prokit/packages" 'w'
pkgs_fd=${FD}
while read -r opt feed_idx feed; do
@@ -113,9 +112,9 @@ install_find_pkgs()
printf '%s %s %s\n' "${opt}" "${feed_idx}" \
"${feed%/Packages*}" >&${opkg_conf_fd}
feed_download "${feed}" ${gzip} \
- >"${chroot}/var/lib/opkg/lists/${feed_idx}"
+ >"${root}/var/lib/opkg/lists/${feed_idx}"
install_feed_url="${feed%/*}"
- feed_find_pkgs "${chroot}/var/lib/opkg/lists/${feed_idx}" \
+ feed_find_pkgs "${root}/var/lib/opkg/lists/${feed_idx}" \
"$(profile_dep_fields)" profile_include_pkg \
install_deps_cb install_fname_cb \
install_md5sum_cb install_sha256sum_cb \
@@ -129,9 +128,9 @@ install_find_pkgs()
fclose ${opkg_conf_fd}
fclose ${pkgs_fd}
- pkgs="$(resolve_deps "$(cat "${chroot}/.prokit/packages")" \
+ pkgs="$(resolve_deps "$(cat "${root}/.prokit/packages")" \
"${install_deps}" | xargs printf '%s\n' | sort -u)"
- printf '%s\n' "${pkgs}" >"${chroot}/.prokit/packages"
+ printf '%s\n' "${pkgs}" >"${root}/.prokit/packages"
}
install_deps_cb()
@@ -171,7 +170,7 @@ install_sha256sum_cb()
install_get_pkgs()
{
- local chroot="${1}"
+ local root="${1}"
local status_fd=
local pkg=
local fname=
@@ -182,13 +181,13 @@ install_get_pkgs()
local field=
local printed=
- mkdir -p "${chroot}/var/cache/opkg/archives" "${chroot}/tmp/opkg" \
- "${chroot}/var/lib/opkg/info"
+ mkdir -p "${root}/var/cache/opkg/archives" "${root}/tmp/opkg" \
+ "${root}/var/lib/opkg/info"
- fopen "${chroot}/var/lib/opkg/status" 'w'
+ fopen "${root}/var/lib/opkg/status" 'w'
status_fd=${FD}
- for pkg in $(cat "${chroot}/.prokit/packages"); do
+ for pkg in $(cat "${root}/.prokit/packages"); do
info "$(get_msg 'install_downloading_pkg')" "${pkg}"
fname="$(printf '%s\n' "${install_fnames}" | \
sed -n "s/^${pkg} //p")"
@@ -196,27 +195,27 @@ install_get_pkgs()
sed -n "s/^${pkg} //p")"
sha256sum="$(printf '%s\n' "${install_sha256sums}" | \
sed -n "s/^${pkg} //p")"
- ${WGET} -q -O "${chroot}/var/cache/opkg/archives/${fname##*/}" \
+ ${WGET} -q -O "${root}/var/cache/opkg/archives/${fname##*/}" \
"${fname}" || \
error 2 "$(get_msg 'install_downloading_pkg_fail')"
fname="var/cache/opkg/archives/${fname##*/}"
if [ "x${md5sum}" != 'x' ]; then
printf '%s %s\n' \
- "${md5sum}" "${chroot}/${fname}" | \
+ "${md5sum}" "${root}/${fname}" | \
md5sum -c >/dev/null 2>&1 || \
error 2 "$(get_msg 'install_checksum_fail')"
fi
if [ "x${sha256sum}" != 'x' ]; then
printf '%s %s\n' \
- "${sha256sum}" "${chroot}/${fname}" | \
+ "${sha256sum}" "${root}/${fname}" | \
${SHA256SUM} -c >/dev/null 2>&1 || \
error 2 "$(get_msg 'install_checksum_fail')"
fi
info "$(get_msg 'install_unpacking_pkg')" "${pkg}"
- mkdir "${chroot}/tmp/opkg/${pkg}"
+ mkdir "${root}/tmp/opkg/${pkg}"
(
- cd "${chroot}"
+ cd "${root}"
tar -xzOf "${fname}" data.tar.gz \
>"tmp/opkg/${pkg}/data.tar.gz"
tar -xzf "tmp/opkg/${pkg}/data.tar.gz"
@@ -224,17 +223,17 @@ install_get_pkgs()
tar -xzOf "../../../${fname}" control.tar.gz | \
tar -xz
)
- tar -tzf "${chroot}/tmp/opkg/${pkg}/data.tar.gz" | \
- sed 's/^\.//' >"${chroot}/var/lib/opkg/info/${pkg}.list"
- rm -f "${chroot}/tmp/opkg/${pkg}/data.tar.gz"
- for file in "${chroot}/tmp/opkg/${pkg}/"*; do
+ tar -tzf "${root}/tmp/opkg/${pkg}/data.tar.gz" | \
+ sed 's/^\.//' >"${root}/var/lib/opkg/info/${pkg}.list"
+ rm -f "${root}/tmp/opkg/${pkg}/data.tar.gz"
+ for file in "${root}/tmp/opkg/${pkg}/"*; do
mv "${file}" \
- "${chroot}/var/lib/opkg/info/${pkg}.${file##*/}"
+ "${root}/var/lib/opkg/info/${pkg}.${file##*/}"
done
- rmdir "${chroot}/tmp/opkg/${pkg}"
+ rmdir "${root}/tmp/opkg/${pkg}"
# Write status file.
- control="${chroot}/var/lib/opkg/info/${pkg}.control"
+ control="${root}/var/lib/opkg/info/${pkg}.control"
for field in Package Version Depends Recommends Suggests \
Provides Replaces Conflicts; do
grep "^${field}: " "${control}" >&${status_fd}
@@ -243,24 +242,24 @@ install_get_pkgs()
for field in Essential Architecture; do
grep "^${field}: " "${control}" >&${status_fd}
done
- if [ -r "${chroot}/var/lib/opkg/info/${pkg}.conffiles" ]; then
+ if [ -r "${root}/var/lib/opkg/info/${pkg}.conffiles" ]; then
printed=false
while read -r file; do
${printed} || printf 'Conffiles:\n' \
>&${status_fd}
printf ' %s %s\n' "${file}" "$(md5sum \
- "${chroot}/${file}" | cut -d' ' -f1)" \
+ "${root}/${file}" | cut -d' ' -f1)" \
>&${status_fd}
printed=true
- done <"${chroot}/var/lib/opkg/info/${pkg}.conffiles"
+ done <"${root}/var/lib/opkg/info/${pkg}.conffiles"
fi
printf 'Installed-Time: %s\n\n' "$(date '+%s')" >&${status_fd}
- rm -f "${chroot}/${fname}"
+ rm -f "${root}/${fname}"
done
- rm "${chroot}/.prokit/packages"
- rmdir "${chroot}/.prokit"
+ rm "${root}/.prokit/packages"
+ rmdir "${root}/.prokit"
fclose ${status_fd}
}