From 7eb821dcc3145d5f3f39075327f0cf2804526480 Mon Sep 17 00:00:00 2001 From: sickcodes Date: Sun, 7 Feb 2021 19:25:59 +0000 Subject: [PATCH] Add -e NOPICKER=false for the :naked image to be able to enter boot menu. --- CHANGELOG.md | 1 + Dockerfile.naked | 37 ++++++++++++++++++++++++------------- README.md | 16 +++++++++++++++- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f3d60e..5b9b64c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ |Version|Date|Notes| |---|---|---| +| |2021-02-07|Add NOPICKER environment variable to :naked image for effortless boot toggling.| | |2021-02-07|Add MAC_ADDRESS environment variable.| | |2021-02-03|Employ wget --no-verbose to avoid buffer overload in hub.docker.com.| | |2021-02-03|Reduce build size.| diff --git a/Dockerfile.naked b/Dockerfile.naked index 9966c33..feae2b4 100644 --- a/Dockerfile.naked +++ b/Dockerfile.naked @@ -55,15 +55,25 @@ RUN if [[ "${RANKMIRRORS}" ]]; then { pacman -Sy wget --noconfirm || pacman -Syu && tee -a /etc/pacman.d/mirrorlist <<< 'Server = https://mirror.rackspace.com/archlinux/$repo/os/$arch' \ && cat /etc/pacman.d/mirrorlist ; fi -RUN pacman -Syu xorg-server-xvfb xterm xorg-xhost xorg-xrandr xdotool sshpass scrot base-devel --noconfirm +# For taking screenshots of the Xfvb screen, useful during development. +ARG SCROT -RUN git clone https://github.com/stolk/imcat.git \ - && cd imcat \ - && make \ - && sudo cp imcat /usr/bin/imcat \ - && touch /usr/bin/scrotcat \ - && tee -a /usr/bin/scrotcat <<< '/usr/bin/imcat <(scrot -o /dev/stdout)' \ - && chmod +x /usr/bin/scrotcat +RUN pacman -Syu xorg-server-xvfb wget xterm xorg-xhost xorg-xrandr sshpass --noconfirm \ + && if [[ "${SCROT}" ]]; then \ + pacman -Syu scrot base-devel --noconfirm \ + && git clone https://github.com/stolk/imcat.git \ + && cd imcat \ + && make \ + && sudo cp imcat /usr/bin/imcat \ + && touch /usr/bin/scrotcat \ + && tee -a /usr/bin/scrotcat <<< '/usr/bin/imcat <(scrot -o /dev/stdout)' \ + && chmod +x /usr/bin/scrotcat \ + ; else \ + touch /usr/bin/scrotcat \ + && echo echo >> /usr/bin/scrotcat \ + && chmod +x /usr/bin/scrotcat \ + ; fi \ + ; yes | pacman -Scc USER arch @@ -79,16 +89,17 @@ RUN mkdir -p ~/.ssh \ WORKDIR /home/arch/OSX-KVM -ARG NOPICKER=true - -RUN [[ "${NOPICKER}" = true ]] && mv ./Launch-nopicker.sh ./Launch.sh +ENV NOPICKER=true ENV DISPLAY=:99 ENV IMAGE_PATH=/image -CMD [[ "${DISPLAY}" = ':99' ]] && { nohup Xvfb :99 -screen 0 1920x1080x16 \ - & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done ; } \ +CMD [[ "${DISPLAY}" = ':99' ]] && { \ + nohup Xvfb :99 -screen 0 1920x1080x16 \ + & until [[ "$(xrandr --query 2>/dev/null)" ]]; do sleep 1 ; done \ + ; } \ ; sudo chown "$(id -u)":"$(id -g)" "${IMAGE_PATH}" 2>/dev/null || true \ ; ./enable-ssh.sh \ + ; [[ "${NOPICKER}" == true ]] && mv ./Launch-nopicker.sh ./Launch.sh \ ; envsubst < ./Launch.sh | bash diff --git a/README.md b/README.md index 8134bbd..57ad3fc 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,10 @@ docker start -i containerid # Quick Start Own Image -Supply your image with `-v "${PWD}/mac_hdd_ng.img:/image"` and use `sickcodes/docker-osx:naked` +Supply your own local image with `-v "${PWD}/mac_hdd_ng.img:/image"` and use `sickcodes/docker-osx:naked` + +- Naked image is for booting any existing .img file. +- By default, this image has a variable called `NOPICKER` which is `"true"`. Use `-e NOPICKER=false` or any other string than the word `true` to enter the boot menu. This lets you use other disks instead of skipping the boot menu, e.g. recovery disk. ```bash docker pull sickcodes/docker-osx:naked @@ -124,6 +127,17 @@ docker run -it \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:naked + +# run local copy of the auto image + SSH + Boot menu +docker run -it \ + --device /dev/kvm \ + -p 50922:10022 \ + -v "${PWD}/mac_hdd_ng_auto.img:/image" \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e "DISPLAY=${DISPLAY:-:0.0}" \ + -e "NOPICKER=false" \ + sickcodes/docker-osx:naked + ``` ```bash # run your own image headless + SSH