mkdir -p "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/proc/self/"
cat /proc/self/stat > "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/proc/self/stat"
PLUGINS_DIR=/usr/share/peertube_plugins
echo """#!/bin/bash
set -ex
mv /etc/resolv.conf /tmp
echo "nameserver 9.9.9.9" > /etc/resolv.conf
PLUGINS_DIR=$PLUGINS_DIR
mkdir -p "\$PLUGINS_DIR"
cd "\$PLUGINS_DIR"
yarn add peertube-plugin-auth-openid-connect@0.1.0 --production
mkdir -p "\$PLUGINS_DIR/data/peertube-plugin-auth-openid-connect"
chown peertube: "\$PLUGINS_DIR/data"
chown peertube: "\$PLUGINS_DIR/data/peertube-plugin-auth-openid-connect"

rm -f /etc/resolv.conf
mv /tmp/resolv.conf /etc
""" > "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/install.sh"
chmod +x "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/install.sh"
chroot "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP" /install.sh
rm "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/proc/self/stat"
rmdir "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/proc/self/"

rm -f "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP/install.sh"
cd "$IMAGE_NAME_RISOTTO_IMAGE_DIR_TMP$PLUGINS_DIR/.."
#patch -p0 < "$IMAGE_DIR_RECIPIENT_IMAGE/postinstall/peertube.patch"
cd -
