forked from stockmind/gpd-pocket-ubuntu-respin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-respin.sh
executable file
·29 lines (25 loc) · 982 Bytes
/
docker-respin.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
#!/bin/bash
# Find current directory
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
INPUTDIR="$SCRIPTPATH""/origin"
OUTPUTDIR="$SCRIPTPATH""/destination"
ORIGINDIR="origin/"
ISO=${1#$ORIGINDIR} # Remove 'origin/' prefix path if found
PAR1=$2
if $(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"
elif $(docker image inspect gpd-pocket-ubuntu-respin:latest >/dev/null 2>&1); then
echo "Found local image!"
IMAGENAME="gpd-pocket-ubuntu-respin"
else
echo "Build docker image or download it from Docker Hub!"
exit 1
fi
echo "Iso: $ISO"
echo "Input dir: $INPUTDIR"
echo "Output dir: $OUTPUTDIR"
# Refresh container
docker rm $(docker ps -aq --filter name=gpd-pocket-respin-container)
# Run command
docker run -t --cap-add MKNOD -v "$INPUTDIR":/docker-input -v "$OUTPUTDIR":/docker-output --privileged --name gpd-pocket-respin-container "$IMAGENAME" respin $ISO $PAR1