Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add configurations which build images #6

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "packages/elementary/os"]
path = packages/elementary/os
url = [email protected]:elementary/os.git
[submodule "packages/windows/uupdump_converter"]
path = packages/windows/uupdump_converter
url = https://git.uupdump.net/uup-dump/converter
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions packages/elementary/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM debian:latest

COPY build_elementary.sh /build/
COPY os /build/os/

# Install dependencies and handle other preconditions
RUN apt-get update; apt-get install -y live-build patch gnupg2 binutils zstd

ENTRYPOINT ["/build/build_elementary.sh"]
19 changes: 19 additions & 0 deletions packages/elementary/build_elementary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

cd /build/os || exit

if [ ! -d /output ]; then
echo "A directory must be mounted at /output. If quickget is building this image, please file an issue."
exit 1
fi

RELEASE="${RELEASE/-build/}"
case "${RELEASE}" in
"8") ./build.sh etc/terraform-daily-8.0-azure.conf;;
"stable") ./build.sh;;
esac

for file in builds/*/*.iso; do
mv "${file}" "/output/elementary-${RELEASE}.iso"
chmod a+rw "/output/elementary-${RELEASE}.iso"
done
16 changes: 16 additions & 0 deletions packages/elementary/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"privileged": true,
"shared_dirs": ["/proc"],
"os_data": [
{
"os_name": "elementary",
"images": [
{
"release": "8",
"architectures": ["x86_64"],
"filename": "elementary-8-daily.iso"
}
]
}
]
}
1 change: 1 addition & 0 deletions packages/elementary/os
Submodule os added at 4420e6
8 changes: 8 additions & 0 deletions packages/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:latest

RUN apt-get update; apt-get install -y aria2 cabextract wimtools chntpw genisoimage curl

COPY uupdump_converter/ /build/uupdump_converter/
COPY build_windows_uupdump.sh /build/

ENTRYPOINT ["/build/build_windows_uupdump.sh"]
97 changes: 97 additions & 0 deletions packages/windows/build_windows_uupdump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

set -e
cd /build/uupdump_converter

case "${ARCH}" in
"x86_64") ARCH="amd64";;
"aarch64") ARCH="arm64";;
*) echo "Unsupported architecture: ${ARCH}"
exit 1
;;
esac

RELEASE="${RELEASE/-build/}"

case "${RELEASE}" in
"retail") RING="retail";;
"release_preview") RING="rp";;
"beta") RING="wis";;
"dev") RING="wif";;
"canary") RING="canary";;
*) echo "Unsupported release: ${RELEASE}"
exit 1
;;
esac

case "${EDITION}" in
"Arabic") LANG="ar-sa";;
"Brazilian Portuguese") LANG="pt-br";;
"Bulgarian") LANG="bg-bg";;
"Chinese (Simplified)") LANG="zh-cn";;
"Chinese (Traditional)") LANG="zh-tw";;
"Croatian") LANG="hr-hr";;
"Czech") LANG="cs-cz";;
"Danish") LANG="da-dk";;
"Dutch") LANG="nl-nl";;
"English International") LANG="en-gb";;
"English (United States)") LANG="en-us";;
"Estonian") LANG="et-ee";;
"Finnish") LANG="fi-fi";;
"French") LANG="fr-fr";;
"French Canadian") LANG="fr-ca";;
"German") LANG="de-de";;
"Greek") LANG="el-gr";;
"Hebrew") LANG="he-il";;
"Hungarian") LANG="hu-hu";;
"Italian") LANG="it-it";;
"Japanese") LANG="ja-jp";;
"Korean") LANG="ko-kr";;
"Latvian") LANG="lv-lv";;
"Lithuanian") LANG="lt-lt";;
"Norwegian") LANG="nb-no";;
"Polish") LANG="pl-pl";;
"Portuguese") LANG="pt-pt";;
"Romanian") LANG="ro-ro";;
"Russian") LANG="ru-ru";;
"Serbian Latin") LANG="sr-latn-rs";;
"Slovak") LANG="sk-sk";;
"Slovenian") LANG="sl-si";;
"Spanish") LANG="es-es";;
"Spanish (Mexico)") LANG="es-mx";;
"Swedish") LANG="sv-se";;
"Thai") LANG="th-th";;
"Turkish") LANG="tr-tr";;
"Ukrainian") LANG="uk-ua";;
*) echo "Unsupported language: ${EDITION}"
exit 1
;;
esac

# Fetchupd in UUPDump's JSON API doesn't appear to work correctly. Therefore, parse from website HTML instead.
UPD_ID="$(curl -s "https://uupdump.net/fetchupd.php?arch=${ARCH}&ring=${RING}" | grep -i -v "update" | grep -A 7 -e ", version" -e "Insider Preview" | grep -P -o '(?<=<code>)[0-9a-f-]{36}(?=</code)')"

if [ -z "${UPD_ID}" ]; then
echo "Failed to fetch update ID."
exit 1
fi

echo "Found update ID: ${UPD_ID}"
# Wait for ratelimiting
sleep 5

curl -s "https://uupdump.net/get.php?id=${UPD_ID}&pack=${LANG}&edition=core;professional&aria2=2" -o "aria2_script.txt"

echo "Downloading UUP files..."
aria2c --no-conf --console-log-level=warn --log-level=info -x16 -s16 -j5 -c -R -d"UUPs" -i"aria2_script.txt"

echo "Building image from UUP files..."
./convert.sh

EDITION="$(echo "${EDITION}" | sed 's/ /_/g' | sed 's/[()]//g')"

for ISO in *.ISO; do
chmod a+rw "${ISO}"
mv "${ISO}" "/output/windows-${RELEASE}-${EDITION}.iso"
break;
done
Loading