From 7133b7dd35f7cdfab6caf2af37581c4c6f5d9188 Mon Sep 17 00:00:00 2001 From: Zaoqi Date: Mon, 12 Aug 2019 22:17:38 +0800 Subject: [PATCH] Update run.sh --- run.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/run.sh b/run.sh index edd0b8c..8ea9890 100644 --- a/run.sh +++ b/run.sh @@ -3,8 +3,8 @@ xhost + &>/dev/null set -e echo -e "[\033[32m\033[5m+\033[0m]Cloning speed may be slow, please waitting..." DIR="deepin-wine-ubuntu" -[ -d $DIR ] && rm -rf $DIR -git clone https://github.com/wszqkzqk/${DIR}.git +[ -d "$DIR" ] && rm -rf "$DIR" +git clone --depth 1 "https://github.com/wszqkzqk/${DIR}.git" ##########build docker image if sudo docker build -t docker-wine-linux ./; then sed -i '4,14s/^/#&/g' $0 @@ -14,10 +14,10 @@ else fi #########create docker container function CREATE() { -mkdir -p $(pwd)/APP_PATH -if sudo docker run -d -ti -v $(pwd)/APP_PATH:/root -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -e GDK_SCALE -e GDK_DPI_SCALE \ - --name docker-wine-$RANDOM docker-wine-linux /bin/bash|awk '{print substr($0,1,3)}'|tee docker.id &>/dev/null; then - dockerid=$(cat docker.id) +mkdir -p "$(pwd)/APP_PATH" +if sudo docker run -d -ti -v "$(pwd)/APP_PATH:/root" -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=unix$DISPLAY" -e GDK_SCALE -e GDK_DPI_SCALE \ + --name "docker-wine-$RANDOM" docker-wine-linux /bin/bash|awk '{print substr($0,1,3)}'|tee docker.id &>/dev/null; then + dockerid="$(cat docker.id)" return 0 else printf "create container error,exit process\n" @@ -25,10 +25,10 @@ else fi } CREATE -code=$? +code="$?" if [ "$code" == "0" ]; then awk 'BEGIN{printf "Your container id is ";system("cat docker.id && echo");system("echo -n [\033[32m\033[5m+\033[0m]");\ - printf "Run [source start.sh -i '" $dockerid "'";printf "TIM] to run TIM or another APP\n"}' + printf "Run [source start.sh -i '$dockerid'";printf "TIM] to run TIM or another APP\n"}' echo echo "Exec 'bash start.sh --help' for more information." shred -f -u -v -z docker.id >/dev/null 2>&1