diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..ef36be9 --- /dev/null +++ b/Readme.md @@ -0,0 +1,38 @@ +# KarlOS Landing Page + +This is the source code for the public [KarlOS](https://karlsruhe-os.de) landing page. +It is a static HTML website. +To reduce duplication, the source code is preprocessed by a set of POSIX shell + awk scripts +which allow you to set and insert variables, and to execute arbitrary shell commands (spicy!). +To build the website, simply run `build.sh`. +If you have SSH access to the server machine, you can run `deploy-to-server.sh` +to push your local state to the production web page. + +## The Preprocessor Syntax + +Lines starting with two percent signs are considered comments and ignored: +```html +%% This line won't show up in the resulting HTML +``` + +Lines starting with a percent sign and a tilde can execute shell commands: +```html +%~ date # Inserts the current date at the time the build script is run +``` +In addition to regular shell commands, the following additional commands are also provided: +- `include `: Inserts the contents of the given file, recursively preprocessing it too. +- `include_raw `: Inserts the contents of the given file without any processing. +- `include_md `: Treats the given file as a markdown file, converting it to HTML and inserting it. +- `die `: Throw an error and stop building the website. +All commands are executed in the root directory of this repository. + +Lines of the form `%VARIABLE:VALUE` can be used to store a string in a variable: +```html +%PAGE_TITLE:Hello, World! +``` + +Within any line that isn't one of the above directives, patterns of the form `%[VARIABLE]` are replaced by the string that is stored in the variable: +``` +%[PAGE_TITLE] +``` + diff --git a/build.sh b/build.sh index 5ae5411..585d2a2 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,10 @@ #!/bin/sh +set -e + +rm -rf www mkdir -p www -cp -rf src/assets www/ -cp -f src/*.html www/ + +cp -rf src/assets www + +exec preproc/buildall.sh diff --git a/preproc/buildall.sh b/preproc/buildall.sh new file mode 100755 index 0000000..bbb9583 --- /dev/null +++ b/preproc/buildall.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +preproc/buildpage.sh src/style.css + +find src -name "*.html" | while read f; do + preproc/buildpage.sh "$f" +done + diff --git a/preproc/buildpage.sh b/preproc/buildpage.sh new file mode 100755 index 0000000..ae2fc99 --- /dev/null +++ b/preproc/buildpage.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +OUT="www/${1##src/}" + +awk -Pf preproc/interp.awk "$1" | sh > "$OUT" diff --git a/preproc/interp.awk b/preproc/interp.awk new file mode 100644 index 0000000..61cf6ac --- /dev/null +++ b/preproc/interp.awk @@ -0,0 +1,46 @@ +function translate_var_refs(str, _out, _name) { + _out = "" + while (match(str, /%\[[a-zA-Z0-9_]+\]/)) { + _out = _out substr(str, 1, RSTART-1) + _name = substr(str, RSTART+2, RLENGTH-3) + _out = _out sprintf("${DATA_%s-%[%s]}", _name, _name) + str = substr(str, RSTART + RLENGTH) + } + _out = _out str + return _out +} + +function escape_shell(str) { + gsub(/\\/, "\\\\", str) + gsub(/'/, "\\'", str) + gsub(/"/, "\\\"", str) + gsub(/\$/, "\\$", str) + return str +} + +BEGIN { + begin=0 +} + +{ + if (!begin) { + printf "export FILENAME='%s'\n", FILENAME + printf ". preproc/lib.sh\n" + begin=1 + } +} + +/^%~/ { + print substr($0, 3) +} + +/^%[a-zA-Z0-9_]+:/ { + _split = index($0, ":") + _name = substr($0, 2, _split-2) + _value = substr($0, _split+1) + printf "export DATA_%s='%s'\n", _name, escape_shell(_value) +} + +!/^%%|^%~|^%[a-zA-Z0-9_]+:/ { + printf "printf '%%s\\n' \"%s\"\n", translate_var_refs(escape_shell($0)) +} diff --git a/preproc/lib.sh b/preproc/lib.sh new file mode 100644 index 0000000..3e78c0e --- /dev/null +++ b/preproc/lib.sh @@ -0,0 +1,27 @@ +set -e + +die() { + printf "%s: error: %s\n" "$FILENAME" "$1" >&2 + exit 1 +} + +include() { + if [ ! -f "$1" ]; then + die "Can't include '$1'." + fi + awk -Pf preproc/interp.awk $1 | sh +} + +include_raw() { + if [ ! -f "$1" ]; then + die "Can't include '$1'." + fi + cat "$1" +} + +include_md() { + if [ ! -f "$1" ]; then + die "Can't include '$1'." + fi + lowdown -thtml "$1" +} diff --git a/preproc/nointerp.awk b/preproc/nointerp.awk new file mode 100644 index 0000000..0f24d38 --- /dev/null +++ b/preproc/nointerp.awk @@ -0,0 +1,11 @@ +function escape_shell(str) { + gsub(/\\/, "\\\\", str) + gsub(/'/, "\\\'", str) + gsub(/"/, "\\\"", str) + gsub(/\$/, "\\$", str) + return str +} + +{ + printf "printf '%%s\\n' \"%s\"\n", escape_shell($0) +} diff --git a/src/assets/banner.jpg b/src/assets/banner.jpg index 31b6b52..8d39d81 100644 Binary files a/src/assets/banner.jpg and b/src/assets/banner.jpg differ diff --git a/src/footer.inc b/src/footer.inc new file mode 100644 index 0000000..175bff5 --- /dev/null +++ b/src/footer.inc @@ -0,0 +1,12 @@ +%% vim: ft=html + + + diff --git a/src/header.inc b/src/header.inc new file mode 100644 index 0000000..0276ff7 --- /dev/null +++ b/src/header.inc @@ -0,0 +1,29 @@ +%% vim: ft=html + + + +%[PAGE_TITLE] + + + + + diff --git a/src/index.html b/src/index.html index 87879bb..e9ad81d 100644 --- a/src/index.html +++ b/src/index.html @@ -1,31 +1,5 @@ - - - -Welcome to KarlOS! - - - - - +%PAGE_TITLE:Welcome to KarlOS! +%~ include src/header.inc @@ -52,14 +26,4 @@ - - - +%~ include src/footer.inc diff --git a/src/releases.html b/src/releases.html new file mode 100644 index 0000000..52b201a --- /dev/null +++ b/src/releases.html @@ -0,0 +1,28 @@ +%PAGE_TITLE:KarlOS - Releases +%~ include src/header.inc +
+
+

