Skip to content

Commit

Permalink
Merge branch 'next/minor' of github.com:Start9Labs/start-os into feat…
Browse files Browse the repository at this point in the history
…/os-welcome
  • Loading branch information
Blu-J committed Sep 16, 2024
2 parents a870041 + 9981ee7 commit 80edb73
Show file tree
Hide file tree
Showing 442 changed files with 28,372 additions and 9,558 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/startos-iso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:
- next/*

env:
NODEJS_VERSION: "18.15.0"
NODEJS_VERSION: "20.16.0"
ENVIRONMENT: '${{ fromJson(format(''["{0}", ""]'', github.event.inputs.environment || ''dev''))[github.event.inputs.environment == ''NONE''] }}'

jobs:
Expand Down Expand Up @@ -75,6 +75,11 @@ jobs:
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODEJS_VERSION }}
Expand All @@ -83,7 +88,7 @@ jobs:
uses: docker/setup-qemu-action@v3

- name: Set up system dependencies
run: sudo apt-get update && sudo apt-get install -y qemu-user-static systemd-container
run: sudo apt-get update && sudo apt-get install -y qemu-user-static systemd-container squashfuse

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -148,6 +153,11 @@ jobs:
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
sudo apt-get update
Expand Down
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ BASENAME := $(shell ./basename.sh)
PLATFORM := $(shell if [ -f ./PLATFORM.txt ]; then cat ./PLATFORM.txt; else echo unknown; fi)
ARCH := $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo aarch64; else echo $(PLATFORM) | sed 's/-nonfree$$//g'; fi)
IMAGE_TYPE=$(shell if [ "$(PLATFORM)" = raspberrypi ]; then echo img; else echo iso; fi)
BINS := core/target/$(ARCH)-unknown-linux-musl/release/startbox core/target/$(ARCH)-unknown-linux-musl/release/containerbox
WEB_UIS := web/dist/raw/ui web/dist/raw/setup-wizard web/dist/raw/install-wizard
FIRMWARE_ROMS := ./firmware/$(PLATFORM) $(shell jq --raw-output '.[] | select(.platform[] | contains("$(PLATFORM)")) | "./firmware/$(PLATFORM)/" + .id + ".rom.gz"' build/lib/firmware.json)
BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts $(FIRMWARE_ROMS)
Expand All @@ -16,15 +15,15 @@ STARTD_SRC := core/startos/startd.service $(BUILD_SRC)
COMPAT_SRC := $(shell git ls-files system-images/compat/)
UTILS_SRC := $(shell git ls-files system-images/utils/)
BINFMT_SRC := $(shell git ls-files system-images/binfmt/)
CORE_SRC := $(shell git ls-files core) $(shell git ls-files --recurse-submodules patch-db) web/dist/static web/patchdb-ui-seed.json $(GIT_HASH_FILE)
CORE_SRC := $(shell git ls-files core) $(shell git ls-files --recurse-submodules patch-db) $(GIT_HASH_FILE)
WEB_SHARED_SRC := $(shell git ls-files web/projects/shared) $(shell ls -p web/ | grep -v / | sed 's/^/web\//g') web/node_modules/.package-lock.json web/config.json patch-db/client/dist web/patchdb-ui-seed.json sdk/dist
WEB_UI_SRC := $(shell git ls-files web/projects/ui)
WEB_SETUP_WIZARD_SRC := $(shell git ls-files web/projects/setup-wizard)
WEB_INSTALL_WIZARD_SRC := $(shell git ls-files web/projects/install-wizard)
PATCH_DB_CLIENT_SRC := $(shell git ls-files --recurse-submodules patch-db/client)
GZIP_BIN := $(shell which pigz || which gzip)
TAR_BIN := $(shell which gtar || which tar)
COMPILED_TARGETS := $(BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar container-runtime/rootfs.$(ARCH).squashfs
COMPILED_TARGETS := core/target/$(ARCH)-unknown-linux-musl/release/startbox core/target/$(ARCH)-unknown-linux-musl/release/containerbox system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar container-runtime/rootfs.$(ARCH).squashfs
ALL_TARGETS := $(STARTD_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) cargo-deps/$(ARCH)-unknown-linux-musl/release/startos-backup-fs $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-musl/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-musl/release/tokio-console; fi') $(PLATFORM_FILE)

ifeq ($(REMOTE),)
Expand All @@ -48,7 +47,7 @@ endif

.DELETE_ON_ERROR:

.PHONY: all metadata install clean format cli uis ui reflash deb $(IMAGE_TYPE) squashfs sudo wormhole wormhole-deb test
.PHONY: all metadata install clean format cli uis ui reflash deb $(IMAGE_TYPE) squashfs sudo wormhole wormhole-deb test test-core test-sdk test-container-runtime

all: $(ALL_TARGETS)

Expand Down Expand Up @@ -90,9 +89,16 @@ clean:
format:
cd core && cargo +nightly fmt

test: $(CORE_SRC) $(ENVIRONMENT_FILE)
(cd core && cargo build && cargo test)
(cd sdk && make test)
test: | test-core test-sdk test-container-runtime

test-core: $(CORE_SRC) $(ENVIRONMENT_FILE)
./core/run-tests.sh

test-sdk: $(shell git ls-files sdk) sdk/lib/osBindings
cd sdk && make test

test-container-runtime: container-runtime/node_modules $(shell git ls-files container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json
cd container-runtime && npm test

cli:
cd core && ./install-cli.sh
Expand Down Expand Up @@ -225,7 +231,7 @@ sdk/lib/osBindings: core/startos/bindings

core/startos/bindings: $(shell git ls-files core) $(ENVIRONMENT_FILE)
rm -rf core/startos/bindings
(cd core/ && cargo test --features=test '::export_bindings_')
./core/build-ts.sh
touch core/startos/bindings

sdk/dist: $(shell git ls-files sdk) sdk/lib/osBindings
Expand Down Expand Up @@ -257,9 +263,13 @@ system-images/utils/docker-images/$(ARCH).tar: $(UTILS_SRC)
system-images/binfmt/docker-images/$(ARCH).tar: $(BINFMT_SRC)
cd system-images/binfmt && make docker-images/$(ARCH).tar && touch docker-images/$(ARCH).tar

$(BINS): $(CORE_SRC) $(ENVIRONMENT_FILE)
cd core && ARCH=$(ARCH) ./build-startos-bins.sh
touch $(BINS)
core/target/$(ARCH)-unknown-linux-musl/release/startbox: $(CORE_SRC) web/dist/static web/patchdb-ui-seed.json $(ENVIRONMENT_FILE)
ARCH=$(ARCH) ./core/build-startbox.sh
touch core/target/$(ARCH)-unknown-linux-musl/release/startbox

core/target/$(ARCH)-unknown-linux-musl/release/containerbox: $(CORE_SRC) $(ENVIRONMENT_FILE)
ARCH=$(ARCH) ./core/build-containerbox.sh
touch core/target/$(ARCH)-unknown-linux-musl/release/containerbox

web/node_modules/.package-lock.json: web/package.json sdk/dist
npm --prefix web ci
Expand Down
2 changes: 1 addition & 1 deletion build-cargo-dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if [ -z "$ARCH" ]; then
fi

DOCKER_PLATFORM="linux/${ARCH}"
if [ "$ARCH" = aarch64 ]; then
if [ "$ARCH" = aarch64 ] || [ "$ARCH" = arm64 ]; then
DOCKER_PLATFORM="linux/arm64"
elif [ "$ARCH" = x86_64 ]; then
DOCKER_PLATFORM="linux/amd64"
Expand Down
1 change: 1 addition & 0 deletions build/dpkg-deps/depends
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ smartmontools
socat
sqlite3
squashfs-tools
squashfs-tools-ng
sudo
systemd
systemd-resolved
Expand Down
21 changes: 10 additions & 11 deletions build/lib/scripts/enable-kiosk
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ if ! id kiosk; then
useradd -s /bin/bash --create-home kiosk
fi

# create kiosk script
cat > /home/kiosk/kiosk.sh << 'EOF'
#!/bin/sh
PROFILE=$(mktemp -d)
if [ -f /usr/local/share/ca-certificates/startos-root-ca.crt ]; then
certutil -A -n "StartOS Local Root CA" -t "TCu,Cuw,Tuw" -i /usr/local/share/ca-certificates/startos-root-ca.crt -d $PROFILE
fi
cat >> $PROFILE/prefs.js << EOT
mkdir /home/kiosk/fx-profile
cat >> /home/kiosk/fx-profile/prefs.js << EOF
user_pref("app.normandy.api_url", "");
user_pref("app.normandy.enabled", false);
user_pref("app.shield.optoutstudies.enabled", false);
Expand Down Expand Up @@ -87,7 +81,11 @@ user_pref("toolkit.telemetry.shutdownPingSender.enabled", false);
user_pref("toolkit.telemetry.unified", false);
user_pref("toolkit.telemetry.updatePing.enabled", false);
user_pref("toolkit.telemetry.cachedClientID", "");
EOT
EOF

# create kiosk script
cat > /home/kiosk/kiosk.sh << 'EOF'
#!/bin/sh
while ! curl "http://localhost" > /dev/null; do
sleep 1
done
Expand All @@ -101,8 +99,7 @@ done
killall firefox-esr
) &
matchbox-window-manager -use_titlebar no &
firefox-esr http://localhost --profile $PROFILE
rm -rf $PROFILE
firefox-esr http://localhost --profile /home/kiosk/fx-profile
EOF
chmod +x /home/kiosk/kiosk.sh

Expand All @@ -116,6 +113,8 @@ fi
EOF
fi

chown -R kiosk:kiosk /home/kiosk

# enable autologin
mkdir -p /etc/systemd/system/[email protected]
cat > /etc/systemd/system/[email protected]/autologin.conf << 'EOF'
Expand Down
6 changes: 5 additions & 1 deletion container-runtime/download-base-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ elif [ "$_ARCH" = "aarch64" ]; then
_ARCH=arm64
fi

curl https://images.linuxcontainers.org/$(curl --silent https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$_ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs --output debian.${ARCH}.squashfs
URL="https://images.linuxcontainers.org/$(curl -fsSL https://images.linuxcontainers.org/meta/1.0/index-system | grep "^$DISTRO;$VERSION;$_ARCH;$FLAVOR;" | head -n1 | sed 's/^.*;//g')/rootfs.squashfs"

echo "Downloading $URL to debian.${ARCH}.squashfs"

curl -fsSL "$URL" > debian.${ARCH}.squashfs
8 changes: 8 additions & 0 deletions container-runtime/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
automock: false,
testEnvironment: "node",
rootDir: "./src/",
modulePathIgnorePatterns: ["./dist/"],
}
Loading

0 comments on commit 80edb73

Please sign in to comment.