-
Notifications
You must be signed in to change notification settings - Fork 9
/
generate-deb.sh
executable file
·70 lines (57 loc) · 1.87 KB
/
generate-deb.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# this script generates a debian/ubuntu package with dkms support
#remove old directory
if [ -d debpack ]; then
rm -r debpack
fi
#copy template
cp -r debpack_template debpack
#set revision
if [ -z "$1" ]; then
REVISION=$(git log -1 --date=short --pretty=format:%cd)
else
REVISION=$1
fi
echo $REVISION
sed -i "s/###VERSION###/$REVISION/g" debpack/DEBIAN/*
sed -i "s/###VERSION###/$REVISION/g" debpack/usr/src/x86_adapt_defs-template/dkms.conf
sed -i "s/###VERSION###/$REVISION/g" debpack/usr/src/x86_adapt_driver-template/*
#create uncore knobs
cd definition_driver/knobs
./write_uncore_pmc_definitions.py
cd -
## x86_adapt_defs
#create definitions driver source
./definition_driver/prepare.py debpack/usr/src/x86_adapt_defs-template/src definition_driver/
#copy header
cp --parents definition_driver/x86_adapt_defs.h debpack/usr/src/x86_adapt_defs-template/
## x86_adapt_driver
#copy files
cp -r driver/. debpack/usr/src/x86_adapt_driver-template/src
# TODO: maybe change make file
./definition_driver/prepare.py debpack/usr/src/x86_adapt_driver-template/definition_driver definition_driver/
cp --parents definition_driver/x86_adapt_defs.h debpack/usr/src/x86_adapt_driver-template/
#building libs and example programs
mkdir build
cd build
cmake ..
make
cd -
#copy programs
mkdir -p debpack/usr/bin
cp build/x86a_read debpack/usr/bin
cp build/x86a_write debpack/usr/bin
mkdir -p debpack/usr/include
cp library/include/x86_adapt.h debpack/usr/include
mkdir -p debpack/usr/share
cp -r library/doc/man debpack/usr/share
#copy libs
mkdir -p debpack/usr/lib
cp build/libx86_adapt* debpack/usr/lib
#remove build directory
rm -r build
#rename dkms directory
mv debpack/usr/src/x86_adapt_defs-template/ debpack/usr/src/x86_adapt_defs-$REVISION
mv debpack/usr/src/x86_adapt_driver-template/ debpack/usr/src/x86_adapt_driver-$REVISION
#build deb
dpkg -b ./debpack x86_adapt_driver.deb