-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathdocker-build-kernel.sh
More file actions
executable file
·33 lines (28 loc) · 1.04 KB
/
docker-build-kernel.sh
File metadata and controls
executable file
·33 lines (28 loc) · 1.04 KB
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
#!/bin/bash
# Find current directory
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
INPUTDIR="$SCRIPTPATH""/origin"
OUTPUTDIR="$SCRIPTPATH""/destination"
PAR1=$1
echo "Input dir: $INPUTDIR"
echo "Output dir: $OUTPUTDIR"
if $(docker image inspect gpd-pocket-ubuntu-respin:latest >/dev/null 2>&1); then
echo "Found local image!"
IMAGENAME="gpd-pocket-ubuntu-respin"
elif $(docker image inspect stockmind/gpd-pocket-ubuntu-respin:latest >/dev/null 2>&1); then
echo "Found Docker Hub image!"
IMAGENAME="stockmind/gpd-pocket-ubuntu-respin"
else
echo "Build docker image or download it from Docker Hub!"
exit 1
fi
# If no arg specified we use the custom kernel config provided in this repository
if [ "$1" != 'keepconfig' ]; then
cp "$SCRIPTPATH"/kernel/.config "$INPUTDIR"/.config
else
rm "$INPUTDIR"/.config
fi
# Refresh container
docker rm $(docker ps -aq --filter name=gpd-pocket-kernel-container)
# Run command
docker run --rm -t -v "$INPUTDIR":/docker-input -v "$OUTPUTDIR":/docker-output --name gpd-pocket-kernel-container "$IMAGENAME" kernel "$PAR1"