mirror of
https://github.com/netbootxyz/docker-netbootxyz.git
synced 2025-08-07 06:37:43 +02:00
Separate init script from the start script
This commit is contained in:
parent
2a36c1a8e0
commit
cdae9b6897
76
root/init.sh
Executable file
76
root/init.sh
Executable file
@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# make our folders
|
||||
mkdir -p \
|
||||
/assets \
|
||||
/config/nginx/site-confs \
|
||||
/config/log/nginx \
|
||||
/run \
|
||||
/var/lib/nginx/tmp/client_body \
|
||||
/var/tmp/nginx
|
||||
|
||||
# copy config files
|
||||
[[ ! -f /config/nginx/nginx.conf ]] && \
|
||||
cp /defaults/nginx.conf /config/nginx/nginx.conf
|
||||
[[ ! -f /config/nginx/site-confs/default ]] && \
|
||||
envsubst < /defaults/default > /config/nginx/site-confs/default
|
||||
|
||||
# Ownership
|
||||
chown -R nbxyz:nbxyz /assets
|
||||
chown -R nbxyz:nbxyz /var/lib/nginx
|
||||
chown -R nbxyz:nbxyz /var/log/nginx
|
||||
|
||||
# create local logs dir
|
||||
mkdir -p \
|
||||
/config/menus/remote \
|
||||
/config/menus/local
|
||||
|
||||
# download menus if not found
|
||||
if [[ ! -f /config/menus/remote/menu.ipxe ]]; then
|
||||
if [[ -z ${MENU_VERSION+x} ]]; then
|
||||
MENU_VERSION=$(curl -sL "https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest" | jq -r '.tag_name')
|
||||
fi
|
||||
echo "[netbootxyz-init] Downloading netboot.xyz at ${MENU_VERSION}"
|
||||
# menu files
|
||||
curl -o \
|
||||
/config/endpoints.yml -sL \
|
||||
"https://raw.githubusercontent.com/netbootxyz/netboot.xyz/${MENU_VERSION}/endpoints.yml"
|
||||
curl -o \
|
||||
/tmp/menus.tar.gz -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/menus.tar.gz"
|
||||
tar xf \
|
||||
/tmp/menus.tar.gz -C \
|
||||
/config/menus/remote
|
||||
# boot files
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz.kpxe -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.kpxe"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-undionly.kpxe -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-undionly.kpxe"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-snp.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snp.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-snponly.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snponly.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64-snp.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snp.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64-snponly.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snponly.efi"
|
||||
# layer and cleanup
|
||||
echo -n "${MENU_VERSION}" > /config/menuversion.txt
|
||||
cp -r /config/menus/remote/* /config/menus
|
||||
rm -f /tmp/menus.tar.gz
|
||||
fi
|
||||
|
||||
# Ownership
|
||||
chown -R nbxyz:nbxyz /config
|
@ -1,79 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# make our folders
|
||||
mkdir -p \
|
||||
/assets \
|
||||
/config/nginx/site-confs \
|
||||
/config/log/nginx \
|
||||
/run \
|
||||
/var/lib/nginx/tmp/client_body \
|
||||
/var/tmp/nginx
|
||||
|
||||
# copy config files
|
||||
[[ ! -f /config/nginx/nginx.conf ]] && \
|
||||
cp /defaults/nginx.conf /config/nginx/nginx.conf
|
||||
[[ ! -f /config/nginx/site-confs/default ]] && \
|
||||
envsubst < /defaults/default > /config/nginx/site-confs/default
|
||||
|
||||
# Ownership
|
||||
chown -R nbxyz:nbxyz /assets
|
||||
chown -R nbxyz:nbxyz /var/lib/nginx
|
||||
chown -R nbxyz:nbxyz /var/log/nginx
|
||||
|
||||
# create local logs dir
|
||||
mkdir -p \
|
||||
/config/menus/remote \
|
||||
/config/menus/local
|
||||
|
||||
# download menus if not found
|
||||
if [[ ! -f /config/menus/remote/menu.ipxe ]]; then
|
||||
if [[ -z ${MENU_VERSION+x} ]]; then \
|
||||
MENU_VERSION=$(curl -sL "https://api.github.com/repos/netbootxyz/netboot.xyz/releases/latest" | jq -r '.tag_name')
|
||||
fi
|
||||
echo "[netbootxyz-init] Downloading netboot.xyz at ${MENU_VERSION}"
|
||||
# menu files
|
||||
curl -o \
|
||||
/config/endpoints.yml -sL \
|
||||
"https://raw.githubusercontent.com/netbootxyz/netboot.xyz/${MENU_VERSION}/endpoints.yml"
|
||||
curl -o \
|
||||
/tmp/menus.tar.gz -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/menus.tar.gz"
|
||||
tar xf \
|
||||
/tmp/menus.tar.gz -C \
|
||||
/config/menus/remote
|
||||
# boot files
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz.kpxe -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.kpxe"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-undionly.kpxe -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-undionly.kpxe"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-snp.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snp.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-snponly.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-snponly.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64-snp.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snp.efi"
|
||||
curl -o \
|
||||
/config/menus/remote/netboot.xyz-arm64-snponly.efi -sL \
|
||||
"https://github.com/netbootxyz/netboot.xyz/releases/download/${MENU_VERSION}/netboot.xyz-arm64-snponly.efi"
|
||||
# layer and cleanup
|
||||
echo -n ${MENU_VERSION} > /config/menuversion.txt
|
||||
cp -r /config/menus/remote/* /config/menus
|
||||
rm -f /tmp/menus.tar.gz
|
||||
fi
|
||||
|
||||
# Ownership
|
||||
chown -R nbxyz:nbxyz /config
|
||||
# Perform the initial configuration
|
||||
/init.sh
|
||||
|
||||
echo " _ _ _ "
|
||||
echo " _ __ ___| |_| |__ ___ ___ | |_ __ ___ _ ____ "
|
||||
|
Loading…
Reference in New Issue
Block a user