From c3a55684115322f4f99359c3dcf8c79ba2ee872a Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 27 May 2018 03:22:33 -0400 Subject: bugfix cache stash --- parabolaiso/mkparabolaiso | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) (limited to 'parabolaiso/mkparabolaiso') diff --git a/parabolaiso/mkparabolaiso b/parabolaiso/mkparabolaiso index 1843594..deec844 100755 --- a/parabolaiso/mkparabolaiso +++ b/parabolaiso/mkparabolaiso @@ -255,7 +255,7 @@ _pacman () _msg_info "Packages installed successfully!" } -# Cache uninstalled packages in offline /isorepo and prune obsolete packages. +# Cache uninstalled packages in offline /isorepo and prune unused packages. _pacman_cache () { _msg_info "Caching packages to '${work_dir}/root-image/'..." @@ -264,27 +264,27 @@ _pacman_cache () local _package_files=$(pacman -S --root "${work_dir}/root-image" --config "${pacman_conf}" --print $* | sed "s|.*\/\(.*\)|\1|") - # stash any existing interesting uninstalled packages - pushd "${work_dir}/root-image/isorepo/" > /dev/null - mkdir -p ../isorepo-uninstalled &> /dev/null - mv ${_package_files} ../isorepo-uninstalled/ &> /dev/null || true - popd > /dev/null + if [[ "${_package_files}" ]]; then + # stash any existing interesting uninstalled packages + pushd "${work_dir}/root-image/isorepo/" > /dev/null + mkdir -p ../isorepo-uninstalled &> /dev/null + mv ${_package_files} ../isorepo-uninstalled/ &> /dev/null || true + popd > /dev/null - # remove any remaining obsolete packages - if [[ "${quiet}" = "y" ]]; then - pacman -Sc --root "${work_dir}/root-image" --config "${pacman_conf}" --noconfirm &> /dev/null - else - pacman -Sc --root "${work_dir}/root-image" --config "${pacman_conf}" --noconfirm - fi + # remove any remaining obsolete or rogue packages + if [[ "${quiet}" = "y" ]]; then + pacman -Sc --root "${work_dir}/root-image" --config "${pacman_conf}" --noconfirm &> /dev/null + else + pacman -Sc --root "${work_dir}/root-image" --config "${pacman_conf}" --noconfirm + fi - # restore interesting uninstalled packages - pushd "${work_dir}/root-image/isorepo/" > /dev/null - mv ../isorepo-uninstalled/* . &> /dev/null || true - rmdir ../isorepo-uninstalled &> /dev/null - popd > /dev/null + # restore interesting uninstalled packages + pushd "${work_dir}/root-image/isorepo/" > /dev/null + mv ../isorepo-uninstalled/* . &> /dev/null || true + rmdir ../isorepo-uninstalled &> /dev/null + popd > /dev/null - # download any missing packages - if [[ "${_package_files}" ]]; then + # download any missing packages if [[ "${quiet}" = "y" ]]; then pacman -Sw --root "${work_dir}/root-image" --config "${pacman_conf}" --noconfirm $* &> /dev/null else @@ -596,11 +596,6 @@ command_cache () { #trim spaces pkg_list="$(echo ${pkg_list})" - if [[ -z ${pkg_list} ]]; then - _msg_error "Packages must be specified" 0 - _usage 1 - fi - _show_config cache _pacman_cache "${pkg_list}" } -- cgit v1.2.2