diff --git a/Dockerfile b/Dockerfile index b64c38f..c899214 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,9 @@ -FROM alpine:latest AS fetcher +FROM i386/alpine:latest AS fetcher ARG CACHE_BUST=10 RUN apk add --no-cache git ca-certificates WORKDIR /src RUN echo "$CACHE_BUST" && git clone --depth 1 --branch retrodebian --single-branch https://gitea.chacha.ddns.net/chacha/glide.git -FROM alpine:latest AS fetcher-cached -RUN apk add --no-cache git ca-certificates -WORKDIR /src -RUN git clone --depth 1 --branch master --single-branch https://gitea.chacha.ddns.net/chacha/UT99-Official.git - # building a modified Kernel + modules + libs FROM lpenz/debian-etch-i386-minbase AS kernel-builder ARG DEBIAN_FRONTEND=noninteractive @@ -121,10 +116,15 @@ RUN /usr/src/buildglidepkg.sh sst1 #WORKDIR /usr/src/ #RUN /usr/src/buildglidepkg.sh sst96 +#RUN rm *.gz *.bz2 && rm -Rf glide && rm -rf /var/lib/apt/lists/* + +FROM i386/alpine:latest AS game-builder +RUN apk add --no-cache git ca-certificates +ARG CACHE_BUST=10 # Package UT99 WORKDIR /root -COPY --from=fetcher-cached /src/UT99-Official ./ut-game -COPY ut-install-436.run ./ +RUN echo "$CACHE_BUST" && git clone --depth 1 --branch master --single-branch https://gitea.chacha.ddns.net/chacha/UT99-Official.git ut-game +COPY games/ut99/ut-install-436.run ./ RUN chmod +x ut-install-436.run && \ ./ut-install-436.run --target ./ut || true && \ tar xzf ./ut/data.tar.gz -C ut-game && \ @@ -136,30 +136,35 @@ RUN chmod +x ut-install-436.run && \ rm ut-game/System/*.dll && \ rm ut-game/System/*.url && \ rm ut-game/System/*.bat && \ + rm ut-game/System/de.* && \ + rm ut-game/System/UnrealTournament.ini && \ + rm ut-game/System/Default.ini && \ + rm ut-game/System/libSDL-1.1.so.0 && \ rm ut-game/Sounds/*est_uax && \ rm ut-game/Sounds/*frt_uax && \ rm ut-game/Sounds/*itt_uax && \ rm ut-game/DoConfig.py && \ rm ut-game/DoConfig.sh && \ rm -Rf ut-game/Web && \ - rm -Rf ut-game/Help/* - - - - - -#RUN rm *.gz *.bz2 && rm -Rf glide && rm -rf /var/lib/apt/lists/* + rm -Rf ut-game/Help/* &&\ + tar xzf ./ut/Glide.ini.tar.gz -C ut-game && \ + mv ut-game/System/UnrealTournament.ini ut-game/System/Default-glide.ini && \ + ls -al ./ut/ && \ + tar xzf ./ut/OpenGL.ini.tar.gz -C ut-game && \ + cp ut-game/System/UnrealTournament.ini ut-game/System/Default.ini && \ + mv ut-game/System/UnrealTournament.ini ut-game/System/Default-opengl.ini # Note: we need to use Lenny because of live-helper # it allows creating Etch live image though ! FROM lpenz/debian-lenny-i386-minbase WORKDIR /root COPY --from=kernel-builder /usr/src/*.deb . -COPY --from=kernel-builder /root/ut-game ./ut-game +COPY --from=game-builder /root/ut-game ./ut-game COPY update-initramfs.sh . COPY zzz-config-live.sh . COPY desktop . COPY wallpaper.jpg . +COPY editions ./editions RUN apt-get update && \ apt-get -y --force-yes install live-helper genisoimage syslinux squashfs-tools aptitude && \ apt-get clean diff --git a/Jenkinsfile b/Jenkinsfile index 38de2f0..1f9c7a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,10 @@ pipeline { --bootstrap debootstrap \ --debconf-frontend noninteractive \ --debian-installer live \ + --bootappend-live "elevator=deadline" \ --hostname RetroDebian \ + --iso-application RetroDebian \ + --syslinux-splash splash.png \ --union-filesystem unionfs \ --username bob \ -k retrodebian1 @@ -62,9 +65,14 @@ pipeline { cp /root/desktop config/chroot_local-packageslists/ mkdir -p config/chroot_local-includes/usr/share/wallpapers cp /root/wallpaper.jpg config/chroot_local-includes/usr/share/wallpapers/retrodebian.jpg + cp /root/editions/voodoo2/splash.png config/binary_syslinux/ + ''' + + sh ''' mkdir -p config/chroot_local-includes/usr/local/games/ut99/ cp -R /root/ut-game/* config/chroot_local-includes/usr/local/games/ut99/ ''' + sh 'lh_build' } dir('root') diff --git a/desktop b/desktop index 0a3eb0a..a0ea3f5 100644 --- a/desktop +++ b/desktop @@ -35,6 +35,8 @@ vim ntp htop libsdl1.2debian +libsdl1.2debian-alsa mesa-utils xmms2 -smbclient \ No newline at end of file +smbclient +libopenal1 diff --git a/editions/voodoo2/splash.png b/editions/voodoo2/splash.png new file mode 100644 index 0000000..085389f Binary files /dev/null and b/editions/voodoo2/splash.png differ diff --git a/games/ut99/ut b/games/ut99/ut new file mode 100644 index 0000000..9a2462e --- /dev/null +++ b/games/ut99/ut @@ -0,0 +1,181 @@ +#!/bin/bash + +GAME_BINARY="ut-bin" +SYSTEM_DIR="System" + +# Additional commandline options for mods etc. +CMD_ARGS="" + +# don't use US keyboard layout +#NOUSLAYOUT="true" + +resolve_link() { + local path target dir + path="$1" + + [ -L "$path" ] || return 1 + + target="$(LC_ALL=C ls -l "$path" 2>/dev/null)" + target="${target##* -> }" + + case "$target" in + /*) printf '%s\n' "$target" ;; + *) + dir="$(dirname "$path")" + printf '%s\n' "$dir/$target" + ;; + esac +} + +LANG=POSIX +export LANG +script="$0" +count=0 +while [ -L "$script" ] +do + script="$(resolve_link "$script")" + count=$((count + 1)) + if [ "$count" -gt 100 ] + then + echo "Too many symbolic links" + exit 1 + fi +done + +GAME_DIR="$(cd "$(dirname "$script")" && pwd)" +GAME_SYSTEM_DIR="${GAME_DIR}/${SYSTEM_DIR}" +USER_UT_DIR="${HOME}/.loki/ut/${SYSTEM_DIR}" +SYSTEM_DEFAULT_GLIDE="${GAME_SYSTEM_DIR}/Default-glide.ini" +SYSTEM_DEFAULT_OPENGL="${GAME_SYSTEM_DIR}/Default-opengl.ini" +SYSTEM_DEFAULT_USER="${GAME_SYSTEM_DIR}/DefUser.ini" +USER_UT_INI="${USER_UT_DIR}/UnrealTournament.ini" +USER_USER_INI="${USER_UT_DIR}/User.ini" + +if [ ! -d "${USER_UT_DIR}" ] +then + mkdir -p "${USER_UT_DIR}" +fi + +detect_renderer() { + if [ -e /usr/lib/libglide2x.so ] || [ -e /usr/local/lib/libglide2x.so ]; then + echo "glide" + else + echo "opengl" + fi +} + +install_ini_profile() { + local renderer="$1" + + case "$renderer" in + glide) + if [ -r "${SYSTEM_DEFAULT_GLIDE}" ]; then + cp -f "${SYSTEM_DEFAULT_GLIDE}" "${USER_UT_INI}" + return 0 + fi + ;; + opengl) + if [ -r "${SYSTEM_DEFAULT_OPENGL}" ]; then + cp -f "${SYSTEM_DEFAULT_OPENGL}" "${USER_UT_INI}" + return 0 + fi + ;; + esac + + return 1 +} + +if [ ! -f "${USER_UT_INI}" ]; then + RENDERER="$(detect_renderer)" + install_ini_profile "${RENDERER}" || { + echo "Failed to install renderer profile: ${RENDERER}" + exit 1 + } + sed -i \ + -e 's/^AudioDevice=ALAudio.ALAudioSubsystem$/AudioDevice=Audio.GenericAudioSubsystem/' \ + -e 's/^CacheSizeMegs=4$/CacheSizeMegs=32/' \ + -e 's/^FullscreenViewportX=640$/FullscreenViewportX=800/' \ + -e 's/^FullscreenViewportY=480$/FullscreenViewportY=600/' \ + -e 's/^UseSpatial=False$/UseSpatial=True/' \ + -e 's/^UseReverb=False$/UseReverb=True/' \ + -e 's/^OutputRate=22050Hz$/OutputRate=44100Hz/' \ + -e 's/^ConfiguredInternetSpeed=20000$/ConfiguredInternetSpeed=25000/' \ + "${USER_UT_INI}" +fi + +# Remove passwords from UnrealTournament.ini +if [ -r "${USER_UT_INI}" ] +then + sed -i \ + -e 's/^\(SavedPasswords\[[0-9]*\]=\).*/\1/' \ + -e 's/^\(PasswordHistory\[[0-9]*\]=\).*/\1/' \ + "${USER_UT_INI}" +fi + + +set_random_ut_name() { + local target_file="$1" + + [ -n "$target_file" ] || return 1 + [ -f "$target_file" ] || return 1 + + local names=' +Phobos +Vortex +Raptor +Hexer +Cobra +Grendel +Nyx +Blitz +Talon +Havoc +Stryker +Wraith +Nova +Reaper +Goliath +Drift +Razor +Pixel +Onyx +Fury +' + + local count=$(printf '%s\n' "$names" | sed '/^$/d' | wc -l) + local idx=$(( (RANDOM % count) + 1 )) + local base_name=$(printf '%s\n' "$names" | sed '/^$/d' | sed -n "${idx}p") + local suffix=$(printf '%02d' $((RANDOM % 100))) + local new_name="${base_name}${suffix}" + + sed -i "s/^Name=Player$/Name=${new_name}/" "$target_file" +} + +if [ ! -f "${USER_USER_INI}" ]; then + if [ ! -r "${SYSTEM_DEFAULT_USER}" ]; then + echo "Missing ${SYSTEM_DEFAULT_USER}" + exit 1 + fi + cp -f "${SYSTEM_DEFAULT_USER}" "${USER_USER_INI}" + set_random_ut_name "${USER_USER_INI}" +fi + +trap "setxkbmap" EXIT + +# games run better with US keyboard layout +test "$NOUSLAYOUT" || setxkbmap -symbols 'us(pc101)' + +LD_LIBRARY_PATH="${GAME_SYSTEM_DIR}:${LD_LIBRARY_PATH}" +export LD_LIBRARY_PATH + +# start the game +if nice -n -5 true >/dev/null 2>&1; then + echo "Launching UT99 with elevated priority" + cd "${GAME_SYSTEM_DIR}" && exec nice -n -5 -- "./$GAME_BINARY" $CMD_ARGS "$@" +else + echo "Negative nice not permitted, launching normally" + cd "${GAME_SYSTEM_DIR}" && exec "./$GAME_BINARY" $CMD_ARGS "$@" +fi +EXITCODE="$?" + +exit $EXITCODE diff --git a/ut-install-436.run b/games/ut99/ut-install-436.run similarity index 100% rename from ut-install-436.run rename to games/ut99/ut-install-436.run diff --git a/update-initramfs.sh b/update-initramfs.sh index 294ccd1..9ac8b0a 100644 --- a/update-initramfs.sh +++ b/update-initramfs.sh @@ -13,6 +13,5 @@ grep -q '^squashfs$' /etc/initramfs-tools/modules 2>/dev/null || \ for KERNEL in /boot/vmlinuz-* do VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - update-initramfs -k ${VERSION} -t -u done \ No newline at end of file diff --git a/zzz-config-live.sh b/zzz-config-live.sh index b4d2525..89c096f 100644 --- a/zzz-config-live.sh +++ b/zzz-config-live.sh @@ -1,9 +1,6 @@ #!/bin/sh set -e -USER_NAME="bob" - - mkdir -p /etc/skel cat > /etc/skel/.xinitrc <<'EOF' @@ -120,4 +117,19 @@ LANG=en_US.UTF-8 LANGUAGE=en_US:en EOF +# Allow all (new) users to do nice -5 +sed -i \ + -e 's/^#\s*EXTRA_GROUPS=/EXTRA_GROUPS=/' \ + -e 's/^#\s*ADD_EXTRA_GROUPS=/ADD_EXTRA_GROUPS=/' \ + /etc/adduser.conf + +grep -q '^@users[[:space:]]\+-[[:space:]]\+nice[[:space:]]\+-5$' /etc/security/limits.conf || \ +echo '@users - nice -5' >> /etc/security/limits.conf + +grep -q '^session[[:space:]]\+required[[:space:]]\+pam_limits\.so$' /etc/pam.d/common-session || \ +echo 'session required pam_limits.so' >> /etc/pam.d/common-session + +# compat link (ut99) +ln -s /usr/lib/libSDL-1.2.so.0 /usr/lib/libSDL-1.1.so.0 + update-rc.d ntp defaults || true