Skip to content

Commit

Permalink
fix migration issues
Browse files Browse the repository at this point in the history
stabilize pulse startup
add beginning of bootserver in go
  • Loading branch information
oetiker committed Mar 15, 2022
1 parent 2d6914a commit 259cea1
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 19 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*
!overlay
*~
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
image-output
image-export
*~
16 changes: 16 additions & 0 deletions Dockerfile.ipxe
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get update
#RUN yes | unminimize
RUN apt-get install -yq \
build-essential \
git \
liblzma-dev
RUN apt-get -qq clean
RUN cd / && git clone https://github.com/ipxe/ipxe.git
RUN cd ipxe/src && make \
bin-x86_64-pcbios/ipxe.pxe \
bin-x86_64-pcbios/undionly.kpxe \
bin-x86_64-efi/ipxe.efi
8 changes: 6 additions & 2 deletions Dockerfile → Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN wget https://www.cendio.com/downloads/clients/tl-4.14.0-clients.zip && \
rm -rf tl-4.14.0-clients.zip tl-4.14.0-clients
ADD overlay/ /__overlay
RUN cp -r /__overlay/* / && rm -rf /__overlay
RUN update-initramfs -c -k all
RUN update-initramfs -c -v -k all
RUN locale-gen
RUN /bin/rm -f -v /etc/ssh/ssh_host_*_key* && \
systemctl enable regenerate_ssh_host_keys && \
Expand All @@ -58,4 +58,8 @@ RUN passwd -d root
RUN adduser --disabled-password --gecos "ThinUser" tluser
RUN adduser tluser sudo && \
echo "tluser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN adduser tluser audio
RUN adduser tluser audio
# do not autostart pulseaudio ...
RUN sudo -u tluser systemctl --user disable pulseaudio.service
RUN sudo -u tluser systemctl --user disable pulseaudio.socket
# end
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
all:
mkdir -p rrx
docker build --pull -t dbrrg .
docker run --rm -v $$PWD/image-export:/image-export --name dbrrg-export dbrrg /bin/image-export.sh
all: ipxe ubuntu

ubuntu:
docker build --pull -t dbrrg-ubuntu -f Dockerfile.ubuntu .
docker run --rm -v $$PWD/scripts:/scripts -v $$PWD/image-export:/image-export dbrrg-ubuntu /scripts/image-export.sh

ipxe:
docker build --pull -t dbrrg-ipxe -f Dockerfile.ipxe .
docker run --rm -v $$PWD/scripts:/scripts -v $$PWD/image-export:/image-export dbrrg-ipxe /scripts/make-ipxe.sh

server:
docker run --rm -v "$PWD":/app -w /app golang:1.17 go build -v
24 changes: 24 additions & 0 deletions dbrrg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package main

import (
"net/http"
"time"
)

type timeHandler struct {
format string
}

func (th timeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
tm := time.Now().Format(th.format)
w.Write([]byte("The time is: " + tm))
}

func main() {
muxer := http.NewServeMux()
fileServer := http.FileServer(http.Dir("image-export"))
th := timeHandler{format: time.RFC1123}
muxer.Handle("/", fileServer)
muxer.Handle("/ipxe.cfg", th)
http.ListenAndServe(":8080", muxer)
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/oposs/dbrrg

go 1.17
4 changes: 4 additions & 0 deletions overlay/etc/X11/Xsession.d/90x11-sync-tl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ BASE_PATH=$(cat /proc/cmdline | sed -n 's/.*ramroot=\(.*\)\/.*$/\1/p')
MAC_ADDR=$(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address)
BOOT_SRV=$(cat /proc/cmdline | sed -n 's/.*ramroot=http.*\/\/\([^/:]*\).*/\1/p')
# wait for dns to come up
systemctl --user stop pulseaudio.service
systemctl --user stop pulseaudio.socket
systemctl --user disable pulseaudio.service
systemctl --user disable pulseaudio.socket
while true; do
ping -nc 1 $BOOT_SRV && break
sleep 1
Expand Down
10 changes: 6 additions & 4 deletions overlay/etc/initramfs-tools/hooks/dbrrg
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ lib_module /lib 'libc.so.*' 'libnss_files.so.*'
#lib_module /lib 'libc.so.*' 'libresolv.so.*'

# some helper tools for fetching and extracting the ramroot
copy_exec $(which pixz) /bin
copy_exec $(which tar) /bin
copy_exec $(which curl) /bin
copy_exec /bin/pixz
copy_exec /bin/tar
copy_exec /bin/curl

# get the sound drivers
for kmod in $(find "${MODULESDIR}/kernel/sound" -name "*.ko" -print); do
manual_add_modules $(basename ${kmod} .ko)
done
done

# end
14 changes: 7 additions & 7 deletions overlay/etc/initramfs-tools/scripts/dbrrg
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ramdisk filesystem mounting -*- shell-script -*-
# dbrrg filesystem mounting -*- shell-script -*-

ramroot_is_remote()
{
Expand Down Expand Up @@ -48,8 +48,8 @@ ramroot_mount()

mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/ramdisk-top"
run_scripts /scripts/ramdisk-top
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/dbrrg-top"
run_scripts /scripts/dbrrg-top
[ "$quiet" != "y" ] && log_end_msg

# Parse command line options to get ramroot
Expand Down Expand Up @@ -78,8 +78,8 @@ mountroot()
[ "$quiet" != "y" ] && log_end_msg
fi

[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/ramdisk-premount"
run_scripts /scripts/ramdisk-premount
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/dbrrg-premount"
run_scripts /scripts/dbrrg-premount
[ "$quiet" != "y" ] && log_end_msg

[ "$quiet" != "y" ] && log_begin_msg "Installing root filesystem"
Expand All @@ -91,7 +91,7 @@ mountroot()

[ "$quiet" != "y" ] && log_end_msg

[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/ramdisk-bottom"
run_scripts /scripts/ramdisk-bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/dbrrg-bottom"
run_scripts /scripts/dbrrg-bottom
[ "$quiet" != "y" ] && log_end_msg
}
3 changes: 2 additions & 1 deletion overlay/opt/thinlinc/lib/tlclient/pulseaudio
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
unset LD_LIBRARY_PATH
/usr/bin/pulseaudio --kill
exec /usr/bin/pulseaudio -n --use-pid-file=false -L module-udev-detect -L "$2" --log-level=info --fail=false
/usr/bin/pulseaudio --cleanup-shm
exec /usr/bin/pulseaudio -n -L module-udev-detect -L "$2" --log-level=info --fail=false --disallow-exit --exit-idle-time=-1
File renamed without changes.
7 changes: 7 additions & 0 deletions scripts/make-ipxe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
cd /ipxe/src

cp bin-x86_64-pcbios/ipxe.pxe /image-export
cp bin-x86_64-pcbios/undionly.kpxe /image-export
cp bin-x86_64-efi/ipxe.efi /image-export

0 comments on commit 259cea1

Please sign in to comment.