summaryrefslogtreecommitdiffstats
path: root/scripts/lib/ptxd_make_world_clean.sh
blob: f173ac1dbae04b0c412f67077c2937e125dde170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Copyright (C) 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# clean
#
ptxd_make_world_clean() {
    ptxd_make_world_init &&

    if [ -f "${ptx_state_dir}/${pkg_label}.xpkg.map" ]; then
	echo "Deleting ipks:"
	for name in $(cat "${ptx_state_dir}/${pkg_label}.xpkg.map" 2>/dev/null); do
	    ls "${ptx_pkg_dir}/${name}"_*.ipk
	    rm -f "${ptx_pkg_dir}/${name}"_*.ipk
	done
	echo
    fi
    if [ -n "$(ls "${ptx_state_dir}/${pkg_label}".* 2> /dev/null)" ]; then
	echo "Deleting stage files:"
	ls "${ptx_state_dir}/${pkg_label}".*
	rm -f "${ptx_state_dir}/${pkg_label}".*
	echo
    fi
    if [ -d "${pkg_dir}" ]; then
	echo "Deleting src dir:"
	echo "${pkg_dir}"
	rm -rf "${pkg_dir}"
	echo
    fi
    if [ -d "${pkg_build_dir}" ]; then
	echo "Deleting build dir:"
	echo "${pkg_build_dir}"
	rm -rf "${pkg_build_dir}"
	echo
    fi
    if [ -d "${pkg_pkg_dir}" ]; then
	echo "Deleting pkg dir:"
	echo "${pkg_pkg_dir}"
	rm -rf "${pkg_pkg_dir}"
	echo
    fi
}
export -f ptxd_make_world_clean