diff options
-rwxr-xr-x | miniprokit.sh | 55 |
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 } |