stockmind / dell-xps-9560-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu and Linux Mint ISO images to let them run smooth on Dell XPS 15 9560.
345 stars 155 forks source link

Add gpuoff service to docker #33

Closed hy9be closed 6 years ago

hy9be commented 6 years ago

Addressing issue: https://github.com/stockmind/dell-xps-9560-ubuntu-respin/issues/32

ecomaikgolf commented 6 years ago

$ cat Dockerfile

FROM ubuntu:17.10

MAINTAINER Simone Roberto Nunzi "simone.roberto.nunzi@gmail.com"

# Install required software
RUN apt-get update && apt-get install -y build-essential sudo git wget zip genisoimage bc squashfs-tools xorriso tar klibc-utils iproute2 dosfstools rsync unzip findutils iputils-ping grep

# Download isorespin script
RUN wget -O isorespin.sh "https://drive.google.com/uc?export=download&id=0B99O3A0dDe67S053UE8zN3NwM2c"

RUN mkdir /docker-input
RUN mkdir /docker-output
RUN mkdir /services

COPY ./docker-entrypoint.sh /
COPY ./build.sh /
COPY ./wrapper-network.sh /
COPY ./wrapper-nvidia.sh /
COPY ./services/gpuoff.service /services/

RUN chmod +x docker-entrypoint.sh
RUN chmod +x build.sh
RUN chmod +x wrapper-network.sh
RUN chmod +x wrapper-nvidia.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

$ sudo ./docker-build-image.sh

Sending build context to Docker daemon  259.6kB
Step 1/17 : FROM ubuntu:17.10
 ---> e211a66937c6
Step 2/17 : MAINTAINER Simone Roberto Nunzi "simone.roberto.nunzi@gmail.com"
 ---> Using cache
 ---> 6f9717ef55c0
Step 3/17 : RUN apt-get update && apt-get install -y build-essential sudo git wget zip genisoimage bc squashfs-tools xorriso tar klibc-utils iproute2 dosfstools rsync unzip findutils iputils-ping grep
 ---> Using cache
 ---> 912a818830a8
Step 4/17 : RUN wget -O isorespin.sh "https://drive.google.com/uc?export=download&id=0B99O3A0dDe67S053UE8zN3NwM2c"
 ---> Using cache
 ---> 52e773dd11a1
Step 5/17 : RUN mkdir /docker-input
 ---> Using cache
 ---> 6886e5ecc68e
Step 6/17 : RUN mkdir /docker-output
 ---> Using cache
 ---> b5050a802a77
Step 7/17 : RUN mkdir /services
 ---> Using cache
 ---> e79dfde3dbb0
Step 8/17 : COPY ./docker-entrypoint.sh /
 ---> Using cache
 ---> 0b5f6dae86b5
Step 9/17 : COPY ./build.sh /
 ---> Using cache
 ---> d522a9c2c6e4
Step 10/17 : COPY ./wrapper-network.sh /
 ---> Using cache
 ---> ebbd5c55e782
Step 11/17 : COPY ./wrapper-nvidia.sh /
 ---> Using cache
 ---> 3bd0b37f347e
Step 12/17 : COPY ./services/gpuoff.service /services/
 ---> Using cache
 ---> 806dabbe8b7e
Step 13/17 : RUN chmod +x docker-entrypoint.sh
 ---> Using cache
 ---> 9ad973e41467
Step 14/17 : RUN chmod +x build.sh
 ---> Using cache
 ---> a75609344b80
Step 15/17 : RUN chmod +x wrapper-network.sh
 ---> Using cache
 ---> 69744cd71ea2
Step 16/17 : RUN chmod +x wrapper-nvidia.sh
 ---> Using cache
 ---> 4ec67036d7d4
Step 17/17 : ENTRYPOINT ["/docker-entrypoint.sh"]
 ---> Using cache
 ---> d908476783ce
Successfully built d908476783ce
Successfully tagged dell-xps-9560-ubuntu-respin:latest

$ sudo ./docker-respin.sh origin/ubuntu-16.04.5-desktop-amd64.iso

Found Docker Hub image!
Iso: ubuntu-16.04.5-desktop-amd64.iso
Input dir: /media/ecomaikgolf/HDD/Programas/dell-xps-9560-ubuntu-respin/origin
Output dir: /media/ecomaikgolf/HDD/Programas/dell-xps-9560-ubuntu-respin/destination
5d830f31e8ea
default via 172.17.0.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.2
Gateway: 172.17.0.1
Internet test passed.
Images found in folder:
readme.md  ubuntu-16.04.5-desktop-amd64.iso
Starting process...
No special arguments...
./isorespin.sh: File 'services/gpuoff.service' not found.
ecomaikgolf commented 6 years ago

Oh! It was using the DockerHub image and not the Local Image.

Edited docker-respin.sh to force using local image.

#!/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

if $(docker image inspect dell-xps-9560-ubuntu-respin >/dev/null 2>&1); then
    echo "Found local image!"
    IMAGENAME="dell-xps-9560-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=dell-xps-9560-ubuntu-respin-container)
# Run command
docker run -t --cap-add MKNOD -v "$INPUTDIR":/docker-input -v "$OUTPUTDIR":/docker-output --privileged --name dell-xps-9560-ubuntu-respin-container "$IMAGENAME" respin $ISO "${@:2}"