fickit: Add metadata to update image
This commit is contained in:
parent
dbf22f668b
commit
fa5aee89c8
@ -6,13 +6,15 @@ export DOMAIN_NAME="live.fic.srs.epita.fr"
|
|||||||
export IP_FRONTEND="10.42.192.3/24"
|
export IP_FRONTEND="10.42.192.3/24"
|
||||||
export IP_FRONTEND_ROUTER="10.42.192.1"
|
export IP_FRONTEND_ROUTER="10.42.192.1"
|
||||||
export IP_FIC_SRS_FR=$(host ${DOMAIN_NAME} | grep -o '\([0-9]\{1,3\}.\)\+')
|
export IP_FIC_SRS_FR=$(host ${DOMAIN_NAME} | grep -o '\([0-9]\{1,3\}.\)\+')
|
||||||
export IPS_BACKEND="192.168.3.92/24\\n192.168.4.92/24"
|
export IPS_BACKEND="192.168.3.92/24\\n192.168.4.92/24\\n"
|
||||||
export IP_BACKEND_ROUTER="192.168.3.1"
|
export IP_BACKEND_ROUTER="192.168.3.1"
|
||||||
|
|
||||||
export AIRBUS_BASEURL="https://..."
|
export AIRBUS_BASEURL="https://..."
|
||||||
export AIRBUS_TOKEN="abcdef0123456789abcdef0123456789"
|
export AIRBUS_TOKEN="abcdef0123456789abcdef0123456789"
|
||||||
export AIRBUS_SESSION_NAME="Forensique"
|
export AIRBUS_SESSION_NAME="Forensique"
|
||||||
|
|
||||||
|
export IPS_FRONTEND="${IP_FRONTEND}\\n${IP_FIC_SRS_FR}\\n"
|
||||||
|
|
||||||
escape_newline () {
|
escape_newline () {
|
||||||
sed 's/$/\\n/g' | tr -d '\n'
|
sed 's/$/\\n/g' | tr -d '\n'
|
||||||
}
|
}
|
||||||
@ -32,7 +34,7 @@ then
|
|||||||
FNAME="user-data"
|
FNAME="user-data"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export DM_CRYPT=$(jq -r '."dm-crypt".entries.key.content' "${FNAME}" | escape_newline)
|
export DM_CRYPT=$(jq -r '."dm-crypt".entries.key.content' "${FNAME}" | tr -d '\n')
|
||||||
export DHPARAM=$(jq -r '."tls_config".entries."dhparams-4096.pem".content' "${FNAME}" | escape_newline)
|
export DHPARAM=$(jq -r '."tls_config".entries."dhparams-4096.pem".content' "${FNAME}" | escape_newline)
|
||||||
export SYNCRO_PRIVATE_KEY=$(jq -r '.synchro.entries.id_ed25519.content' "${FNAME}" | escape_newline)
|
export SYNCRO_PRIVATE_KEY=$(jq -r '.synchro.entries.id_ed25519.content' "${FNAME}" | escape_newline)
|
||||||
export SYNCRO_PUBLIC_KEY=$(jq -r '.synchro.entries."id_ed25519.pub".content' "${FNAME}" | escape_newline)
|
export SYNCRO_PUBLIC_KEY=$(jq -r '.synchro.entries."id_ed25519.pub".content' "${FNAME}" | escape_newline)
|
||||||
@ -49,10 +51,10 @@ command -v vault &> /dev/null || (echo "vault could not be found" && exit)
|
|||||||
vault login -method=oidc -no-print 2> /dev/null
|
vault login -method=oidc -no-print 2> /dev/null
|
||||||
|
|
||||||
[ -z "${DM_CRYPT}" ] && export DM_CRYPT="$(tr -d -c "a-zA-Z0-9" < /dev/urandom | fold -w512 | head -n 1)"
|
[ -z "${DM_CRYPT}" ] && export DM_CRYPT="$(tr -d -c "a-zA-Z0-9" < /dev/urandom | fold -w512 | head -n 1)"
|
||||||
export CERT_PEM="$(vault kv get --field=cert.pem fic/cert/fic.srs.epita.fr | escape_newline)"
|
export CERT_PEM="$(vault kv get --field=cert.pem fic/cert/${DOMAIN_NAME} | escape_newline)"
|
||||||
export CHAIN_PEM="$(vault kv get --field=chain.pem fic/cert/fic.srs.epita.fr | escape_newline)"
|
export CHAIN_PEM="$(vault kv get --field=chain.pem fic/cert/${DOMAIN_NAME} | escape_newline)"
|
||||||
export FULLCHAIN_PEM="$(vault kv get --field=fullchain.pem fic/cert/fic.srs.epita.fr | escape_newline)"
|
export FULLCHAIN_PEM="$(vault kv get --field=fullchain.pem fic/cert/${DOMAIN_NAME} | escape_newline)"
|
||||||
export PRIVKEY_PEM="$(vault kv get --field=privkey.pem fic/cert/fic.srs.epita.fr | escape_newline)"
|
export PRIVKEY_PEM="$(vault kv get --field=privkey.pem fic/cert/${DOMAIN_NAME} | escape_newline)"
|
||||||
|
|
||||||
if [ -z "${SYNCRO_PUBLIC_KEY}" ] || [ -z "${SYNCRO_PRIVATE_KEY}" ]
|
if [ -z "${SYNCRO_PUBLIC_KEY}" ] || [ -z "${SYNCRO_PRIVATE_KEY}" ]
|
||||||
then
|
then
|
||||||
@ -110,7 +112,7 @@ TEMPLATE='
|
|||||||
"entries": {
|
"entries": {
|
||||||
"frontend-players": {
|
"frontend-players": {
|
||||||
"perm": "0444",
|
"perm": "0444",
|
||||||
"content": "${IP_FRONTEND}\n${IP_FIC_SRS_FR}"
|
"content": "${IPS_FRONTEND}"
|
||||||
},
|
},
|
||||||
"frontend-router": {
|
"frontend-router": {
|
||||||
"perm": "0444",
|
"perm": "0444",
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
mkdir -p /boot/imgs
|
mkdir -p /boot/imgs
|
||||||
|
|
||||||
# Backup the previous metadata
|
# Backup the previous metadata
|
||||||
|
/usr/bin/metadata -v
|
||||||
mv /boot/imgs/fickit-metadata.iso /boot/imgs/fickit-metadata.iso.bak
|
mv /boot/imgs/fickit-metadata.iso /boot/imgs/fickit-metadata.iso.bak
|
||||||
|
|
||||||
for img in fickit-boot-kernel fickit-metadata.iso fickit-boot-initrd.img fickit-prepare-initrd.img fickit-frontend-squashfs.img fickit-backend-squashfs.img fickit-update-initrd.img
|
for img in fickit-boot-kernel fickit-metadata.iso fickit-boot-initrd.img fickit-prepare-initrd.img fickit-frontend-squashfs.img fickit-backend-squashfs.img fickit-update-initrd.img
|
||||||
|
@ -6,6 +6,7 @@ kernel:
|
|||||||
|
|
||||||
init:
|
init:
|
||||||
- nemunaire/mdadm:8c8a476336087b395878e02e1d89008da6a38044
|
- nemunaire/mdadm:8c8a476336087b395878e02e1d89008da6a38044
|
||||||
|
- linuxkit/metadata:b082f1bf97a9034d1e4c0e36a5d2923f4e58f540
|
||||||
- alpine:latest
|
- alpine:latest
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user