diff options
Diffstat (limited to 'scripts/lib/ptxd_make_world_clean.sh')
-rw-r--r-- | scripts/lib/ptxd_make_world_clean.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/scripts/lib/ptxd_make_world_clean.sh b/scripts/lib/ptxd_make_world_clean.sh index 2fc8170e7..3d64881d3 100644 --- a/scripts/lib/ptxd_make_world_clean.sh +++ b/scripts/lib/ptxd_make_world_clean.sh @@ -17,11 +17,13 @@ ptxd_make_world_clean_sysroot() { local -a args echo "Removing files from sysroot..." echo - find "${path}/" ! -type d -printf "${pkg_sysroot_dir}/%P\0" | \ + args=( bin sbin lib ) + args=( ${args[@]/#/-o -path ${path}/} ) + find "${path}/" ! -type d ! \( "${args[@]:1}" \) -printf "${pkg_sysroot_dir}/%P\0" | \ xargs -0 rm -f args=( {/etc,{,/usr}{,/lib,/{,s}bin,/include,/share{,/man{,/man{1,2,3,4,5,6,7,8,9}},/misc}}} ) - args=( ${args[@]/#/-o -path ${path}} ) + args=( ${args[@]/#/-o -path ${path}/} ) find "${path}/" -mindepth 1 -depth -type d ! \( "${args[@]:1}" \) -printf "${pkg_sysroot_dir}/%P\0" | \ xargs -0 rmdir --ignore-fail-on-non-empty 2> /dev/null @@ -32,6 +34,27 @@ ptxd_make_world_clean_sysroot() { } export -f ptxd_make_world_clean_sysroot +ptxd_make_world_image_clean_impl() { + local pkg_image_stamp="${ptx_state_dir}/${pkg_label}.images" + + if [ -e "${pkg_image_stamp}" ]; then + echo "Deleting images:" + while read file; do + echo "${file}" + rm "${file}" || break + done < "${pkg_image_stamp}" + rm "${pkg_image_stamp}" + echo + fi +} +export -f ptxd_make_world_image_clean_impl + +ptxd_make_world_image_clean() { + ptxd_make_world_init && + ptxd_make_world_image_clean_impl +} +export -f ptxd_make_world_image_clean + # # clean # @@ -46,6 +69,7 @@ ptxd_make_world_clean() { done echo fi + ptxd_make_world_image_clean_impl if [ -n "$(ls "${ptx_state_dir}/${pkg_label}".* 2> /dev/null)" ]; then echo "Deleting stage files:" if [ -e "${pkg_xpkg_map}" ]; then |