Releases

+ + + + + + + + + + + + + + + + + + + +
DateReleaseChecksumSignature
2025-10-18KarlOS Preview Snapshot #1 Live Imagesha256minisign
2025-12-24KarlOS Christmas Special Editionsha256minisign
+
+
+%~ include src/footer.inc diff --git a/src/assets/style.css b/src/style.css similarity index 64% rename from src/assets/style.css rename to src/style.css index 146661d..28f3451 100644 --- a/src/assets/style.css +++ b/src/style.css @@ -1,5 +1,13 @@ +%COLOR_BACKGROUND:rgb(28, 27, 34) +%COLOR_TEXT:white +%COLOR_SPECIAL:rgb(0, 150, 110) +%COLOR_NAVBAR:black +%COLOR_SHADOW:#222222 +%COLOR_BLOCK:rgb(20, 19, 25) +%COLOR_BLOCK_ALT:rgb(35, 36, 42) + html { - color-scheme: light dark; + color-scheme: dark; scroll-behavior: smooth; } body { @@ -9,15 +17,18 @@ body { font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 20px; + + background-color: %[COLOR_BACKGROUND]; + color: %[COLOR_TEXT]; } a { - color: rgb(0, 150, 110); + color: %[COLOR_SPECIAL]; } .navbar { width: 100%; padding-top: 0.6em; padding-bottom: 0.6em; - background-color: black; + background-color: %[COLOR_NAVBAR]; position: sticky; top: 0; @@ -35,7 +46,7 @@ a { text-align: center; padding-top: 1em; padding-bottom: 2em; - background-color: #222222; + background-color: %[COLOR_BLOCK]; } .content { max-width: 40em; @@ -51,23 +62,23 @@ a { padding-bottom: 5em; margin-bottom: 4em; - color: white; + color: %[COLOR_TEXT]; text-align: center; - background-image: url("banner.jpg"); + background-image: url("/assets/banner.jpg"); background-attachment: fixed; background-position: center; background-size: cover; background-repeat: no-repeat; - box-shadow: inset 0em -2em 5em #222222; + box-shadow: inset 0em -2em 5em %[COLOR_SHADOW]; } .banner h1 { - text-shadow: 2px 2px #222222; + text-shadow: 4px 4px %[COLOR_SHADOW]; letter-spacing: 0.25em; font-family: 'Courier New', monospace; } .banner h3 { - text-shadow: 1px 1px #222222; + text-shadow: 1px 1px %[COLOR_SHADOW]; } h2 { font-size: 50px; @@ -92,3 +103,12 @@ h2 { text-align: center; font-size: 14px; } +.listing td { + padding: 0 1em; +} +.listing { + background-color: %[COLOR_BLOCK]; +} +.listing tr:nth-child(even) { + background-color: %[COLOR_BLOCK_ALT]; +} diff --git a/src/team.html b/src/team.html new file mode 100644 index 0000000..1f666ba --- /dev/null +++ b/src/team.html @@ -0,0 +1,9 @@ +%PAGE_TITLE:KarlOS - Our Team +%~ include src/header.inc + +
+%~ for member in src/team/*; do printf "
\n"; include_md "$member"; printf "
\n"; done +
+%~ include src/footer.inc diff --git a/src/team/000_yaloalo.md b/src/team/000_yaloalo.md new file mode 100644 index 0000000..0f6011a --- /dev/null +++ b/src/team/000_yaloalo.md @@ -0,0 +1,2 @@ +## @yaloalo +### Lennart Friebel diff --git a/src/team/010_tomolt.md b/src/team/010_tomolt.md new file mode 100644 index 0000000..4eee07d --- /dev/null +++ b/src/team/010_tomolt.md @@ -0,0 +1,7 @@ +## @tomolt +### Thomas Oltmann + +Hi there! I'm a computer science master student at KIT specializing in operating systems design. +Together with **@yaloalo**, I am one of the founding members of KarlOS. +Before we started KarlOS, I was working on my own hobbyist OS *dabble*. +I also maintain our website and online services.