From 54967730c526da075d723354a5de9bc54b9c21f1 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 21 Aug 2014 08:04:05 -0400 Subject: install: Write status file --- diff --git a/lib/cmd/install.sh b/lib/cmd/install.sh index 696f24c..9b90fff 100644 --- a/lib/cmd/install.sh +++ b/lib/cmd/install.sh @@ -160,13 +160,20 @@ cmd_install_fname_cb() cmd_install_get_pkgs() { local chroot="${1}" + local status_fd= local pkg= local fname= local file= + local control= + local field= + local printed= mkdir -p "${chroot}/var/cache/opkg/archives" "${chroot}/tmp/opkg" \ "${chroot}/var/lib/opkg/info" + fopen "${chroot}/var/lib/opkg/status" 'w' + status_fd=${FD} + for pkg in $(cat "${chroot}/.prokit/packages"); do info "$(get_msg 'cmd_install_downloading_pkg')" "${pkg}" fname="$(printf '%s\n' "${cmd_install_fnames}" | \ @@ -195,5 +202,32 @@ cmd_install_get_pkgs() "${chroot}/var/lib/opkg/info/${pkg}.${file##*/}" done rmdir "${chroot}/tmp/opkg/${pkg}" + + # Write status file. + control="${chroot}/var/lib/opkg/info/${pkg}.control" + for field in Package Version Depends Recommends Suggests \ + Provides Replaces Conflicts; do + grep "^${field}: " "${control}" >&${status_fd} + done + printf 'Status: install ok unpacked\n' >&${status_fd} + for field in Essential Architecture; do + grep "^${field}: " "${control}" >&${status_fd} + done + if [ -r "${chroot}/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)" \ + >&${status_fd} + printed=true + done <"${chroot}/var/lib/opkg/info/${pkg}.conffiles" + fi + printf 'Installed-Time: %s\n\n' "$(date '+%s')" >&${status_fd} + + rm -f "${chroot}/${fname}" done + + fclose ${status_fd} } -- cgit v0.9.1