xref: /freebsd/sys/contrib/dev/acpica/acpica_prep.sh (revision 09e8dea79366f1e5b3a73e8a271b26e4b6bf2e6a)
1#!/bin/sh
2# $FreeBSD$
3#
4# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout
5#
6
7if [ ! $# -eq 1 ]; then
8	echo "usage: $0 acpica_archive"
9	exit
10fi
11
12src=$1
13wrk=./_acpi_ca_unpack
14dst=./acpi_ca_destination
15
16# files to remove
17stripdirs="compiler generate"
18stripfiles="osunixxf.c 16bit.h Makefile a16find.c a16utils.asm a16utils.obj\
19    acintel.h aclinux.h acmsvc.h acwin.h acwin64.h getopt.c"
20
21# pre-clean
22echo pre-clean
23rm -rf ${wrk}
24rm -rf ${dst}
25mkdir -p ${wrk}
26mkdir -p ${dst}
27
28# unpack
29echo unpack
30tar -x -z -f ${src} -C ${wrk}
31
32# strip files
33echo strip
34for i in ${stripdirs}; do
35    find ${wrk} -name ${i} -type d | xargs rm -r
36done
37for i in ${stripfiles}; do
38    find ${wrk} -name ${i} -type f -delete
39done
40
41# move files to destination
42echo copy
43find ${wrk} -type f | xargs -J % mv % ${dst}
44
45# post-clean
46echo post-clean
47rm -rf ${wrk}
48