summaryrefslogtreecommitdiff
path: root/tools/sync-with-kernel-headers.sh
blob: b80e4501ef5258760faba9147bc870b63c8f9198 (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
#!/bin/sh
#
# Syncs the repository with the input.h and input-event-codes.h headers from
# a checked out source directory.
#
# Usage:
#    sync-with-kernel-headers.sh path/to/kernel v4.12

KERNEL_TREE="$1"
GIT_DIR="$KERNEL_TREE/.git"
TAG="$2"

export GIT_DIR

if [ -z "$TAG" ] || ! [ -d "$GIT_DIR" ]; then
	echo "Usage: `basename $0` path/to/kernel tag"
	exit 1
fi
if ! [ -d .git ]; then
	echo "Run me from the top-level git tree"
	exit 1
fi


file="linux/input.h"
git cat-file -p "$TAG:include/uapi/$file" > "include/linux/linux/$(basename $file)"

file="linux/input-event-codes.h"
git cat-file -p "$TAG:include/uapi/$file" > "include/linux/linux/$(basename $file)"
git cat-file -p "$TAG:include/uapi/$file" > "include/linux/freebsd/$(basename $file)"