@@ -62,7 +62,7 @@ manifest_main=""
6262log " Package list:"
6363for package in ${packages} ; do
6464 manifest_main=" ${manifest_main}${package} ,"
65- log " - ${package} "
65+ test " ${debug} " == " true " && log " - ${package} "
6666done
6767write_manifest " main" " ${manifest_main} " " ${cache_dir} /manifest_main.log"
6868
@@ -95,7 +95,7 @@ installed_packages=$(get_installed_packages "${install_log_filepath}")
9595log " Installed package list:"
9696for installed_package in ${installed_packages} ; do
9797 # Reformat for human friendly reading.
98- log " - $( echo ${installed_package} | awk -F\= ' {print $1" ("$2")"}' ) "
98+ test " ${debug} " == " true " && log " - $( echo ${installed_package} | awk -F\= ' {print $1" ("$2")"}' ) "
9999done
100100
101101log_empty_line
@@ -108,13 +108,16 @@ for installed_package in ${installed_packages}; do
108108 # Sanity test in case APT enumerates duplicates.
109109 if test ! -f " ${cache_filepath} " ; then
110110 read package_name package_ver < <( get_package_name_ver " ${installed_package} " )
111- log " * Caching ${package_name} to ${cache_filepath} ..."
111+ test " ${debug} " == " true " && log " * Caching ${package_name} to ${cache_filepath} ..."
112112
113+ # Get the entry in /var/lib/dpkg/status
114+ mkdir -p /var/tmp/dpkg-restore || :
115+ sed -n -r -e " /Package:\s+${package_name} $/,/^$/p" /var/lib/dpkg/status > /var/tmp/dpkg-restore/${package_name} .status
116+
113117 # Pipe all package files (no folders), including symlinks, their targets, and installation control data to Tar.
114118 tar -cf " ${cache_filepath} " -C / --verbatim-files-from --files-from <(
115- { dpkg -L " ${package_name} " &&
116- { get_install_script_filepath " /" " ${package_name} " " preinst" ;
117- get_install_script_filepath " /" " ${package_name} " " postinst" ; } ; } |
119+ { dpkg -L " ${package_name} " && echo " /var/tmp/dpkg-restore/${package_name} .status" &&
120+ get_install_script_filepaths " /" " ${package_name} " ; } |
118121 while IFS= read -r f; do
119122 if test -f " ${f} " -o -L " ${f} " ; then
120123 get_tar_relpath " ${f} "
@@ -128,7 +131,7 @@ for installed_package in ${installed_packages}; do
128131 done
129132 )
130133
131- log " done (compressed size $( du -h " ${cache_filepath} " | cut -f1) )."
134+ test " ${debug} " == " true " && log " done (compressed size $( du -h " ${cache_filepath} " | cut -f1) )."
132135 fi
133136
134137 # Comma delimited name:ver pairs in the all packages manifest.
0 commit comments