feat: office

This commit is contained in:
AngeD 2023-10-02 18:44:35 +02:00
commit d907c088a1
6 changed files with 149 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.img
office/

61
Dockerfile Normal file
View File

@ -0,0 +1,61 @@
FROM docker.io/debian:12-slim as base
ENV DEBIAN_FRONTEND=noninteractive
FROM base as build
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
locales \
&& rm -rf /var/lib/apt/lists/*
ARG URL='https://media.codeweavers.com/pub/crossover/cxlinux/demo/crossover_23.5.0-1.deb'
RUN curl -o /co.deb "$URL"
RUN echo 'fr_FR.UTF-8 UTF-8' > /etc/locale.gen && locale-gen
FROM base
RUN --mount=from=build,src=/co.deb,target=/co.deb \
dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
dbus-x11 \
gstreamer1.0-plugins-base:i386 \
gstreamer1.0-plugins-good:i386 \
gstreamer1.0-plugins-ugly:i386 \
libc6:i386 \
libcups2:i386 \
libdbus-1-3:i386 \
libfontconfig1:i386 \
libfreetype6:i386 \
libgcc-s1:i386 \
libgl1-mesa-dri:i386 \
libgl1-mesa-glx:i386 \
libgmp10:i386 \
libgnutls30:i386 \
libgstreamer1.0-0:i386 \
libnss-mdns:i386 \
libpulse0:i386 \
libsane:i386 \
libudev1:i386 \
libvulkan1:i386 \
libx11-6:i386 \
libxcomposite1:i386 \
libxcursor1:i386 \
libxext6:i386 \
libxfixes3:i386 \
libxi6:i386 \
libxinerama1:i386 \
libxrandr2:i386 \
libxrender1:i386 \
libxxf86vm1:i386 \
/co.deb \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive
COPY bin /usr/local/bin/
VOLUME /app/
RUN passwd -d root && useradd -md /app/ app
USER app
ENV NO_AT_BRIDGE=1 \
LANG=fr_FR.UTF-8 \
PATH="/opt/cxoffice/bin/:$PATH"
CMD ["/opt/cxoffice/bin/crossover"]

7
bin/install.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash -e
cat <<EOF >> "$HOME/.bashrc"
export FAKETIME='$(date '+%Y-%m-%d 00:00:00')'
EOF
exec "$@"

18
get_office.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash -e
# https://answers.microsoft.com/en-us/msoffice/forum/all/useful-microsoft-download-links-for-office-direct/7bcaa971-9493-44b6-a1ba-0db4c6957c47
# Office 2016 Home & Student
URL='http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/en-us/HomeStudentRetail.img'
curl -C- -o O2016HS.img "$URL"
DEV="$(udisksctl loop-setup -f O2016HS.img | awk '{print $NF}' | awk 1 RS='.\n')"
DIR="$(udisksctl mount -b "$DEV" | awk '{print $NF}')"
cp -Trv "$DIR" office/ || true
umount "$DIR"
udisksctl loop-delete -b "$DEV"
find office/ -type d -exec chmod 755 '{}' + -o -type f -exec chmod 644 {} +

33
install.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash -e
CRI=(podman)
CRI_OPT=()
if [ -z "$WAYLAND_DISPLAY" ]; then
CRI_OPT+=(
--network=host
-e XAUTHORITY=/app/.Xauthority
-v "$XAUTHORITY:/app/.Xauthority:ro"
)
fi
[ -d office/ ] || ./get_office.sh
"${CRI[@]}" volume create -o=o=uid=1000 office || true
"${CRI[@]}" build -t office .
"${CRI[@]}" run --rm --name office \
"${CRI_OPT[@]}" \
--userns=keep-id \
--ipc=host \
--device /dev/dri/ \
-e DISPLAY \
-e XDG_RUNTIME_DIR \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
-v "$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR" \
-v /usr/share/fonts/:/usr/share/fonts/:ro \
-v "$PWD:/mnt/:ro" \
-v office:/home/app/ \
--entrypoint install.sh \
office \
/opt/cxoffice/bin/cxinstaller

28
run Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash -e
CRI=(podman)
CRI_OPT=()
if [ -z "$WAYLAND_DISPLAY" ]; then
CRI_OPT+=(
-e XAUTHORITY=/app/.Xauthority
-v "$XAUTHORITY:/app/.Xauthority:ro"
)
fi
"${CRI[@]}" build -t office .
"${CRI[@]}" run --rm --name office \
"${CRI_OPT[@]}" \
--network=none \
--userns=keep-id \
--ipc=host \
--device /dev/dri/ \
-e DISPLAY \
-e XDG_RUNTIME_DIR \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
-v "$XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR" \
-v /usr/share/fonts/:/usr/share/fonts/:ro \
-v "$PWD:/mnt/:ro" \
-v office:/app/ \
office \
/opt/cxoffice/bin/crossover