xref: /libbtbb/cmake/cleanup.sh (revision daba235ba8e80ca638d121d598a5a1cea1804a00)
1#!/bin/bash
2
3# A quick and dirty script to remove old installs of
4# libbtbb, libubertooth and associated Ubertooth tools
5# Copyright 2014 Dominic Spill
6# License: GPL v2
7
8FIND=`which find`
9
10INSTALL_DIRS="/usr /usr/local"
11
12LIBS="btbb ubertooth"
13
14HEADERS="bluetooth_packet.h \
15         bluetooth_piconet.h \
16         bluetooth_le_packet.h \
17         ubertooth_interface.h \
18         ubertooth_control.h \
19         ubertooth.h \
20		 "
21
22if [ "$1" == "-d" ]
23then
24	EXEC="-print -exec rm -f {} ;"
25	echo "Deleting previous installs:"
26else
27	EXEC=-print
28	echo 'Installed files, use "sudo cleanup.sh -d" to delete these files'
29fi
30
31for dir in $INSTALL_DIRS; do
32	for lib in $LIBS; do
33		$FIND ${dir}/lib -maxdepth 1 -name "lib$lib.so*" $EXEC
34	done
35	for header in $HEADERS; do
36		$FIND ${dir}/include -maxdepth 1 -name "$header" $EXEC
37	done
38	$FIND ${dir}/bin -maxdepth 1 -name "ubertooth-*" $EXEC
39done
40