images can be also persistent

This commit is contained in:
Ville Rantanen
2017-06-22 09:15:24 +03:00
parent a5ac6f0224
commit ecf0ffdbc2

View File

@@ -6,6 +6,7 @@ function helpexit() {
echo " --vnc Start VNC viewer"
echo " --geometry WxY VNC Default screen size"
echo " --new-passwd Generate new random VNC password file"
echo " --persistent Do not remove container at exit"
echo " --help This help"
exit
}
@@ -16,13 +17,14 @@ function rsagen() {
rm -f .id_rsa .id_rsa.pub
ssh-keygen -t rsa -b 1024 -N "" -f .id_rsa
}
RMIMAGE="--rm"
for (( i=1; i<=$#; i++ )); do
j=$(( $i + 1 ))
[[ "${!i}" = "--help" ]] && helpexit
[[ "${!i}" = "-h" ]] && helpexit
[[ "${!i}" = "--vnc" ]] && { VNC=1; continue; }
[[ "${!i}" = "--new-passwd" ]] && { pwgen; continue; }
[[ "${!i}" = "--persistent" ]] && { RMIMAGE=""; continue; }
[[ "${!i}" = "--geometry" ]] && {
VNCSIZE="-geometry ${!j}";
[[ "$VNCSIZE" = *x* ]] || {
@@ -57,7 +59,7 @@ echo $image
docker build -t $image .
nname=$image$$
docker run --rm -v /mnt:/mnt -v /media:/media -v $HOME/:/host_home \
docker run $RMIMAGE -v /mnt:/mnt -v /media:/media -v $HOME/:/host_home \
--privileged \
-h $nname --name $nname $image \
bash /bootstuff.sh $USER &