summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-06-08 14:12:43 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-06-08 14:12:43 (EDT)
commit952f42e0b5b623e69efa09af0690c07349149232 (patch)
tree45f5146cd8418158afdfc6cb92b96b85d3fc0aa0
parent317c6abf335c17e4dc4e1fc5db39647e75ab345d (diff)
miniprokit.sh: Move status writing to get_pkg().
-rwxr-xr-xminiprokit.sh55
1 files changed, 27 insertions, 28 deletions
diff --git a/miniprokit.sh b/miniprokit.sh
index 6c146d7..5e8e356 100755
--- a/miniprokit.sh
+++ b/miniprokit.sh
@@ -217,6 +217,9 @@ get_pkg()
local filename="${4}"
local sha256sum="${5}"
local file=
+ local control=
+ local field=
+ local printed=
info 'Downloading %s...' "${package}"
filename="${filename#../../../../../../}"
@@ -245,6 +248,30 @@ get_pkg()
>"${root}/var/lib/opkg/info/${package}.list"
rm -f "${root}/tmp/opkg/${package}/data.tar.gz"
rmdir "${root}/tmp/opkg/${package}"
+
+ # Write status file.
+ exec 3>>"${root}/var/lib/opkg/status"
+ control="${root}/var/lib/opkg/info/${package}.control"
+ for field in Package Version Depends Recommends Suggests \
+ Provides Replaces Conflicts; do
+ grep "^${field}: " "${control}" >&3
+ done
+ printf 'Status: install ok unpacked\n' >&3
+ for field in Essential Architecture; do
+ grep "^${field}: " "${control}" >&3
+ done
+ if [ -r "${root}/var/lib/opkg/info/${package}.conffiles" ]; then
+ printed=false
+ while read -r file; do
+ ${printed} || printf 'Conffiles:\n' >&3
+ printf ' %s %s\n' "${file}" "$(md5sum \
+ "${root}/${file}" | cut -d ' ' -f 1)" \
+ >&3
+ printed=true
+ done <"${root}/var/lib/opkg/info/${package}.conffiles"
+ fi
+ printf 'Installed-Time: %s\n\n' "$(date '+%s')" >&3
+ exec 3>&-
}
configure_pkgs()
@@ -253,10 +280,6 @@ configure_pkgs()
local opk=
local pkg=
local script=
- local control=
- local field=
- local printed=
- local file=
for opk in "${root}/var/cache/opkg/archives/"*.opk; do
pkg="${opk##*/}"
@@ -271,30 +294,6 @@ configure_pkgs()
configure
fi
done
-
- # Write status file.
- exec 3>>"${root}/var/lib/opkg/status"
- control="${root}/var/lib/opkg/info/${pkg}.control"
- for field in Package Version Depends Recommends Suggests \
- Provides Replaces Conflicts; do
- grep "^${field}: " "${control}" >&3
- done
- printf 'Status: install ok installed\n' >&3
- for field in Essential Architecture; do
- grep "^${field}: " "${control}" >&3
- done
- if [ -r "${root}/var/lib/opkg/info/${pkg}.conffiles" ]; then
- printed=false
- while read -r file; do
- ${printed} || printf 'Conffiles:\n' >&3
- printf ' %s %s\n' "${file}" "$(md5sum \
- "${root}/${file}" | cut -d ' ' -f 1)" \
- >&3
- printed=true
- done <"${root}/var/lib/opkg/info/${pkg}.conffiles"
- fi
- printf 'Installed-Time: %s\n\n' "$(date '+%s')" >&3
- exec 3>&-
done
}