xref: /freebsd/sys/contrib/dev/acpica/acpica_prep.sh (revision 4b2eaea43fec8e8792be611dea204071a10b655a)
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="common compiler generate"
18stripfiles="osunixxf.c Makefile adisasm.h acdos16.h\
19    acintel.h aclinux.h acmsvc.h acwin.h acwin64.h"
20
21# pre-clean
22echo pre-clean
23rm -rf ${wrk}
24rm -rf ${dst}
25mkdir -p ${wrk}
26mkdir -p ${dst}
27
28# fetch document
29echo fetch document
30fetch http://developer.intel.com/technology/iapc/acpi/downloads/CHANGES.txt
31tr -d '\r' < CHANGES.txt > CHANGES.txt.tmp
32mv CHANGES.txt.tmp CHANGES.txt
33
34# unpack
35echo unpack
36tar -x -z -f ${src} -C ${wrk}
37
38# strip files
39echo strip
40for i in ${stripdirs}; do
41    find ${wrk} -name ${i} -type d | xargs rm -r
42done
43for i in ${stripfiles}; do
44    find ${wrk} -name ${i} -type f -delete
45done
46
47# move files to destination
48echo copy
49find ${wrk} -type f | xargs -J % mv % ${dst}
50mv CHANGES.txt ${dst}
51
52# post-clean
53echo post-clean
54rm -rf ${wrk}
55