mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
consolidate and streamline build (#2469)
* consolidate and streamline build * fix workflow syntax * fix workflow syntax * fix workflow syntax * fix workflow syntax * fix build scripts * only build platform-specific system images * fix build script * more build fixes * fix * fix compat build for x86 * wat * checkout * Prevent rebuild of compiled artifacts * Update startos-iso.yaml * Update startos-iso.yaml * fix raspi build * handle missing platform better * reduce arm vcpus * remove arch and platform from fe config, add to patch db --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
196
.github/workflows/startos-iso.yaml
vendored
196
.github/workflows/startos-iso.yaml
vendored
@@ -12,9 +12,9 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
- unstable
|
- unstable
|
||||||
- dev-unstable
|
- dev-unstable
|
||||||
- podman
|
- docker
|
||||||
- dev-podman
|
- dev-docker
|
||||||
- dev-unstable-podman
|
- dev-unstable-docker
|
||||||
runner:
|
runner:
|
||||||
type: choice
|
type: choice
|
||||||
description: Runner
|
description: Runner
|
||||||
@@ -42,11 +42,55 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
NODEJS_VERSION: "18.15.0"
|
NODEJS_VERSION: "18.15.0"
|
||||||
ENVIRONMENT: '${{ fromJson(format(''["{0}", ""]'', github.event.inputs.environment || ''dev-podman''))[github.event.inputs.environment == ''NONE''] }}'
|
ENVIRONMENT: '${{ fromJson(format(''["{0}", ""]'', github.event.inputs.environment || ''dev''))[github.event.inputs.environment == ''NONE''] }}'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
all:
|
compile:
|
||||||
name: Build
|
name: Compile Base Binaries
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
arch: >-
|
||||||
|
${{
|
||||||
|
fromJson('{
|
||||||
|
"x86_64": ["x86_64"],
|
||||||
|
"x86_64-nonfree": ["x86_64"],
|
||||||
|
"aarch64": ["aarch64"],
|
||||||
|
"aarch64-nonfree": ["aarch64"],
|
||||||
|
"raspberrypi": ["aarch64"],
|
||||||
|
"ALL": ["x86_64", "aarch64"]
|
||||||
|
}')[github.event.inputs.platform || 'ALL']
|
||||||
|
}}
|
||||||
|
runs-on: ${{ fromJson('["ubuntu-22.04", "buildjet-32vcpu-ubuntu-2204"]')[github.event.inputs.runner == 'fast'] }}
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo mount -t tmpfs tmpfs .
|
||||||
|
if: ${{ github.event.inputs.runner == 'fast' }}
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODEJS_VERSION }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Make
|
||||||
|
run: make ARCH=${{ matrix.arch }} compiled-${{ matrix.arch }}.tar
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: compiled-${{ matrix.arch }}.tar
|
||||||
|
path: compiled-${{ matrix.arch }}.tar
|
||||||
|
image:
|
||||||
|
name: Build Image
|
||||||
|
needs: [compile]
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -68,86 +112,30 @@ jobs:
|
|||||||
format(
|
format(
|
||||||
'["ubuntu-22.04", "{0}"]',
|
'["ubuntu-22.04", "{0}"]',
|
||||||
fromJson('{
|
fromJson('{
|
||||||
"x86_64": ["buildjet-32vcpu-ubuntu-2204", "buildjet-32vcpu-ubuntu-2204"],
|
"x86_64": "buildjet-32vcpu-ubuntu-2204",
|
||||||
"x86_64-nonfree": ["buildjet-32vcpu-ubuntu-2204", "buildjet-32vcpu-ubuntu-2204"],
|
"x86_64-nonfree": "buildjet-32vcpu-ubuntu-2204",
|
||||||
"aarch64": ["buildjet-16vcpu-ubuntu-2204-arm", "buildjet-32vcpu-ubuntu-2204-arm"],
|
"aarch64": "buildjet-8vcpu-ubuntu-2204-arm",
|
||||||
"aarch64-nonfree": ["buildjet-16vcpu-ubuntu-2204-arm", "buildjet-32vcpu-ubuntu-2204-arm"],
|
"aarch64-nonfree": "buildjet-8vcpu-ubuntu-2204-arm",
|
||||||
"raspberrypi": ["buildjet-16vcpu-ubuntu-2204-arm", "buildjet-32vcpu-ubuntu-2204-arm"],
|
"raspberrypi": "buildjet-8vcpu-ubuntu-2204-arm",
|
||||||
}')[matrix.platform][github.event.inputs.platform == matrix.platform]
|
}')[matrix.platform]
|
||||||
)
|
)
|
||||||
)[github.event.inputs.runner == 'fast']
|
)[github.event.inputs.runner == 'fast']
|
||||||
}}
|
}}
|
||||||
|
env:
|
||||||
|
ARCH: >-
|
||||||
|
${{
|
||||||
|
fromJson('{
|
||||||
|
"x86_64": "x86_64",
|
||||||
|
"x86_64-nonfree": "x86_64",
|
||||||
|
"aarch64": "aarch64",
|
||||||
|
"aarch64-nonfree": "aarch64",
|
||||||
|
"raspberrypi": "aarch64",
|
||||||
|
}')[matrix.platform]
|
||||||
|
}}
|
||||||
steps:
|
steps:
|
||||||
- name: Free space
|
|
||||||
run: df -h && rm -rf /opt/hostedtoolcache* && df -h
|
|
||||||
if: ${{ github.event.inputs.runner != 'fast' }}
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
sudo mount -t tmpfs tmpfs .
|
|
||||||
if: ${{ github.event.inputs.runner == 'fast' && (matrix.platform == 'x86_64' || matrix.platform == 'x86_64-nonfree' || github.event.inputs.platform == matrix.platform) }}
|
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: Start9Labs/embassy-os-deb
|
|
||||||
path: embassy-os-deb
|
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
path: embassy-os-deb/embassyos-0.3.x
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
cp -r debian embassyos-0.3.x/
|
|
||||||
VERSION=0.3.x ./control.sh
|
|
||||||
cp embassyos-0.3.x/backend/startd.service embassyos-0.3.x/debian/embassyos.startd.service
|
|
||||||
working-directory: embassy-os-deb
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODEJS_VERSION }}
|
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: /var/lib/docker
|
|
||||||
key: ${{ runner.os }}-${{ matrix.platform }}-docker-cache
|
|
||||||
|
|
||||||
- name: Get npm cache directory
|
|
||||||
id: npm-cache-dir
|
|
||||||
run: |
|
|
||||||
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
id: npm-cache
|
|
||||||
with:
|
|
||||||
path: ${{ steps.npm-cache-dir.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install \
|
|
||||||
debmake \
|
|
||||||
debhelper-compat \
|
|
||||||
crossbuild-essential-arm64
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Run dpkg build
|
|
||||||
working-directory: embassy-os-deb
|
|
||||||
run: "make VERSION=0.3.x TAG=${{ github.ref_name }}"
|
|
||||||
env:
|
|
||||||
OS_ARCH: ${{ matrix.platform }}
|
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: Start9Labs/startos-image-recipes
|
|
||||||
path: startos-image-recipes
|
|
||||||
ref: feature/podman
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -166,52 +154,40 @@ jobs:
|
|||||||
- run: sudo mount -t tmpfs tmpfs /var/tmp/debspawn
|
- run: sudo mount -t tmpfs tmpfs /var/tmp/debspawn
|
||||||
if: ${{ github.event.inputs.runner == 'fast' && (matrix.platform == 'x86_64' || matrix.platform == 'x86_64-nonfree') }}
|
if: ${{ github.event.inputs.runner == 'fast' && (matrix.platform == 'x86_64' || matrix.platform == 'x86_64-nonfree') }}
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- name: Download compiled artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: /var/lib/debspawn
|
name: compiled-${{ env.ARCH }}.tar
|
||||||
key: ${{ runner.os }}-${{ matrix.platform }}-debspawn-init
|
|
||||||
|
|
||||||
- run: "mkdir -p startos-image-recipes/overlays/deb"
|
- name: Extract compiled artifacts
|
||||||
|
run: tar -xvf compiled-${{ env.ARCH }}.tar
|
||||||
|
|
||||||
- run: "mv embassy-os-deb/embassyos_0.3.x-1_*.deb startos-image-recipes/overlays/deb/"
|
- name: Prevent rebuild of compiled artifacts
|
||||||
|
run: |
|
||||||
- run: "sudo rm -rf embassy-os-deb ${{ steps.npm-cache-dir.outputs.dir }} $HOME/.cargo"
|
mkdir -p frontend/dist/raw
|
||||||
|
PLATFORM=${{ matrix.platform }} make -t compiled-${{ env.ARCH }}.tar
|
||||||
|
|
||||||
- name: Run iso build
|
- name: Run iso build
|
||||||
working-directory: startos-image-recipes
|
run: PLATFORM=${{ matrix.platform }} make iso
|
||||||
run: |
|
if: ${{ matrix.platform != 'raspberrypi' }}
|
||||||
./run-local-build.sh ${{ matrix.platform }}
|
|
||||||
|
- name: Run img build
|
||||||
|
run: PLATFORM=${{ matrix.platform }} make img
|
||||||
|
if: ${{ matrix.platform == 'raspberrypi' }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}.squashfs
|
name: ${{ matrix.platform }}.squashfs
|
||||||
path: startos-image-recipes/results/*.squashfs
|
path: results/*.squashfs
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.platform }}.iso
|
name: ${{ matrix.platform }}.iso
|
||||||
path: startos-image-recipes/results/*.iso
|
path: results/*.iso
|
||||||
if: ${{ matrix.platform != 'raspberrypi' }}
|
if: ${{ matrix.platform != 'raspberrypi' }}
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
path: start-os
|
|
||||||
if: ${{ matrix.platform == 'raspberrypi' }}
|
|
||||||
|
|
||||||
- run: "mv startos-image-recipes/results/startos-*_raspberrypi.squashfs start-os/startos.raspberrypi.squashfs"
|
|
||||||
if: ${{ matrix.platform == 'raspberrypi' }}
|
|
||||||
|
|
||||||
- run: rm -rf startos-image-recipes
|
|
||||||
if: ${{ matrix.platform == 'raspberrypi' }}
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
working-directory: start-os
|
|
||||||
run: make startos_raspberrypi.img
|
|
||||||
if: ${{ matrix.platform == 'raspberrypi' }}
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: raspberrypi.img
|
name: ${{ matrix.platform }}.img
|
||||||
path: start-os/startos-*_raspberrypi.img
|
path: results/*.img
|
||||||
if: ${{ matrix.platform == 'raspberrypi' }}
|
if: ${{ matrix.platform == 'raspberrypi' }}
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -16,13 +16,15 @@ deploy_web.sh
|
|||||||
secrets.db
|
secrets.db
|
||||||
.vscode/
|
.vscode/
|
||||||
/cargo-deps/**/*
|
/cargo-deps/**/*
|
||||||
|
/PLATFORM.txt
|
||||||
/ENVIRONMENT.txt
|
/ENVIRONMENT.txt
|
||||||
/GIT_HASH.txt
|
/GIT_HASH.txt
|
||||||
/VERSION.txt
|
/VERSION.txt
|
||||||
/embassyos-*.tar.gz
|
|
||||||
/eos-*.tar.gz
|
/eos-*.tar.gz
|
||||||
/*.deb
|
/*.deb
|
||||||
/target
|
/target
|
||||||
/*.squashfs
|
/*.squashfs
|
||||||
/debian
|
/results
|
||||||
/DEBIAN
|
/dpkg-workdir
|
||||||
|
/compiled.tar
|
||||||
|
/compiled-*.tar
|
||||||
156
Makefile
156
Makefile
@@ -1,25 +1,31 @@
|
|||||||
OS_ARCH := $(shell echo "${OS_ARCH}")
|
PLATFORM_FILE := $(shell ./check-platform.sh)
|
||||||
ARCH := $(shell if [ "$(OS_ARCH)" = "raspberrypi" ]; then echo aarch64; else echo $(OS_ARCH) | sed 's/-nonfree$$//g'; fi)
|
ENVIRONMENT_FILE := $(shell ./check-environment.sh)
|
||||||
ENVIRONMENT_FILE = $(shell ./check-environment.sh)
|
GIT_HASH_FILE := $(shell ./check-git-hash.sh)
|
||||||
GIT_HASH_FILE = $(shell ./check-git-hash.sh)
|
VERSION_FILE := $(shell ./check-version.sh)
|
||||||
VERSION_FILE = $(shell ./check-version.sh)
|
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)
|
||||||
EMBASSY_BINS := backend/target/$(ARCH)-unknown-linux-gnu/release/startbox libs/target/aarch64-unknown-linux-musl/release/embassy_container_init libs/target/x86_64-unknown-linux-musl/release/embassy_container_init
|
EMBASSY_BINS := backend/target/$(ARCH)-unknown-linux-gnu/release/startbox libs/target/aarch64-unknown-linux-musl/release/embassy_container_init libs/target/x86_64-unknown-linux-musl/release/embassy_container_init
|
||||||
EMBASSY_UIS := frontend/dist/raw/ui frontend/dist/raw/setup-wizard frontend/dist/raw/diagnostic-ui frontend/dist/raw/install-wizard
|
EMBASSY_UIS := frontend/dist/raw/ui frontend/dist/raw/setup-wizard frontend/dist/raw/diagnostic-ui frontend/dist/raw/install-wizard
|
||||||
BUILD_SRC := $(shell find build)
|
BUILD_SRC := $(shell git ls-files build) build/lib/depends build/lib/conflicts
|
||||||
|
DEBIAN_SRC := $(shell git ls-files debian/)
|
||||||
|
IMAGE_RECIPE_SRC := $(shell git ls-files image-recipe/)
|
||||||
EMBASSY_SRC := backend/startd.service $(BUILD_SRC)
|
EMBASSY_SRC := backend/startd.service $(BUILD_SRC)
|
||||||
COMPAT_SRC := $(shell find system-images/compat/ -not -path 'system-images/compat/target/*' -and -not -name *.tar -and -not -name target)
|
COMPAT_SRC := $(shell git ls-files system-images/compat/)
|
||||||
UTILS_SRC := $(shell find system-images/utils/ -not -name *.tar)
|
UTILS_SRC := $(shell git ls-files system-images/utils/)
|
||||||
BINFMT_SRC := $(shell find system-images/binfmt/ -not -name *.tar)
|
BINFMT_SRC := $(shell git ls-files system-images/binfmt/)
|
||||||
BACKEND_SRC := $(shell find backend/src) $(shell find backend/migrations) $(shell find patch-db/*/src) $(shell find libs/*/src) libs/*/Cargo.toml backend/Cargo.toml backend/Cargo.lock frontend/dist/static
|
BACKEND_SRC := $(shell git ls-files backend) $(shell git ls-files --recurse-submodules patch-db) $(shell git ls-files libs) frontend/dist/static
|
||||||
FRONTEND_SHARED_SRC := $(shell find frontend/projects/shared) $(shell ls -p frontend/ | grep -v / | sed 's/^/frontend\//g') frontend/package.json frontend/node_modules frontend/config.json patch-db/client/dist frontend/patchdb-ui-seed.json
|
FRONTEND_SHARED_SRC := $(shell git ls-files frontend/projects/shared) $(shell ls -p frontend/ | grep -v / | sed 's/^/frontend\//g') frontend/node_modules frontend/config.json patch-db/client/dist frontend/patchdb-ui-seed.json
|
||||||
FRONTEND_UI_SRC := $(shell find frontend/projects/ui)
|
FRONTEND_UI_SRC := $(shell git ls-files frontend/projects/ui)
|
||||||
FRONTEND_SETUP_WIZARD_SRC := $(shell find frontend/projects/setup-wizard)
|
FRONTEND_SETUP_WIZARD_SRC := $(shell git ls-files frontend/projects/setup-wizard)
|
||||||
FRONTEND_DIAGNOSTIC_UI_SRC := $(shell find frontend/projects/diagnostic-ui)
|
FRONTEND_DIAGNOSTIC_UI_SRC := $(shell git ls-files frontend/projects/diagnostic-ui)
|
||||||
FRONTEND_INSTALL_WIZARD_SRC := $(shell find frontend/projects/install-wizard)
|
FRONTEND_INSTALL_WIZARD_SRC := $(shell git ls-files frontend/projects/install-wizard)
|
||||||
PATCH_DB_CLIENT_SRC := $(shell find patch-db/client -not -path patch-db/client/dist -and -not -path patch-db/client/node_modules)
|
PATCH_DB_CLIENT_SRC := $(shell git ls-files --recurse-submodules patch-db/client)
|
||||||
GZIP_BIN := $(shell which pigz || which gzip)
|
GZIP_BIN := $(shell which pigz || which gzip)
|
||||||
TAR_BIN := $(shell which gtar || which tar)
|
TAR_BIN := $(shell which gtar || which tar)
|
||||||
ALL_TARGETS := $(EMBASSY_BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar $(EMBASSY_SRC) $(shell if [ "$(OS_ARCH)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-gnu/release/tokio-console; fi') $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE)
|
COMPILED_TARGETS := $(EMBASSY_BINS) system-images/compat/docker-images/$(ARCH).tar system-images/utils/docker-images/$(ARCH).tar system-images/binfmt/docker-images/$(ARCH).tar
|
||||||
|
ALL_TARGETS := $(EMBASSY_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE) $(COMPILED_TARGETS) $(shell if [ "$(PLATFORM)" = "raspberrypi" ]; then echo cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep; fi) $(shell /bin/bash -c 'if [[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]; then echo cargo-deps/$(ARCH)-unknown-linux-gnu/release/tokio-console; fi') $(PLATFORM_FILE)
|
||||||
|
|
||||||
ifeq ($(REMOTE),)
|
ifeq ($(REMOTE),)
|
||||||
mkdir = mkdir -p $1
|
mkdir = mkdir -p $1
|
||||||
@@ -40,14 +46,14 @@ define cp
|
|||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
.PHONY: all gzip install clean format sdk snapshots frontends ui backend reflash startos_raspberrypi.img sudo wormhole
|
.PHONY: all metadata install clean format sdk snapshots frontends ui backend reflash deb $(IMAGE_TYPE) squashfs sudo wormhole docker-buildx
|
||||||
|
|
||||||
all: $(ALL_TARGETS)
|
all: $(ALL_TARGETS)
|
||||||
|
|
||||||
|
metadata: $(VERSION_FILE) $(PLATFORM_FILE) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE)
|
||||||
|
|
||||||
sudo:
|
sudo:
|
||||||
sudo true
|
sudo true
|
||||||
|
|
||||||
@@ -64,9 +70,13 @@ clean:
|
|||||||
rm -rf patch-db/client/dist
|
rm -rf patch-db/client/dist
|
||||||
rm -rf patch-db/target
|
rm -rf patch-db/target
|
||||||
rm -rf cargo-deps
|
rm -rf cargo-deps
|
||||||
rm ENVIRONMENT.txt
|
rm -rf dpkg-workdir
|
||||||
rm GIT_HASH.txt
|
rm -rf image-recipe/deb
|
||||||
rm VERSION.txt
|
rm -rf results
|
||||||
|
rm -f ENVIRONMENT.txt
|
||||||
|
rm -f PLATFORM.txt
|
||||||
|
rm -f GIT_HASH.txt
|
||||||
|
rm -f VERSION.txt
|
||||||
|
|
||||||
format:
|
format:
|
||||||
cd backend && cargo +nightly fmt
|
cd backend && cargo +nightly fmt
|
||||||
@@ -75,8 +85,20 @@ format:
|
|||||||
sdk:
|
sdk:
|
||||||
cd backend/ && ./install-sdk.sh
|
cd backend/ && ./install-sdk.sh
|
||||||
|
|
||||||
startos_raspberrypi.img: $(BUILD_SRC) startos.raspberrypi.squashfs $(VERSION_FILE) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) | sudo
|
deb: results/$(BASENAME).deb
|
||||||
./build/raspberrypi/make-image.sh
|
|
||||||
|
debian/control: build/lib/depends build/lib/conflicts
|
||||||
|
./debuild/control.sh
|
||||||
|
|
||||||
|
results/$(BASENAME).deb: dpkg-build.sh $(DEBIAN_SRC) $(VERSION_FILE) $(PLATFORM_FILE) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE)
|
||||||
|
PLATFORM=$(PLATFORM) ./dpkg-build.sh
|
||||||
|
|
||||||
|
$(IMAGE_TYPE): results/$(BASENAME).$(IMAGE_TYPE)
|
||||||
|
|
||||||
|
squashfs: results/$(BASENAME).squashfs
|
||||||
|
|
||||||
|
results/$(BASENAME).$(IMAGE_TYPE) results/$(BASENAME).squashfs: $(IMAGE_RECIPE_SRC) results/$(BASENAME).deb
|
||||||
|
./image-recipe/run-local-build.sh "results/$(BASENAME).deb"
|
||||||
|
|
||||||
# For creating os images. DO NOT USE
|
# For creating os images. DO NOT USE
|
||||||
install: $(ALL_TARGETS)
|
install: $(ALL_TARGETS)
|
||||||
@@ -88,58 +110,65 @@ install: $(ALL_TARGETS)
|
|||||||
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/start-deno)
|
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/start-deno)
|
||||||
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/avahi-alias)
|
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/avahi-alias)
|
||||||
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/embassy-cli)
|
$(call ln,/usr/bin/startbox,$(DESTDIR)/usr/bin/embassy-cli)
|
||||||
if [ "$(OS_ARCH)" = "raspberrypi" ]; then $(call cp,cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep,$(DESTDIR)/usr/bin/pi-beep); fi
|
if [ "$(PLATFORM)" = "raspberrypi" ]; then $(call cp,cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep,$(DESTDIR)/usr/bin/pi-beep); fi
|
||||||
if /bin/bash -c '[[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]'; then $(call cp,cargo-deps/$(ARCH)-unknown-linux-gnu/release/tokio-console,$(DESTDIR)/usr/bin/tokio-console); fi
|
if /bin/bash -c '[[ "${ENVIRONMENT}" =~ (^|-)unstable($$|-) ]]'; then $(call cp,cargo-deps/$(ARCH)-unknown-linux-gnu/release/tokio-console,$(DESTDIR)/usr/bin/tokio-console); fi
|
||||||
|
|
||||||
|
$(call mkdir,$(DESTDIR)/lib/systemd/system)
|
||||||
|
$(call cp,backend/startd.service,$(DESTDIR)/lib/systemd/system/startd.service)
|
||||||
|
|
||||||
$(call mkdir,$(DESTDIR)/usr/lib)
|
$(call mkdir,$(DESTDIR)/usr/lib)
|
||||||
$(call rm,$(DESTDIR)/usr/lib/embassy)
|
$(call rm,$(DESTDIR)/usr/lib/startos)
|
||||||
$(call cp,build/lib,$(DESTDIR)/usr/lib/embassy)
|
$(call cp,build/lib,$(DESTDIR)/usr/lib/startos)
|
||||||
|
|
||||||
$(call cp,ENVIRONMENT.txt,$(DESTDIR)/usr/lib/embassy/ENVIRONMENT.txt)
|
$(call cp,PLATFORM.txt,$(DESTDIR)/usr/lib/startos/PLATFORM.txt)
|
||||||
$(call cp,GIT_HASH.txt,$(DESTDIR)/usr/lib/embassy/GIT_HASH.txt)
|
$(call cp,ENVIRONMENT.txt,$(DESTDIR)/usr/lib/startos/ENVIRONMENT.txt)
|
||||||
$(call cp,VERSION.txt,$(DESTDIR)/usr/lib/embassy/VERSION.txt)
|
$(call cp,GIT_HASH.txt,$(DESTDIR)/usr/lib/startos/GIT_HASH.txt)
|
||||||
|
$(call cp,VERSION.txt,$(DESTDIR)/usr/lib/startos/VERSION.txt)
|
||||||
|
|
||||||
$(call mkdir,$(DESTDIR)/usr/lib/embassy/container)
|
$(call mkdir,$(DESTDIR)/usr/lib/startos/container)
|
||||||
$(call cp,libs/target/aarch64-unknown-linux-musl/release/embassy_container_init,$(DESTDIR)/usr/lib/embassy/container/embassy_container_init.arm64)
|
$(call cp,libs/target/aarch64-unknown-linux-musl/release/embassy_container_init,$(DESTDIR)/usr/lib/startos/container/embassy_container_init.arm64)
|
||||||
$(call cp,libs/target/x86_64-unknown-linux-musl/release/embassy_container_init,$(DESTDIR)/usr/lib/embassy/container/embassy_container_init.amd64)
|
$(call cp,libs/target/x86_64-unknown-linux-musl/release/embassy_container_init,$(DESTDIR)/usr/lib/startos/container/embassy_container_init.amd64)
|
||||||
|
|
||||||
$(call mkdir,$(DESTDIR)/usr/lib/embassy/system-images)
|
$(call mkdir,$(DESTDIR)/usr/lib/startos/system-images)
|
||||||
$(call cp,system-images/compat/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/embassy/system-images/compat.tar)
|
$(call cp,system-images/compat/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/startos/system-images/compat.tar)
|
||||||
$(call cp,system-images/utils/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/embassy/system-images/utils.tar)
|
$(call cp,system-images/utils/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/startos/system-images/utils.tar)
|
||||||
$(call cp,system-images/binfmt/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/embassy/system-images/binfmt.tar)
|
$(call cp,system-images/binfmt/docker-images/$(ARCH).tar,$(DESTDIR)/usr/lib/startos/system-images/binfmt.tar)
|
||||||
|
|
||||||
update-overlay:
|
update-overlay: $(ALL_TARGETS)
|
||||||
@echo "\033[33m!!! THIS WILL ONLY REFLASH YOUR DEVICE IN MEMORY !!!\033[0m"
|
@echo "\033[33m!!! THIS WILL ONLY REFLASH YOUR DEVICE IN MEMORY !!!\033[0m"
|
||||||
@echo "\033[33mALL CHANGES WILL BE REVERTED IF YOU RESTART THE DEVICE\033[0m"
|
@echo "\033[33mALL CHANGES WILL BE REVERTED IF YOU RESTART THE DEVICE\033[0m"
|
||||||
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
||||||
@if [ "`ssh $(REMOTE) 'cat /usr/lib/embassy/VERSION.txt'`" != "`cat ./VERSION.txt`" ]; then >&2 echo "StartOS requires migrations: update-overlay is unavailable." && false; fi
|
@if [ "`ssh $(REMOTE) 'cat /usr/lib/startos/VERSION.txt'`" != "`cat ./VERSION.txt`" ]; then >&2 echo "StartOS requires migrations: update-overlay is unavailable." && false; fi
|
||||||
$(call ssh,"sudo systemctl stop startd")
|
$(call ssh,"sudo systemctl stop startd")
|
||||||
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) OS_ARCH=$(OS_ARCH)
|
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) PLATFORM=$(PLATFORM)
|
||||||
$(call ssh,"sudo systemctl start startd")
|
$(call ssh,"sudo systemctl start startd")
|
||||||
|
|
||||||
wormhole: backend/target/$(ARCH)-unknown-linux-gnu/release/startbox
|
wormhole: backend/target/$(ARCH)-unknown-linux-gnu/release/startbox
|
||||||
@wormhole send backend/target/$(ARCH)-unknown-linux-gnu/release/startbox 2>&1 | awk -Winteractive '/wormhole receive/ { printf "sudo /usr/lib/embassy/scripts/chroot-and-upgrade \"cd /usr/bin && rm startbox && wormhole receive --accept-file %s && chmod +x startbox\"\n", $$3 }'
|
@wormhole send backend/target/$(ARCH)-unknown-linux-gnu/release/startbox 2>&1 | awk -Winteractive '/wormhole receive/ { printf "sudo /usr/lib/startos/scripts/chroot-and-upgrade \"cd /usr/bin && rm startbox && wormhole receive --accept-file %s && chmod +x startbox\"\n", $$3 }'
|
||||||
|
|
||||||
update:
|
update: $(ALL_TARGETS)
|
||||||
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
||||||
$(call ssh,"sudo rsync -a --delete --force --info=progress2 /media/embassy/embassyfs/current/ /media/embassy/next/")
|
$(call ssh,"sudo rsync -a --delete --force --info=progress2 /media/embassy/embassyfs/current/ /media/embassy/next/")
|
||||||
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) DESTDIR=/media/embassy/next OS_ARCH=$(OS_ARCH)
|
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) DESTDIR=/media/embassy/next PLATFORM=$(PLATFORM)
|
||||||
$(call ssh,'sudo NO_SYNC=1 /media/embassy/next/usr/lib/embassy/scripts/chroot-and-upgrade "apt-get install -y $(shell cat ./build/lib/depends)"')
|
$(call ssh,'sudo NO_SYNC=1 /media/embassy/next/usr/lib/startos/scripts/chroot-and-upgrade "apt-get install -y $(shell cat ./build/lib/depends)"')
|
||||||
|
|
||||||
emulate-reflash:
|
emulate-reflash: $(ALL_TARGETS)
|
||||||
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
@if [ -z "$(REMOTE)" ]; then >&2 echo "Must specify REMOTE" && false; fi
|
||||||
$(call ssh,"sudo rsync -a --delete --force --info=progress2 /media/embassy/embassyfs/current/ /media/embassy/next/")
|
$(call ssh,"sudo rsync -a --delete --force --info=progress2 /media/embassy/embassyfs/current/ /media/embassy/next/")
|
||||||
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) DESTDIR=/media/embassy/next OS_ARCH=$(OS_ARCH)
|
$(MAKE) install REMOTE=$(REMOTE) SSHPASS=$(SSHPASS) DESTDIR=/media/embassy/next PLATFORM=$(PLATFORM)
|
||||||
$(call ssh,"sudo touch /media/embassy/config/upgrade && sudo rm -f /media/embassy/config/disk.guid && sudo sync && sudo reboot")
|
$(call ssh,"sudo touch /media/embassy/config/upgrade && sudo rm -f /media/embassy/config/disk.guid && sudo sync && sudo reboot")
|
||||||
|
|
||||||
system-images/compat/docker-images/aarch64.tar system-images/compat/docker-images/x86_64.tar: $(COMPAT_SRC) backend/Cargo.lock
|
build/lib/depends build/lib/conflicts: build/dpkg-deps/*
|
||||||
cd system-images/compat && make && touch docker-images/*.tar
|
build/dpkg-deps/generate.sh
|
||||||
|
|
||||||
system-images/utils/docker-images/aarch64.tar system-images/utils/docker-images/x86_64.tar: $(UTILS_SRC)
|
system-images/compat/docker-images/$(ARCH).tar: $(COMPAT_SRC) backend/Cargo.lock | docker-buildx
|
||||||
cd system-images/utils && make && touch docker-images/*.tar
|
cd system-images/compat && make docker-images/$(ARCH).tar && touch docker-images/$(ARCH).tar
|
||||||
|
|
||||||
system-images/binfmt/docker-images/aarch64.tar system-images/binfmt/docker-images/x86_64.tar: $(BINFMT_SRC)
|
system-images/utils/docker-images/$(ARCH).tar: $(UTILS_SRC) | docker-buildx
|
||||||
cd system-images/binfmt && make && touch docker-images/*.tar
|
cd system-images/utils && make docker-images/$(ARCH).tar && touch docker-images/$(ARCH).tar
|
||||||
|
|
||||||
|
system-images/binfmt/docker-images/$(ARCH).tar: $(BINFMT_SRC) | docker-buildx
|
||||||
|
cd system-images/binfmt && make docker-images/$(ARCH).tar && touch docker-images/$(ARCH).tar
|
||||||
|
|
||||||
snapshots: libs/snapshot_creator/Cargo.toml
|
snapshots: libs/snapshot_creator/Cargo.toml
|
||||||
cd libs/ && ./build-v8-snapshot.sh
|
cd libs/ && ./build-v8-snapshot.sh
|
||||||
@@ -152,27 +181,23 @@ $(EMBASSY_BINS): $(BACKEND_SRC) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) frontend/pa
|
|||||||
frontend/node_modules: frontend/package.json
|
frontend/node_modules: frontend/package.json
|
||||||
npm --prefix frontend ci
|
npm --prefix frontend ci
|
||||||
|
|
||||||
frontend/dist/raw/ui: $(FRONTEND_UI_SRC) $(FRONTEND_SHARED_SRC) $(ENVIRONMENT_FILE)
|
frontend/dist/raw/ui: $(FRONTEND_UI_SRC) $(FRONTEND_SHARED_SRC)
|
||||||
npm --prefix frontend run build:ui
|
npm --prefix frontend run build:ui
|
||||||
|
|
||||||
frontend/dist/raw/setup-wizard: $(FRONTEND_SETUP_WIZARD_SRC) $(FRONTEND_SHARED_SRC) $(ENVIRONMENT_FILE)
|
frontend/dist/raw/setup-wizard: $(FRONTEND_SETUP_WIZARD_SRC) $(FRONTEND_SHARED_SRC)
|
||||||
npm --prefix frontend run build:setup
|
npm --prefix frontend run build:setup
|
||||||
|
|
||||||
frontend/dist/raw/diagnostic-ui: $(FRONTEND_DIAGNOSTIC_UI_SRC) $(FRONTEND_SHARED_SRC) $(ENVIRONMENT_FILE)
|
frontend/dist/raw/diagnostic-ui: $(FRONTEND_DIAGNOSTIC_UI_SRC) $(FRONTEND_SHARED_SRC)
|
||||||
npm --prefix frontend run build:dui
|
npm --prefix frontend run build:dui
|
||||||
|
|
||||||
frontend/dist/raw/install-wizard: $(FRONTEND_INSTALL_WIZARD_SRC) $(FRONTEND_SHARED_SRC) $(ENVIRONMENT_FILE)
|
frontend/dist/raw/install-wizard: $(FRONTEND_INSTALL_WIZARD_SRC) $(FRONTEND_SHARED_SRC)
|
||||||
npm --prefix frontend run build:install-wiz
|
npm --prefix frontend run build:install-wiz
|
||||||
|
|
||||||
frontend/dist/static: $(EMBASSY_UIS)
|
frontend/dist/static: $(EMBASSY_UIS) $(ENVIRONMENT_FILE)
|
||||||
./compress-uis.sh
|
./compress-uis.sh
|
||||||
|
|
||||||
frontend/config.json: $(GIT_HASH_FILE) frontend/config-sample.json
|
frontend/config.json: $(GIT_HASH_FILE) frontend/config-sample.json
|
||||||
jq '.useMocks = false' frontend/config-sample.json > frontend/config.json
|
jq '.useMocks = false' frontend/config-sample.json | jq '.gitHash = "$(shell cat GIT_HASH.txt)"' > frontend/config.json
|
||||||
jq '.packageArch = "$(ARCH)"' frontend/config.json > frontend/config.json.tmp
|
|
||||||
jq '.osArch = "$(OS_ARCH)"' frontend/config.json.tmp > frontend/config.json
|
|
||||||
rm frontend/config.json.tmp
|
|
||||||
npm --prefix frontend run-script build-config
|
|
||||||
|
|
||||||
frontend/patchdb-ui-seed.json: frontend/package.json
|
frontend/patchdb-ui-seed.json: frontend/package.json
|
||||||
jq '."ack-welcome" = $(shell yq '.version' frontend/package.json)' frontend/patchdb-ui-seed.json > ui-seed.tmp
|
jq '."ack-welcome" = $(shell yq '.version' frontend/package.json)' frontend/patchdb-ui-seed.json > ui-seed.tmp
|
||||||
@@ -186,7 +211,7 @@ patch-db/client/dist: $(PATCH_DB_CLIENT_SRC) patch-db/client/node_modules
|
|||||||
npm --prefix frontend run build:deps
|
npm --prefix frontend run build:deps
|
||||||
|
|
||||||
# used by github actions
|
# used by github actions
|
||||||
backend-$(ARCH).tar: $(EMBASSY_BINS)
|
compiled-$(ARCH).tar: $(COMPILED_TARGETS) $(ENVIRONMENT_FILE) $(GIT_HASH_FILE) $(VERSION_FILE)
|
||||||
tar -cvf $@ $^
|
tar -cvf $@ $^
|
||||||
|
|
||||||
# this is a convenience step to build all frontends - it is not referenced elsewhere in this file
|
# this is a convenience step to build all frontends - it is not referenced elsewhere in this file
|
||||||
@@ -195,9 +220,6 @@ frontends: $(EMBASSY_UIS)
|
|||||||
# this is a convenience step to build the UI
|
# this is a convenience step to build the UI
|
||||||
ui: frontend/dist/raw/ui
|
ui: frontend/dist/raw/ui
|
||||||
|
|
||||||
# used by github actions
|
|
||||||
backend: $(EMBASSY_BINS)
|
|
||||||
|
|
||||||
cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep:
|
cargo-deps/aarch64-unknown-linux-gnu/release/pi-beep:
|
||||||
ARCH=aarch64 ./build-cargo-dep.sh pi-beep
|
ARCH=aarch64 ./build-cargo-dep.sh pi-beep
|
||||||
|
|
||||||
|
|||||||
23
backend/Cargo.lock
generated
23
backend/Cargo.lock
generated
@@ -1896,28 +1896,6 @@ version = "0.28.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "git-version"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
|
|
||||||
dependencies = [
|
|
||||||
"git-version-macro",
|
|
||||||
"proc-macro-hack",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "git-version-macro"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro-hack",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glob"
|
name = "glob"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@@ -4938,7 +4916,6 @@ dependencies = [
|
|||||||
"emver",
|
"emver",
|
||||||
"fd-lock-rs",
|
"fd-lock-rs",
|
||||||
"futures",
|
"futures",
|
||||||
"git-version",
|
|
||||||
"gpt",
|
"gpt",
|
||||||
"helpers",
|
"helpers",
|
||||||
"hex",
|
"hex",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ name = "start-os"
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/Start9Labs/start-os"
|
repository = "https://github.com/Start9Labs/start-os"
|
||||||
version = "0.3.5"
|
version = "0.3.5"
|
||||||
|
license = "MIT"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "startos"
|
name = "startos"
|
||||||
@@ -31,7 +32,7 @@ cli = []
|
|||||||
daemon = []
|
daemon = []
|
||||||
default = ["cli", "sdk", "daemon", "js_engine"]
|
default = ["cli", "sdk", "daemon", "js_engine"]
|
||||||
dev = []
|
dev = []
|
||||||
podman = []
|
docker = []
|
||||||
sdk = []
|
sdk = []
|
||||||
unstable = ["console-subscriber", "tokio/tracing"]
|
unstable = ["console-subscriber", "tokio/tracing"]
|
||||||
|
|
||||||
@@ -76,7 +77,6 @@ emver = { version = "0.1.7", git = "https://github.com/Start9Labs/emver-rs.git",
|
|||||||
] }
|
] }
|
||||||
fd-lock-rs = "0.1.4"
|
fd-lock-rs = "0.1.4"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
git-version = "0.3.5"
|
|
||||||
gpt = "3.1.0"
|
gpt = "3.1.0"
|
||||||
helpers = { path = "../libs/helpers" }
|
helpers = { path = "../libs/helpers" }
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
|||||||
@@ -3,11 +3,6 @@
|
|||||||
set -e
|
set -e
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
|
|
||||||
if [ -z "$OS_ARCH" ]; then
|
|
||||||
>&2 echo '$OS_ARCH is required'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$ARCH" ]; then
|
if [ -z "$ARCH" ]; then
|
||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
fi
|
fi
|
||||||
@@ -23,27 +18,17 @@ if tty -s; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
FLAGS=""
|
FEATURES="$(echo $ENVIRONMENT | sed 's/-/,/g')"
|
||||||
RUSTFLAGS=""
|
RUSTFLAGS=""
|
||||||
if [[ "$ENVIRONMENT" =~ (^|-)podman($|-) ]]; then
|
|
||||||
FLAGS="podman,$FLAGS"
|
|
||||||
fi
|
|
||||||
if [[ "$ENVIRONMENT" =~ (^|-)unstable($|-) ]]; then
|
|
||||||
FLAGS="unstable,$FLAGS"
|
|
||||||
RUSTFLAGS="$RUSTFLAGS --cfg tokio_unstable"
|
|
||||||
fi
|
|
||||||
if [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
|
||||||
FLAGS="dev,$FLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
alias 'rust-gnu-builder'='docker run $USE_TTY --rm -e "OS_ARCH=$OS_ARCH" -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/usr/local/cargo/registry -v "$(pwd)":/home/rust/src -w /home/rust/src -P start9/rust-arm-cross:aarch64'
|
alias 'rust-gnu-builder'='docker run $USE_TTY --rm -e "RUSTFLAGS=$RUSTFLAGS" -v "$HOME/.cargo/registry":/usr/local/cargo/registry -v "$(pwd)":/home/rust/src -w /home/rust/src -P start9/rust-arm-cross:aarch64'
|
||||||
alias 'rust-musl-builder'='docker run $USE_TTY --rm -e "OS_ARCH=$OS_ARCH" -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)":/home/rust/src -P messense/rust-musl-cross:$ARCH-musl'
|
alias 'rust-musl-builder'='docker run $USE_TTY --rm -v "$HOME/.cargo/registry":/root/.cargo/registry -v "$(pwd)":/home/rust/src -P messense/rust-musl-cross:$ARCH-musl'
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
fail=
|
fail=
|
||||||
echo "FLAGS=\"$FLAGS\""
|
echo "FEATURES=\"$FEATURES\""
|
||||||
echo "RUSTFLAGS=\"$RUSTFLAGS\""
|
echo "RUSTFLAGS=\"$RUSTFLAGS\""
|
||||||
rust-gnu-builder sh -c "(cd backend && cargo build --release --features avahi-alias,$FLAGS --locked --target=$ARCH-unknown-linux-gnu)"
|
rust-gnu-builder sh -c "(cd backend && cargo build --release --features avahi-alias,$FEATURES --locked --target=$ARCH-unknown-linux-gnu)"
|
||||||
if test $? -ne 0; then
|
if test $? -ne 0; then
|
||||||
fail=true
|
fail=true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ fi
|
|||||||
frontend="../frontend/dist/static"
|
frontend="../frontend/dist/static"
|
||||||
[ -d "$frontend" ] || mkdir -p "$frontend"
|
[ -d "$frontend" ] || mkdir -p "$frontend"
|
||||||
|
|
||||||
if [ -z "$OS_ARCH" ]; then
|
if [ -z "$PLATFORM" ]; then
|
||||||
export OS_ARCH=$(uname -m)
|
export PLATFORM=$(uname -m)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cargo install --path=. --no-default-features --features=js_engine,sdk,cli --locked
|
cargo install --path=. --no-default-features --features=js_engine,sdk,cli --locked
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
use clap::Arg;
|
|
||||||
use rpc_toolkit::command;
|
|
||||||
use rpc_toolkit::run_cli;
|
|
||||||
use rpc_toolkit::yajrc::RpcError;
|
use rpc_toolkit::yajrc::RpcError;
|
||||||
|
use rpc_toolkit::{command, run_cli, Context};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::context::CliContext;
|
|
||||||
use crate::procedure::js_scripts::ExecuteArgs;
|
use crate::procedure::js_scripts::ExecuteArgs;
|
||||||
use crate::s9pk::manifest::PackageId;
|
use crate::s9pk::manifest::PackageId;
|
||||||
use crate::util::logger::EmbassyLogger;
|
|
||||||
use crate::util::serde::{display_serializable, parse_stdin_deserializable};
|
use crate::util::serde::{display_serializable, parse_stdin_deserializable};
|
||||||
use crate::version::{Current, VersionT};
|
use crate::version::{Current, VersionT};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
@@ -16,6 +12,9 @@ lazy_static::lazy_static! {
|
|||||||
static ref VERSION_STRING: String = Current::new().semver().to_string();
|
static ref VERSION_STRING: String = Current::new().semver().to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct DenoContext;
|
||||||
|
impl Context for DenoContext {}
|
||||||
|
|
||||||
#[command(subcommands(execute, sandbox))]
|
#[command(subcommands(execute, sandbox))]
|
||||||
fn deno_api() -> Result<(), Error> {
|
fn deno_api() -> Result<(), Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -103,16 +102,8 @@ fn inner_main() -> Result<(), Error> {
|
|||||||
command: deno_api,
|
command: deno_api,
|
||||||
app: app => app
|
app: app => app
|
||||||
.name("StartOS Deno Executor")
|
.name("StartOS Deno Executor")
|
||||||
.version(&**VERSION_STRING)
|
.version(&**VERSION_STRING),
|
||||||
.arg(
|
context: _m => DenoContext,
|
||||||
clap::Arg::with_name("config")
|
|
||||||
.short('c')
|
|
||||||
.long("config")
|
|
||||||
.takes_value(true),
|
|
||||||
),
|
|
||||||
context: matches => {
|
|
||||||
CliContext::init(matches)?
|
|
||||||
},
|
|
||||||
exit: |e: RpcError| {
|
exit: |e: RpcError| {
|
||||||
match e.data {
|
match e.data {
|
||||||
Some(Value::String(s)) => eprintln!("{}: {}", e.message, s),
|
Some(Value::String(s)) => eprintln!("{}: {}", e.message, s),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::net::web_server::WebServer;
|
|||||||
use crate::shutdown::Shutdown;
|
use crate::shutdown::Shutdown;
|
||||||
use crate::sound::CHIME;
|
use crate::sound::CHIME;
|
||||||
use crate::util::Invoke;
|
use crate::util::Invoke;
|
||||||
use crate::{Error, ErrorKind, ResultExt, OS_ARCH};
|
use crate::{Error, ErrorKind, ResultExt, PLATFORM};
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
async fn setup_or_init(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Error> {
|
async fn setup_or_init(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Error> {
|
||||||
@@ -30,19 +30,19 @@ async fn setup_or_init(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Er
|
|||||||
|
|
||||||
Command::new("ln")
|
Command::new("ln")
|
||||||
.arg("-sf")
|
.arg("-sf")
|
||||||
.arg("/usr/lib/embassy/scripts/fake-apt")
|
.arg("/usr/lib/startos/scripts/fake-apt")
|
||||||
.arg("/usr/local/bin/apt")
|
.arg("/usr/local/bin/apt")
|
||||||
.invoke(crate::ErrorKind::OpenSsh)
|
.invoke(crate::ErrorKind::OpenSsh)
|
||||||
.await?;
|
.await?;
|
||||||
Command::new("ln")
|
Command::new("ln")
|
||||||
.arg("-sf")
|
.arg("-sf")
|
||||||
.arg("/usr/lib/embassy/scripts/fake-apt")
|
.arg("/usr/lib/startos/scripts/fake-apt")
|
||||||
.arg("/usr/local/bin/apt-get")
|
.arg("/usr/local/bin/apt-get")
|
||||||
.invoke(crate::ErrorKind::OpenSsh)
|
.invoke(crate::ErrorKind::OpenSsh)
|
||||||
.await?;
|
.await?;
|
||||||
Command::new("ln")
|
Command::new("ln")
|
||||||
.arg("-sf")
|
.arg("-sf")
|
||||||
.arg("/usr/lib/embassy/scripts/fake-apt")
|
.arg("/usr/lib/startos/scripts/fake-apt")
|
||||||
.arg("/usr/local/bin/aptitude")
|
.arg("/usr/local/bin/aptitude")
|
||||||
.invoke(crate::ErrorKind::OpenSsh)
|
.invoke(crate::ErrorKind::OpenSsh)
|
||||||
.await?;
|
.await?;
|
||||||
@@ -177,7 +177,7 @@ async fn run_script_if_exists<P: AsRef<Path>>(path: P) {
|
|||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
async fn inner_main(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Error> {
|
async fn inner_main(cfg_path: Option<PathBuf>) -> Result<Option<Shutdown>, Error> {
|
||||||
if OS_ARCH == "raspberrypi" && tokio::fs::metadata(STANDBY_MODE_PATH).await.is_ok() {
|
if &*PLATFORM == "raspberrypi" && tokio::fs::metadata(STANDBY_MODE_PATH).await.is_ok() {
|
||||||
tokio::fs::remove_file(STANDBY_MODE_PATH).await?;
|
tokio::fs::remove_file(STANDBY_MODE_PATH).await?;
|
||||||
Command::new("sync").invoke(ErrorKind::Filesystem).await?;
|
Command::new("sync").invoke(ErrorKind::Filesystem).await?;
|
||||||
crate::sound::SHUTDOWN.play().await?;
|
crate::sound::SHUTDOWN.play().await?;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::borrow::{Borrow, Cow};
|
use std::borrow::{Cow};
|
||||||
use std::collections::{BTreeMap, BTreeSet};
|
use std::collections::{BTreeMap, BTreeSet};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
@@ -105,7 +105,7 @@ where
|
|||||||
rng: &mut R,
|
rng: &mut R,
|
||||||
timeout: &Option<Duration>,
|
timeout: &Option<Duration>,
|
||||||
) -> Result<Value, Self::Error> {
|
) -> Result<Value, Self::Error> {
|
||||||
self.gen_with(self.default_spec().borrow(), rng, timeout)
|
self.gen_with(self.default_spec(), rng, timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use emver::VersionRange;
|
use emver::VersionRange;
|
||||||
|
use imbl_value::InternedString;
|
||||||
use ipnet::{Ipv4Net, Ipv6Net};
|
use ipnet::{Ipv4Net, Ipv6Net};
|
||||||
use isocountry::CountryCode;
|
use isocountry::CountryCode;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
@@ -23,6 +24,7 @@ use crate::s9pk::manifest::{Manifest, PackageId};
|
|||||||
use crate::status::Status;
|
use crate::status::Status;
|
||||||
use crate::util::Version;
|
use crate::util::Version;
|
||||||
use crate::version::{Current, VersionT};
|
use crate::version::{Current, VersionT};
|
||||||
|
use crate::{ARCH, PLATFORM};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
@@ -38,6 +40,8 @@ impl Database {
|
|||||||
let lan_address = account.hostname.lan_address().parse().unwrap();
|
let lan_address = account.hostname.lan_address().parse().unwrap();
|
||||||
Database {
|
Database {
|
||||||
server_info: ServerInfo {
|
server_info: ServerInfo {
|
||||||
|
arch: get_arch(),
|
||||||
|
platform: get_platform(),
|
||||||
id: account.server_id.clone(),
|
id: account.server_id.clone(),
|
||||||
version: Current::new().semver().into(),
|
version: Current::new().semver().into(),
|
||||||
hostname: account.hostname.no_dot_host_name(),
|
hostname: account.hostname.no_dot_host_name(),
|
||||||
@@ -87,10 +91,22 @@ impl Database {
|
|||||||
|
|
||||||
pub type DatabaseModel = Model<Database>;
|
pub type DatabaseModel = Model<Database>;
|
||||||
|
|
||||||
|
fn get_arch() -> InternedString {
|
||||||
|
(*ARCH).into()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_platform() -> InternedString {
|
||||||
|
(&*PLATFORM).into()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
#[derive(Debug, Deserialize, Serialize, HasModel)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
#[model = "Model<Self>"]
|
#[model = "Model<Self>"]
|
||||||
pub struct ServerInfo {
|
pub struct ServerInfo {
|
||||||
|
#[serde(default = "get_arch")]
|
||||||
|
pub arch: InternedString,
|
||||||
|
#[serde(default = "get_platform")]
|
||||||
|
pub platform: InternedString,
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub async fn update_firmware() -> Result<RequiresReboot, Error> {
|
|||||||
if product_name.is_empty() {
|
if product_name.is_empty() {
|
||||||
return Ok(RequiresReboot(false));
|
return Ok(RequiresReboot(false));
|
||||||
}
|
}
|
||||||
let firmware_dir = Path::new("/usr/lib/embassy/firmware").join(&product_name);
|
let firmware_dir = Path::new("/usr/lib/startos/firmware").join(&product_name);
|
||||||
if tokio::fs::metadata(&firmware_dir).await.is_ok() {
|
if tokio::fs::metadata(&firmware_dir).await.is_ok() {
|
||||||
let current_firmware = String::from_utf8(
|
let current_firmware = String::from_utf8(
|
||||||
Command::new("dmidecode")
|
Command::new("dmidecode")
|
||||||
|
|||||||
@@ -263,6 +263,9 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
tracing::info!("Mounted Logs");
|
tracing::info!("Mounted Logs");
|
||||||
|
|
||||||
let tmp_dir = cfg.datadir().join("package-data/tmp");
|
let tmp_dir = cfg.datadir().join("package-data/tmp");
|
||||||
|
if should_rebuild && tokio::fs::metadata(&tmp_dir).await.is_ok() {
|
||||||
|
tokio::fs::remove_dir_all(&tmp_dir).await?;
|
||||||
|
}
|
||||||
if tokio::fs::metadata(&tmp_dir).await.is_err() {
|
if tokio::fs::metadata(&tmp_dir).await.is_err() {
|
||||||
tokio::fs::create_dir_all(&tmp_dir).await?;
|
tokio::fs::create_dir_all(&tmp_dir).await?;
|
||||||
}
|
}
|
||||||
@@ -275,9 +278,6 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
.datadir()
|
.datadir()
|
||||||
.join(format!("package-data/tmp/{CONTAINER_TOOL}"));
|
.join(format!("package-data/tmp/{CONTAINER_TOOL}"));
|
||||||
let tmp_docker_exists = tokio::fs::metadata(&tmp_docker).await.is_ok();
|
let tmp_docker_exists = tokio::fs::metadata(&tmp_docker).await.is_ok();
|
||||||
if should_rebuild && tmp_docker_exists {
|
|
||||||
tokio::fs::remove_dir_all(&tmp_docker).await?;
|
|
||||||
}
|
|
||||||
if CONTAINER_TOOL == "docker" {
|
if CONTAINER_TOOL == "docker" {
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
.arg("stop")
|
.arg("stop")
|
||||||
@@ -309,7 +309,7 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tracing::info!("Loading System Docker Images");
|
tracing::info!("Loading System Docker Images");
|
||||||
crate::install::load_images("/usr/lib/embassy/system-images").await?;
|
crate::install::load_images("/usr/lib/startos/system-images").await?;
|
||||||
tracing::info!("Loaded System Docker Images");
|
tracing::info!("Loaded System Docker Images");
|
||||||
|
|
||||||
tracing::info!("Loading Package Docker Images");
|
tracing::info!("Loading Package Docker Images");
|
||||||
|
|||||||
@@ -5,12 +5,18 @@ pub const DEFAULT_MARKETPLACE: &str = "https://registry.start9.com";
|
|||||||
pub const BUFFER_SIZE: usize = 1024;
|
pub const BUFFER_SIZE: usize = 1024;
|
||||||
pub const HOST_IP: [u8; 4] = [172, 18, 0, 1];
|
pub const HOST_IP: [u8; 4] = [172, 18, 0, 1];
|
||||||
pub const TARGET: &str = current_platform::CURRENT_PLATFORM;
|
pub const TARGET: &str = current_platform::CURRENT_PLATFORM;
|
||||||
pub const OS_ARCH: &str = env!("OS_ARCH");
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub static ref ARCH: &'static str = {
|
pub static ref ARCH: &'static str = {
|
||||||
let (arch, _) = TARGET.split_once("-").unwrap();
|
let (arch, _) = TARGET.split_once("-").unwrap();
|
||||||
arch
|
arch
|
||||||
};
|
};
|
||||||
|
pub static ref PLATFORM: String = {
|
||||||
|
if let Ok(platform) = std::fs::read_to_string("/usr/lib/startos/PLATFORM.txt") {
|
||||||
|
platform
|
||||||
|
} else {
|
||||||
|
ARCH.to_string()
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod account;
|
pub mod account;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ pub struct JournalctlEntry {
|
|||||||
#[serde(rename = "__REALTIME_TIMESTAMP")]
|
#[serde(rename = "__REALTIME_TIMESTAMP")]
|
||||||
pub timestamp: String,
|
pub timestamp: String,
|
||||||
#[serde(rename = "MESSAGE")]
|
#[serde(rename = "MESSAGE")]
|
||||||
#[serde(deserialize_with = "deserialize_string_or_utf8_array")]
|
#[serde(deserialize_with = "deserialize_log_message")]
|
||||||
pub message: String,
|
pub message: String,
|
||||||
#[serde(rename = "__CURSOR")]
|
#[serde(rename = "__CURSOR")]
|
||||||
pub cursor: String,
|
pub cursor: String,
|
||||||
@@ -164,7 +164,7 @@ impl JournalctlEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn deserialize_string_or_utf8_array<'de, D: serde::de::Deserializer<'de>>(
|
fn deserialize_log_message<'de, D: serde::de::Deserializer<'de>>(
|
||||||
deserializer: D,
|
deserializer: D,
|
||||||
) -> std::result::Result<String, D::Error> {
|
) -> std::result::Result<String, D::Error> {
|
||||||
struct Visitor;
|
struct Visitor;
|
||||||
@@ -177,13 +177,7 @@ fn deserialize_string_or_utf8_array<'de, D: serde::de::Deserializer<'de>>(
|
|||||||
where
|
where
|
||||||
E: serde::de::Error,
|
E: serde::de::Error,
|
||||||
{
|
{
|
||||||
Ok(v.to_owned())
|
Ok(v.trim().to_owned())
|
||||||
}
|
|
||||||
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
|
||||||
where
|
|
||||||
E: serde::de::Error,
|
|
||||||
{
|
|
||||||
Ok(v)
|
|
||||||
}
|
}
|
||||||
fn visit_unit<E>(self) -> Result<Self::Value, E>
|
fn visit_unit<E>(self) -> Result<Self::Value, E>
|
||||||
where
|
where
|
||||||
@@ -201,6 +195,7 @@ fn deserialize_string_or_utf8_array<'de, D: serde::de::Deserializer<'de>>(
|
|||||||
.flatten()
|
.flatten()
|
||||||
.collect::<Result<Vec<u8>, _>>()?,
|
.collect::<Result<Vec<u8>, _>>()?,
|
||||||
)
|
)
|
||||||
|
.map(|s| s.trim().to_owned())
|
||||||
.map_err(serde::de::Error::custom)
|
.map_err(serde::de::Error::custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -374,12 +369,12 @@ pub async fn journalctl(
|
|||||||
cmd.arg(format!("_COMM={}", SYSTEM_UNIT));
|
cmd.arg(format!("_COMM={}", SYSTEM_UNIT));
|
||||||
}
|
}
|
||||||
LogSource::Container(id) => {
|
LogSource::Container(id) => {
|
||||||
#[cfg(feature = "podman")]
|
#[cfg(not(feature = "docker"))]
|
||||||
cmd.arg(format!(
|
cmd.arg(format!(
|
||||||
"SYSLOG_IDENTIFIER={}",
|
"SYSLOG_IDENTIFIER={}",
|
||||||
DockerProcedure::container_name(&id, None)
|
DockerProcedure::container_name(&id, None)
|
||||||
));
|
));
|
||||||
#[cfg(not(feature = "podman"))]
|
#[cfg(feature = "docker")]
|
||||||
cmd.arg(format!(
|
cmd.arg(format!(
|
||||||
"CONTAINER_NAME={}",
|
"CONTAINER_NAME={}",
|
||||||
DockerProcedure::container_name(&id, None)
|
DockerProcedure::container_name(&id, None)
|
||||||
|
|||||||
@@ -813,7 +813,7 @@ impl LongRunning {
|
|||||||
socket_path: &Path,
|
socket_path: &Path,
|
||||||
) -> Result<tokio::process::Command, Error> {
|
) -> Result<tokio::process::Command, Error> {
|
||||||
const INIT_EXEC: &str = "/start9/bin/embassy_container_init";
|
const INIT_EXEC: &str = "/start9/bin/embassy_container_init";
|
||||||
const BIND_LOCATION: &str = "/usr/lib/embassy/container/";
|
const BIND_LOCATION: &str = "/usr/lib/startos/container/";
|
||||||
tracing::trace!("setup_long_running_docker_cmd");
|
tracing::trace!("setup_long_running_docker_cmd");
|
||||||
|
|
||||||
remove_container(container_name, true).await?;
|
remove_container(container_name, true).await?;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ pub fn with_query_params(ctx: RpcContext, mut url: Url) -> Url {
|
|||||||
"os.compat",
|
"os.compat",
|
||||||
&crate::version::Current::new().compat().to_string(),
|
&crate::version::Current::new().compat().to_string(),
|
||||||
)
|
)
|
||||||
.append_pair("os.arch", crate::OS_ARCH)
|
.append_pair("os.arch", &*crate::PLATFORM)
|
||||||
.append_pair("hardware.arch", &*crate::ARCH)
|
.append_pair("hardware.arch", &*crate::ARCH)
|
||||||
.append_pair("hardware.ram", &ctx.hardware.ram.to_string());
|
.append_pair("hardware.ram", &ctx.hardware.ram.to_string());
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use crate::init::{STANDBY_MODE_PATH, SYSTEM_REBUILD_PATH};
|
|||||||
use crate::sound::SHUTDOWN;
|
use crate::sound::SHUTDOWN;
|
||||||
use crate::util::docker::CONTAINER_TOOL;
|
use crate::util::docker::CONTAINER_TOOL;
|
||||||
use crate::util::{display_none, Invoke};
|
use crate::util::{display_none, Invoke};
|
||||||
use crate::{Error, OS_ARCH};
|
use crate::{Error, PLATFORM};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Shutdown {
|
pub struct Shutdown {
|
||||||
@@ -60,7 +60,7 @@ impl Shutdown {
|
|||||||
tracing::debug!("{:?}", e);
|
tracing::debug!("{:?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if OS_ARCH != "raspberrypi" || self.restart {
|
if &*PLATFORM != "raspberrypi" || self.restart {
|
||||||
if let Err(e) = SHUTDOWN.play().await {
|
if let Err(e) = SHUTDOWN.play().await {
|
||||||
tracing::error!("Error Playing Shutdown Song: {}", e);
|
tracing::error!("Error Playing Shutdown Song: {}", e);
|
||||||
tracing::debug!("{:?}", e);
|
tracing::debug!("{:?}", e);
|
||||||
@@ -68,7 +68,7 @@ impl Shutdown {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
drop(rt);
|
drop(rt);
|
||||||
if OS_ARCH == "raspberrypi" {
|
if &*PLATFORM == "raspberrypi" {
|
||||||
if !self.restart {
|
if !self.restart {
|
||||||
std::fs::write(STANDBY_MODE_PATH, "").unwrap();
|
std::fs::write(STANDBY_MODE_PATH, "").unwrap();
|
||||||
Command::new("sync").spawn().unwrap().wait().unwrap();
|
Command::new("sync").spawn().unwrap().wait().unwrap();
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ use crate::sound::{
|
|||||||
};
|
};
|
||||||
use crate::update::latest_information::LatestInformation;
|
use crate::update::latest_information::LatestInformation;
|
||||||
use crate::util::Invoke;
|
use crate::util::Invoke;
|
||||||
use crate::{Error, ErrorKind, ResultExt, OS_ARCH};
|
use crate::{Error, ErrorKind, ResultExt, PLATFORM};
|
||||||
|
|
||||||
mod latest_information;
|
mod latest_information;
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ impl EosUrl {
|
|||||||
.host_str()
|
.host_str()
|
||||||
.ok_or_else(|| Error::new(eyre!("Could not get host of base"), ErrorKind::ParseUrl))?;
|
.ok_or_else(|| Error::new(eyre!("Could not get host of base"), ErrorKind::ParseUrl))?;
|
||||||
let version: &Version = &self.version;
|
let version: &Version = &self.version;
|
||||||
Ok(format!("{host}::{version}/{OS_ARCH}/")
|
Ok(format!("{host}::{version}/{}/", &*PLATFORM)
|
||||||
.parse()
|
.parse()
|
||||||
.map_err(|_| Error::new(eyre!("Could not parse path"), ErrorKind::ParseUrl))?)
|
.map_err(|_| Error::new(eyre!("Could not parse path"), ErrorKind::ParseUrl))?)
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ async fn sync_boot() -> Result<(), Error> {
|
|||||||
.await?
|
.await?
|
||||||
.wait()
|
.wait()
|
||||||
.await?;
|
.await?;
|
||||||
if OS_ARCH != "raspberrypi" {
|
if &*PLATFORM != "raspberrypi" {
|
||||||
let dev_mnt =
|
let dev_mnt =
|
||||||
MountGuard::mount(&Bind::new("/dev"), "/media/embassy/next/dev", ReadWrite).await?;
|
MountGuard::mount(&Bind::new("/dev"), "/media/embassy/next/dev", ReadWrite).await?;
|
||||||
let sys_mnt =
|
let sys_mnt =
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ use tokio::process::Command;
|
|||||||
|
|
||||||
use crate::util::Invoke;
|
use crate::util::Invoke;
|
||||||
|
|
||||||
#[cfg(not(feature = "podman"))]
|
#[cfg(feature = "docker")]
|
||||||
pub const CONTAINER_TOOL: &str = "docker";
|
pub const CONTAINER_TOOL: &str = "docker";
|
||||||
#[cfg(feature = "podman")]
|
#[cfg(not(feature = "docker"))]
|
||||||
pub const CONTAINER_TOOL: &str = "podman";
|
pub const CONTAINER_TOOL: &str = "podman";
|
||||||
|
|
||||||
#[cfg(not(feature = "podman"))]
|
#[cfg(feature = "docker")]
|
||||||
pub const CONTAINER_DATADIR: &str = "/var/lib/docker";
|
pub const CONTAINER_DATADIR: &str = "/var/lib/docker";
|
||||||
#[cfg(feature = "podman")]
|
#[cfg(not(feature = "docker"))]
|
||||||
pub const CONTAINER_DATADIR: &str = "/var/lib/containers";
|
pub const CONTAINER_DATADIR: &str = "/var/lib/containers";
|
||||||
|
|
||||||
pub struct DockerImageSha(String);
|
pub struct DockerImageSha(String);
|
||||||
|
|||||||
@@ -182,8 +182,7 @@ pub async fn init(db: &PatchDb, secrets: &PgPool) -> Result<(), Error> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const COMMIT_HASH: &str =
|
pub const COMMIT_HASH: &str = include_str!("../../../GIT_HASH.txt");
|
||||||
git_version::git_version!(args = ["--always", "--abbrev=40", "--dirty=-modified"]);
|
|
||||||
|
|
||||||
#[command(rename = "git-info", local, metadata(authenticated = false))]
|
#[command(rename = "git-info", local, metadata(authenticated = false))]
|
||||||
pub fn git_info() -> Result<&'static str, Error> {
|
pub fn git_info() -> Result<&'static str, Error> {
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ export const action = {
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Created this test because of issue
|
* Created this test because of issue
|
||||||
* https://github.com/Start9Labs/embassy-os/issues/1737
|
* https://github.com/Start9Labs/start-os/issues/1737
|
||||||
* which that we couldn't create a dir that was deeply nested, and the parents where
|
* which that we couldn't create a dir that was deeply nested, and the parents where
|
||||||
* not created yet. Found this out during the migrations, where the parent would die.
|
* not created yet. Found this out during the migrations, where the parent would die.
|
||||||
* @param {*} effects
|
* @param {*} effects
|
||||||
@@ -933,7 +933,7 @@ export const action = {
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Created this test because of issue
|
* Created this test because of issue
|
||||||
* https://github.com/Start9Labs/embassy-os/issues/2121
|
* https://github.com/Start9Labs/start-os/issues/2121
|
||||||
* That the empty in the create dies
|
* That the empty in the create dies
|
||||||
* @param {*} effects
|
* @param {*} effects
|
||||||
* @param {*} _input
|
* @param {*} _input
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ docker run -d --rm --name=tmp_postgres -e POSTGRES_PASSWORD=password -v $TMP_DIR
|
|||||||
PG_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' tmp_postgres)
|
PG_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' tmp_postgres)
|
||||||
|
|
||||||
DATABASE_URL=postgres://postgres:password@$PG_IP/postgres cargo sqlx migrate run
|
DATABASE_URL=postgres://postgres:password@$PG_IP/postgres cargo sqlx migrate run
|
||||||
DATABASE_URL=postgres://postgres:password@$PG_IP/postgres OS_ARCH=$(uname -m) cargo sqlx prepare -- --lib --profile=test
|
DATABASE_URL=postgres://postgres:password@$PG_IP/postgres PLATFORM=$(uname -m) cargo sqlx prepare -- --lib --profile=test
|
||||||
)
|
)
|
||||||
|
|
||||||
docker stop tmp_postgres
|
docker stop tmp_postgres
|
||||||
|
|||||||
19
basename.sh
Executable file
19
basename.sh
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
PLATFORM=$(if [ -f ./PLATFORM.txt ]; then cat ./PLATFORM.txt; else echo unknown; fi)
|
||||||
|
VERSION="$(cat ./VERSION.txt)"
|
||||||
|
GIT_HASH="$(cat ./GIT_HASH.txt)"
|
||||||
|
if [[ "$GIT_HASH" =~ ^@ ]]; then
|
||||||
|
GIT_HASH=unknown
|
||||||
|
else
|
||||||
|
GIT_HASH="$(echo -n "$GIT_HASH" | head -c 7)"
|
||||||
|
fi
|
||||||
|
STARTOS_ENV="$(cat ./ENVIRONMENT.txt)"
|
||||||
|
VERSION_FULL="${VERSION}-${GIT_HASH}"
|
||||||
|
if [ -n "$STARTOS_ENV" ]; then
|
||||||
|
VERSION_FULL="$VERSION_FULL~${STARTOS_ENV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "startos-${VERSION_FULL}_${PLATFORM}"
|
||||||
@@ -4,7 +4,7 @@ set -e
|
|||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
|
|
||||||
if [ "$0" != "./build-cargo-dep.sh" ]; then
|
if [ "$0" != "./build-cargo-dep.sh" ]; then
|
||||||
>&2 echo "Must be run from embassy-os directory"
|
>&2 echo "Must be run from start-os directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
2
build/.gitignore
vendored
Normal file
2
build/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
lib/depends
|
||||||
|
lib/conflicts
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
openresolv
|
|
||||||
dhcpcd5
|
dhcpcd5
|
||||||
firewalld
|
firewalld
|
||||||
nginx
|
nginx
|
||||||
nginx-common
|
nginx-common
|
||||||
|
openresolv
|
||||||
@@ -6,21 +6,15 @@ bmon
|
|||||||
btrfs-progs
|
btrfs-progs
|
||||||
ca-certificates
|
ca-certificates
|
||||||
cifs-utils
|
cifs-utils
|
||||||
containerd.io
|
|
||||||
cryptsetup
|
cryptsetup
|
||||||
curl
|
curl
|
||||||
dmidecode
|
dmidecode
|
||||||
docker-ce
|
|
||||||
docker-ce-cli
|
|
||||||
docker-compose-plugin
|
|
||||||
dosfstools
|
dosfstools
|
||||||
e2fsprogs
|
e2fsprogs
|
||||||
ecryptfs-utils
|
ecryptfs-utils
|
||||||
exfatprogs
|
exfatprogs
|
||||||
flashrom
|
flashrom
|
||||||
gdb
|
|
||||||
grub-common
|
grub-common
|
||||||
heaptrack
|
|
||||||
htop
|
htop
|
||||||
httpdirfs
|
httpdirfs
|
||||||
iotop
|
iotop
|
||||||
5
build/dpkg-deps/docker.depends
Normal file
5
build/dpkg-deps/docker.depends
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
+ containerd.io
|
||||||
|
+ docker-ce
|
||||||
|
+ docker-ce-cli
|
||||||
|
+ docker-compose-plugin
|
||||||
|
- podman
|
||||||
43
build/dpkg-deps/generate.sh
Executable file
43
build/dpkg-deps/generate.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
IFS="-" read -ra FEATURES <<< "$ENVIRONMENT"
|
||||||
|
|
||||||
|
feature_file_checker='
|
||||||
|
/^#/ { next }
|
||||||
|
/^\+ [a-z0-9]+$/ { next }
|
||||||
|
/^- [a-z0-9]+$/ { next }
|
||||||
|
{ exit 1 }
|
||||||
|
'
|
||||||
|
|
||||||
|
for type in conflicts depends; do
|
||||||
|
pkgs=()
|
||||||
|
for feature in ${FEATURES[@]}; do
|
||||||
|
file="$feature.$type"
|
||||||
|
if [ -f $file ]; then
|
||||||
|
# TODO check for syntax errrors
|
||||||
|
cat $file | awk "$feature_file_checker"
|
||||||
|
for pkg in $(cat $file | awk '/^\+/ {print $2}'); do
|
||||||
|
pkgs+=($pkg)
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for pkg in $(cat $type); do
|
||||||
|
SKIP=
|
||||||
|
for feature in ${FEATURES[@]}; do
|
||||||
|
file="$feature.$type"
|
||||||
|
if [ -f $file ]; then
|
||||||
|
if grep "^- $pkg$" $file; then
|
||||||
|
SKIP=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -z $SKIP ]; then
|
||||||
|
pkgs+=($pkg)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
(IFS=$'\n'; echo "${pkgs[*]}") | sort -u > ../lib/$type
|
||||||
|
done
|
||||||
2
build/dpkg-deps/unstable.depends
Normal file
2
build/dpkg-deps/unstable.depends
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
+ gdb
|
||||||
|
+ heaptrack
|
||||||
@@ -11,8 +11,8 @@ cat << "ASCII"
|
|||||||
ASCII
|
ASCII
|
||||||
printf " %s (%s %s)\n" "$(uname -o)" "$(uname -r)" "$(uname -m)"
|
printf " %s (%s %s)\n" "$(uname -o)" "$(uname -r)" "$(uname -m)"
|
||||||
printf " $(start-cli --version | sed 's/StartOS CLI /StartOS v/g') - $(start-cli git-info)"
|
printf " $(start-cli --version | sed 's/StartOS CLI /StartOS v/g') - $(start-cli git-info)"
|
||||||
if [ -n "$(cat /usr/lib/embassy/ENVIRONMENT.txt)" ]; then
|
if [ -n "$(cat /usr/lib/startos/ENVIRONMENT.txt)" ]; then
|
||||||
printf " ~ $(cat /usr/lib/embassy/ENVIRONMENT.txt)\n"
|
printf " ~ $(cat /usr/lib/startos/ENVIRONMENT.txt)\n"
|
||||||
else
|
else
|
||||||
printf "\n"
|
printf "\n"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ user_pref("messaging-system.rsexperimentloader.enabled", false);
|
|||||||
user_pref("network.allow-experiments", false);
|
user_pref("network.allow-experiments", false);
|
||||||
user_pref("network.captive-portal-service.enabled", false);
|
user_pref("network.captive-portal-service.enabled", false);
|
||||||
user_pref("network.connectivity-service.enabled", false);
|
user_pref("network.connectivity-service.enabled", false);
|
||||||
user_pref("network.proxy.autoconfig_url", "file:///usr/lib/embassy/proxy.pac");
|
user_pref("network.proxy.autoconfig_url", "file:///usr/lib/startos/proxy.pac");
|
||||||
user_pref("network.proxy.socks_remote_dns", true);
|
user_pref("network.proxy.socks_remote_dns", true);
|
||||||
user_pref("network.proxy.type", 2);
|
user_pref("network.proxy.type", 2);
|
||||||
user_pref("signon.rememberSignons", false);
|
user_pref("signon.rememberSignons", false);
|
||||||
@@ -91,11 +91,11 @@ EOT
|
|||||||
while ! curl "http://localhost" > /dev/null; do
|
while ! curl "http://localhost" > /dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
while ! /usr/lib/embassy/scripts/check-monitor; do
|
while ! /usr/lib/startos/scripts/check-monitor; do
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
(
|
(
|
||||||
while /usr/lib/embassy/scripts/check-monitor; do
|
while /usr/lib/startos/scripts/check-monitor; do
|
||||||
sleep 15
|
sleep 15
|
||||||
done
|
done
|
||||||
killall firefox-esr
|
killall firefox-esr
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ fi
|
|||||||
>&2 echo ' sudo rm /usr/local/bin/apt'
|
>&2 echo ' sudo rm /usr/local/bin/apt'
|
||||||
>&2 echo
|
>&2 echo
|
||||||
>&2 echo 'Otherwise, what you probably want to do is run:'
|
>&2 echo 'Otherwise, what you probably want to do is run:'
|
||||||
>&2 echo ' sudo /usr/lib/embassy/scripts/chroot-and-upgrade'
|
>&2 echo ' sudo /usr/lib/startos/scripts/chroot-and-upgrade'
|
||||||
>&2 echo 'You can run apt in this context to add packages to your system.'
|
>&2 echo 'You can run apt in this context to add packages to your system.'
|
||||||
>&2 echo 'When you are done with your changes, type "exit" and the device will reboot into a system with the changes applied.'
|
>&2 echo 'When you are done with your changes, type "exit" and the device will reboot into a system with the changes applied.'
|
||||||
>&2 echo 'This is still NOT RECOMMENDED if you don'"'"'t know what you are doing, but at least isn'"'"'t guaranteed to break things.'
|
>&2 echo 'This is still NOT RECOMMENDED if you don'"'"'t know what you are doing, but at least isn'"'"'t guaranteed to break things.'
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ while [ -n "$1" ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ ${#TO_INSTALL[@]} -ne 0 ]; then
|
if [ ${#TO_INSTALL[@]} -ne 0 ]; then
|
||||||
/usr/lib/embassy/scripts/chroot-and-upgrade << EOF
|
/usr/lib/startos/scripts/chroot-and-upgrade << EOF
|
||||||
apt-get update && apt-get install -y ${TO_INSTALL[@]}
|
apt-get update && apt-get install -y ${TO_INSTALL[@]}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
@@ -60,12 +60,12 @@ sudo mount `partition_for ${OUTPUT_DEVICE} 2` $TMPDIR
|
|||||||
sudo mkdir $TMPDIR/boot
|
sudo mkdir $TMPDIR/boot
|
||||||
sudo mount `partition_for ${OUTPUT_DEVICE} 1` $TMPDIR/boot
|
sudo mount `partition_for ${OUTPUT_DEVICE} 1` $TMPDIR/boot
|
||||||
sudo unsquashfs -f -d $TMPDIR startos.raspberrypi.squashfs
|
sudo unsquashfs -f -d $TMPDIR startos.raspberrypi.squashfs
|
||||||
REAL_GIT_HASH=$(cat $TMPDIR/usr/lib/embassy/GIT_HASH.txt)
|
REAL_GIT_HASH=$(cat $TMPDIR/usr/lib/startos/GIT_HASH.txt)
|
||||||
REAL_VERSION=$(cat $TMPDIR/usr/lib/embassy/VERSION.txt)
|
REAL_VERSION=$(cat $TMPDIR/usr/lib/startos/VERSION.txt)
|
||||||
REAL_ENVIRONMENT=$(cat $TMPDIR/usr/lib/embassy/ENVIRONMENT.txt)
|
REAL_ENVIRONMENT=$(cat $TMPDIR/usr/lib/startos/ENVIRONMENT.txt)
|
||||||
sudo sed -i 's| boot=embassy| init=/usr/lib/embassy/scripts/init_resize\.sh|' $TMPDIR/boot/cmdline.txt
|
sudo sed -i 's| boot=embassy| init=/usr/lib/startos/scripts/init_resize\.sh|' $TMPDIR/boot/cmdline.txt
|
||||||
sudo cp ./build/raspberrypi/fstab $TMPDIR/etc/
|
sudo cp ./build/raspberrypi/fstab $TMPDIR/etc/
|
||||||
sudo cp ./build/raspberrypi/init_resize.sh $TMPDIR/usr/lib/embassy/scripts/init_resize.sh
|
sudo cp ./build/raspberrypi/init_resize.sh $TMPDIR/usr/lib/startos/scripts/init_resize.sh
|
||||||
sudo umount $TMPDIR/boot
|
sudo umount $TMPDIR/boot
|
||||||
sudo umount $TMPDIR
|
sudo umount $TMPDIR
|
||||||
sudo losetup -d $OUTPUT_DEVICE
|
sudo losetup -d $OUTPUT_DEVICE
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
GIT_HASH="$(git describe --always --abbrev=40 --dirty=-modified)"
|
if [ "$GIT_BRANCH_AS_HASH" != 1 ]; then
|
||||||
|
GIT_HASH="$(git describe --always --abbrev=40 --dirty=-modified)"
|
||||||
|
else
|
||||||
|
GIT_HASH="@$(git rev-parse --abbrev-ref HEAD)"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ -f ./GIT_HASH.txt ] || [ "$(cat ./GIT_HASH.txt)" != "$GIT_HASH" ]; then
|
if ! [ -f ./GIT_HASH.txt ] || [ "$(cat ./GIT_HASH.txt)" != "$GIT_HASH" ]; then
|
||||||
echo -n "$GIT_HASH" > ./GIT_HASH.txt
|
echo -n "$GIT_HASH" > ./GIT_HASH.txt
|
||||||
|
|||||||
8
check-platform.sh
Executable file
8
check-platform.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if ! [ -f ./PLATFORM.txt ] || [ "$(cat ./PLATFORM.txt)" != "$PLATFORM" ] && [ -n "$PLATFORM" ]; then
|
||||||
|
>&2 echo "Updating PLATFORM.txt to \"$PLATFORM\""
|
||||||
|
echo -n "$PLATFORM" > ./PLATFORM.txt
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n ./PLATFORM.txt
|
||||||
27
build/lib/scripts/postinst → debian/postinst
vendored
27
build/lib/scripts/postinst → debian/postinst
vendored
@@ -8,10 +8,10 @@ fi
|
|||||||
|
|
||||||
if [ -f /usr/sbin/grub-probe ]; then
|
if [ -f /usr/sbin/grub-probe ]; then
|
||||||
mv /usr/sbin/grub-probe /usr/sbin/grub-probe-default
|
mv /usr/sbin/grub-probe /usr/sbin/grub-probe-default
|
||||||
ln -s /usr/lib/embassy/scripts/grub-probe-eos /usr/sbin/grub-probe
|
ln -s /usr/lib/startos/scripts/grub-probe-eos /usr/sbin/grub-probe
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp /usr/lib/embassy/scripts/embassy-initramfs-module /etc/initramfs-tools/scripts/embassy
|
cp /usr/lib/startos/scripts/embassy-initramfs-module /etc/initramfs-tools/scripts/embassy
|
||||||
|
|
||||||
if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then
|
if ! grep overlay /etc/initramfs-tools/modules > /dev/null; then
|
||||||
echo overlay >> /etc/initramfs-tools/modules
|
echo overlay >> /etc/initramfs-tools/modules
|
||||||
@@ -46,6 +46,7 @@ dns=systemd-resolved
|
|||||||
[ifupdown]
|
[ifupdown]
|
||||||
managed=true
|
managed=true
|
||||||
EOF
|
EOF
|
||||||
|
$SYSTEMCTL enable startd.service
|
||||||
$SYSTEMCTL enable systemd-resolved.service
|
$SYSTEMCTL enable systemd-resolved.service
|
||||||
$SYSTEMCTL enable systemd-networkd-wait-online.service
|
$SYSTEMCTL enable systemd-networkd-wait-online.service
|
||||||
$SYSTEMCTL enable ssh.service
|
$SYSTEMCTL enable ssh.service
|
||||||
@@ -70,20 +71,20 @@ fi
|
|||||||
|
|
||||||
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
|
||||||
sed -i 's/Restart=on-failure/Restart=always/g' /lib/systemd/system/tor@default.service
|
sed -i 's/Restart=on-failure/Restart=always/g' /lib/systemd/system/tor@default.service
|
||||||
sed -i 's/ExecStart=\/usr\/bin\/dockerd/ExecStart=\/usr\/bin\/dockerd --exec-opt native.cgroupdriver=systemd/g' /lib/systemd/system/docker.service
|
|
||||||
sed -i '/\(^\|#\)entries-per-entry-group-max=/c\entries-per-entry-group-max=128' /etc/avahi/avahi-daemon.conf
|
sed -i '/\(^\|#\)entries-per-entry-group-max=/c\entries-per-entry-group-max=128' /etc/avahi/avahi-daemon.conf
|
||||||
sed -i '/\(^\|#\)Storage=/c\Storage=persistent' /etc/systemd/journald.conf
|
sed -i '/\(^\|#\)Storage=/c\Storage=persistent' /etc/systemd/journald.conf
|
||||||
sed -i '/\(^\|#\)Compress=/c\Compress=yes' /etc/systemd/journald.conf
|
sed -i '/\(^\|#\)Compress=/c\Compress=yes' /etc/systemd/journald.conf
|
||||||
sed -i '/\(^\|#\)SystemMaxUse=/c\SystemMaxUse=1G' /etc/systemd/journald.conf
|
sed -i '/\(^\|#\)SystemMaxUse=/c\SystemMaxUse=1G' /etc/systemd/journald.conf
|
||||||
sed -i '/\(^\|#\)ForwardToSyslog=/c\ForwardToSyslog=no' /etc/systemd/journald.conf
|
sed -i '/\(^\|#\)ForwardToSyslog=/c\ForwardToSyslog=no' /etc/systemd/journald.conf
|
||||||
sed -i '/^\s*#\?\s*issue_discards\s*=\s*/c\issue_discards = 1' /etc/lvm/lvm.conf
|
sed -i '/^\s*#\?\s*issue_discards\s*=\s*/c\issue_discards = 1' /etc/lvm/lvm.conf
|
||||||
mkdir -p /etc/docker
|
|
||||||
cat > /etc/docker/daemon.json << EOF
|
if cat /usr/lib/startos/ENVIRONMENT.txt | grep '(^|-)docker(-|$)'; then
|
||||||
{
|
sed -i 's/ExecStart=\/usr\/bin\/dockerd/ExecStart=\/usr\/bin\/dockerd --exec-opt native.cgroupdriver=systemd/g' /lib/systemd/system/docker.service
|
||||||
"storage-driver": "overlay2"
|
mkdir -p /etc/docker
|
||||||
}
|
echo '{ "storage-driver": "overlay2" }' > /etc/docker/daemon.json
|
||||||
EOF
|
else
|
||||||
podman network create -d bridge --subnet 172.18.0.1/24 --opt com.docker.network.bridge.name=br-start9 start9
|
podman network create -d bridge --subnet 172.18.0.1/24 --opt com.docker.network.bridge.name=br-start9 start9
|
||||||
|
fi
|
||||||
mkdir -p /etc/nginx/ssl
|
mkdir -p /etc/nginx/ssl
|
||||||
|
|
||||||
# fix to suppress docker warning, fixed in 21.xx release of docker cli: https://github.com/docker/cli/pull/2934
|
# fix to suppress docker warning, fixed in 21.xx release of docker cli: https://github.com/docker/cli/pull/2934
|
||||||
@@ -100,7 +101,7 @@ CookieAuthentication 1
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -rf /var/lib/tor/*
|
rm -rf /var/lib/tor/*
|
||||||
ln -sf /usr/lib/embassy/scripts/tor-check.sh /usr/bin/tor-check
|
ln -sf /usr/lib/startos/scripts/tor-check.sh /usr/bin/tor-check
|
||||||
|
|
||||||
echo "fs.inotify.max_user_watches=1048576" > /etc/sysctl.d/97-embassy.conf
|
echo "fs.inotify.max_user_watches=1048576" > /etc/sysctl.d/97-embassy.conf
|
||||||
|
|
||||||
@@ -113,9 +114,9 @@ dpkg-reconfigure --frontend noninteractive locales
|
|||||||
|
|
||||||
groupadd embassy
|
groupadd embassy
|
||||||
|
|
||||||
ln -s /usr/lib/embassy/scripts/dhclient-exit-hook /etc/dhcp/dhclient-exit-hooks.d/embassy
|
ln -s /usr/lib/startos/scripts/dhclient-exit-hook /etc/dhcp/dhclient-exit-hooks.d/embassy
|
||||||
|
|
||||||
rm -f /etc/motd
|
rm -f /etc/motd
|
||||||
ln -sf /usr/lib/embassy/motd /etc/update-motd.d/00-embassy
|
ln -sf /usr/lib/startos/motd /etc/update-motd.d/00-embassy
|
||||||
chmod -x /etc/update-motd.d/*
|
chmod -x /etc/update-motd.d/*
|
||||||
chmod +x /etc/update-motd.d/00-embassy
|
chmod +x /etc/update-motd.d/00-embassy
|
||||||
48
dpkg-build.sh
Executable file
48
dpkg-build.sh
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
BASENAME=$(./basename.sh)
|
||||||
|
VERSION=$(cat ./VERSION.txt)
|
||||||
|
if [ "$PLATFORM" = "x86_64" ] || [ "$PLATFORM" = "x86_64-nonfree" ]; then
|
||||||
|
DEB_ARCH=amd64
|
||||||
|
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "aarch64-nonfree" ] || [ "$PLATFORM" = "raspberrypi" ]; then
|
||||||
|
DEB_ARCH=arm64
|
||||||
|
else
|
||||||
|
DEB_ARCH="$PLATFORM"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf dpkg-workdir/$BASENAME
|
||||||
|
mkdir -p dpkg-workdir/$BASENAME
|
||||||
|
|
||||||
|
make install DESTDIR=dpkg-workdir/$BASENAME
|
||||||
|
|
||||||
|
DEPENDS=$(cat dpkg-workdir/$BASENAME/usr/lib/startos/depends | tr $'\n' ',' | sed 's/,,\+/,/g' | sed 's/,$//')
|
||||||
|
CONFLICTS=$(cat dpkg-workdir/$BASENAME/usr/lib/startos/conflicts | tr $'\n' ',' | sed 's/,,\+/,/g' | sed 's/,$//')
|
||||||
|
|
||||||
|
cp -r debian dpkg-workdir/$BASENAME/DEBIAN
|
||||||
|
cat > dpkg-workdir/$BASENAME/DEBIAN/control << EOF
|
||||||
|
Package: startos
|
||||||
|
Version: ${VERSION}
|
||||||
|
Section: unknown
|
||||||
|
Priority: required
|
||||||
|
Maintainer: Aiden McClelland <aiden@start9.com>
|
||||||
|
Homepage: https://start9.com
|
||||||
|
Architecture: ${DEB_ARCH}
|
||||||
|
Multi-Arch: foreign
|
||||||
|
Depends: ${DEPENDS}
|
||||||
|
Conflicts: ${CONFLICTS}
|
||||||
|
Description: StartOS Debian Package
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cd dpkg-workdir/$BASENAME
|
||||||
|
find . -type f -not -path "./DEBIAN/*" -exec md5sum {} \; | sort -k 2 | sed 's/\.\/\(.*\)/\1/' > DEBIAN/md5sums
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
cd dpkg-workdir
|
||||||
|
dpkg-deb --root-owner-group -b $BASENAME
|
||||||
|
mkdir -p ../results
|
||||||
|
mv $BASENAME.deb ../results/$BASENAME.deb
|
||||||
|
rm -rf $BASENAME
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
"useMocks": true,
|
"useMocks": true,
|
||||||
"enableWidgets": false,
|
"enableWidgets": false,
|
||||||
"packageArch": "aarch64",
|
|
||||||
"osArch": "raspberrypi",
|
|
||||||
"ui": {
|
"ui": {
|
||||||
"api": {
|
"api": {
|
||||||
"url": "rpc",
|
"url": "rpc",
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
export type WorkspaceConfig = {
|
export type WorkspaceConfig = {
|
||||||
packageArch: 'aarch64' | 'x86_64'
|
|
||||||
osArch: 'aarch64' | 'x86_64' | 'raspberrypi'
|
|
||||||
gitHash: string
|
gitHash: string
|
||||||
useMocks: boolean
|
useMocks: boolean
|
||||||
enableWidgets: boolean
|
enableWidgets: boolean
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<logs
|
<logs
|
||||||
[fetchLogs]="fetchLogs()"
|
[fetchLogs]="fetchLogs()"
|
||||||
[followLogs]="followLogs()"
|
[followLogs]="followLogs()"
|
||||||
context="eos"
|
context="start-os"
|
||||||
defaultBack="system"
|
defaultBack="system"
|
||||||
pageTitle="OS Logs"
|
pageTitle="OS Logs"
|
||||||
class="ion-page"
|
class="ion-page"
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ export const mockPatchData: DataModel = {
|
|||||||
'ca-fingerprint': 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15',
|
'ca-fingerprint': 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15',
|
||||||
'system-start-time': new Date(new Date().valueOf() - 360042).toUTCString(),
|
'system-start-time': new Date(new Date().valueOf() - 360042).toUTCString(),
|
||||||
zram: false,
|
zram: false,
|
||||||
|
platform: 'x86_64-nonfree',
|
||||||
},
|
},
|
||||||
'package-data': {
|
'package-data': {
|
||||||
bitcoind: {
|
bitcoind: {
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import {
|
|||||||
} from 'src/app/services/patch-db/data-model'
|
} from 'src/app/services/patch-db/data-model'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
packageArch,
|
|
||||||
osArch,
|
|
||||||
gitHash,
|
gitHash,
|
||||||
useMocks,
|
useMocks,
|
||||||
ui: { api, marketplace, mocks },
|
ui: { api, marketplace, mocks },
|
||||||
@@ -30,8 +28,6 @@ export class ConfigService {
|
|||||||
version = require('../../../../../package.json').version as string
|
version = require('../../../../../package.json').version as string
|
||||||
useMocks = useMocks
|
useMocks = useMocks
|
||||||
mocks = mocks
|
mocks = mocks
|
||||||
packageArch = packageArch
|
|
||||||
osArch = osArch
|
|
||||||
gitHash = gitHash
|
gitHash = gitHash
|
||||||
api = api
|
api = api
|
||||||
marketplace = marketplace
|
marketplace = marketplace
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export interface ServerInfo {
|
|||||||
'ca-fingerprint': string
|
'ca-fingerprint': string
|
||||||
'system-start-time': string
|
'system-start-time': string
|
||||||
zram: boolean
|
zram: boolean
|
||||||
|
platform: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IpInfo {
|
export interface IpInfo {
|
||||||
|
|||||||
2
image-recipe/.gitignore
vendored
Normal file
2
image-recipe/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
results/
|
||||||
|
*.deb
|
||||||
23
image-recipe/README.md
Normal file
23
image-recipe/README.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# StartOS Image Recipes
|
||||||
|
|
||||||
|
Code and `debos` recipes that are used to create the StartOS live and installer
|
||||||
|
images.
|
||||||
|
|
||||||
|
If you want to build a local image in the exact same environment used to build
|
||||||
|
official StartOS images, you can use the `run-local-build.sh` helper script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Prerequisites
|
||||||
|
sudo apt-get install -y debspawn
|
||||||
|
sudo mkdir -p /etc/debspawn/ && echo "AllowUnsafePermissions=true" | sudo tee /etc/debspawn/global.toml
|
||||||
|
|
||||||
|
# Get dpkg
|
||||||
|
mkdir -p overlays/startos/root
|
||||||
|
wget -O overlays/startos/root/startos_0.3.x-1_amd64.deb <dpkg_url>
|
||||||
|
|
||||||
|
# Build image
|
||||||
|
./run-local-build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
In order for the build to work properly, you will need debspawn >= 0.5.1, the
|
||||||
|
build may fail with prior versions.
|
||||||
324
image-recipe/build.sh
Executable file
324
image-recipe/build.sh
Executable file
@@ -0,0 +1,324 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
MAX_IMG_SECTORS=8388608 # 4GB
|
||||||
|
|
||||||
|
echo "==== StartOS Image Build ===="
|
||||||
|
|
||||||
|
echo "Building for architecture: $IB_TARGET_ARCH"
|
||||||
|
|
||||||
|
base_dir="$(dirname "$(readlink -f "$0")")"
|
||||||
|
prep_results_dir="$base_dir/images-prep"
|
||||||
|
if systemd-detect-virt -qc; then
|
||||||
|
RESULTS_DIR="/srv/artifacts"
|
||||||
|
else
|
||||||
|
RESULTS_DIR="$base_dir/results"
|
||||||
|
fi
|
||||||
|
echo "Saving results in: $RESULTS_DIR"
|
||||||
|
|
||||||
|
IMAGE_BASENAME=startos-${VERSION_FULL}_${IB_TARGET_PLATFORM}
|
||||||
|
|
||||||
|
mkdir -p $prep_results_dir
|
||||||
|
|
||||||
|
cd $prep_results_dir
|
||||||
|
|
||||||
|
QEMU_ARCH=${IB_TARGET_ARCH}
|
||||||
|
BOOTLOADERS=grub-efi,syslinux
|
||||||
|
if [ "$QEMU_ARCH" = 'amd64' ]; then
|
||||||
|
QEMU_ARCH=x86_64
|
||||||
|
elif [ "$QEMU_ARCH" = 'arm64' ]; then
|
||||||
|
QEMU_ARCH=aarch64
|
||||||
|
BOOTLOADERS=grub-efi
|
||||||
|
fi
|
||||||
|
NON_FREE=
|
||||||
|
if [[ "${IB_TARGET_PLATFORM}" =~ -nonfree$ ]] || [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
NON_FREE=1
|
||||||
|
fi
|
||||||
|
IMAGE_TYPE=iso
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ] || [ "${IB_TARGET_PLATFORM}" = "rockchip64" ]; then
|
||||||
|
IMAGE_TYPE=img
|
||||||
|
fi
|
||||||
|
|
||||||
|
ARCHIVE_AREAS="main contrib"
|
||||||
|
if [ "$NON_FREE" = 1 ]; then
|
||||||
|
if [ "$IB_SUITE" = "bullseye" ]; then
|
||||||
|
ARCHIVE_AREAS="$ARCHIVE_AREAS non-free"
|
||||||
|
elif [ "$IB_SUITE" = "bookworm" ]; then
|
||||||
|
ARCHIVE_AREAS="$ARCHIVE_AREAS non-free-firmware"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLATFORM_CONFIG_EXTRAS=
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
PLATFORM_CONFIG_EXTRAS="$PLATFORM_CONFIG_EXTRAS --firmware-binary false"
|
||||||
|
PLATFORM_CONFIG_EXTRAS="$PLATFORM_CONFIG_EXTRAS --firmware-chroot false"
|
||||||
|
# BEGIN stupid ugly hack
|
||||||
|
# The actual name of the package is `raspberrypi-kernel`
|
||||||
|
# live-build determines thte name of the package for the kernel by combining the `linux-packages` flag, with the `linux-flavours` flag
|
||||||
|
# the `linux-flavours` flag defaults to the architecture, so there's no way to remove the suffix.
|
||||||
|
# So we're doing this, cause thank the gods our package name contains a hypen. Cause if it didn't we'd be SOL
|
||||||
|
PLATFORM_CONFIG_EXTRAS="$PLATFORM_CONFIG_EXTRAS --linux-packages raspberrypi"
|
||||||
|
PLATFORM_CONFIG_EXTRAS="$PLATFORM_CONFIG_EXTRAS --linux-flavours kernel"
|
||||||
|
# END stupid ugly hack
|
||||||
|
elif [ "${IB_TARGET_PLATFORM}" = "rockchip64" ]; then
|
||||||
|
PLATFORM_CONFIG_EXTRAS="$PLATFORM_CONFIG_EXTRAS --linux-flavours rockchip64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > /etc/wgetrc << EOF
|
||||||
|
retry_connrefused = on
|
||||||
|
tries = 100
|
||||||
|
EOF
|
||||||
|
lb config \
|
||||||
|
--iso-application "StartOS v${VERSION_FULL} ${IB_TARGET_ARCH}" \
|
||||||
|
--iso-volume "StartOS v${VERSION} ${IB_TARGET_ARCH}" \
|
||||||
|
--iso-preparer "START9 LABS; HTTPS://START9.COM" \
|
||||||
|
--iso-publisher "START9 LABS; HTTPS://START9.COM" \
|
||||||
|
--backports true \
|
||||||
|
--bootappend-live "boot=live noautologin" \
|
||||||
|
--bootloaders $BOOTLOADERS \
|
||||||
|
--mirror-bootstrap "https://deb.debian.org/debian/" \
|
||||||
|
--mirror-chroot "https://deb.debian.org/debian/" \
|
||||||
|
--mirror-chroot-security "https://security.debian.org/debian-security" \
|
||||||
|
-d ${IB_SUITE} \
|
||||||
|
-a ${IB_TARGET_ARCH} \
|
||||||
|
--bootstrap-qemu-arch ${IB_TARGET_ARCH} \
|
||||||
|
--bootstrap-qemu-static /usr/bin/qemu-${QEMU_ARCH}-static \
|
||||||
|
--archive-areas "${ARCHIVE_AREAS}" \
|
||||||
|
$PLATFORM_CONFIG_EXTRAS
|
||||||
|
|
||||||
|
# Overlays
|
||||||
|
|
||||||
|
mkdir -p config/includes.chroot/deb
|
||||||
|
cp $base_dir/deb/${IMAGE_BASENAME}.deb config/includes.chroot/deb/
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
cp -r $base_dir/raspberrypi/squashfs/* config/includes.chroot/
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p config/includes.chroot/etc
|
||||||
|
echo start > config/includes.chroot/etc/hostname
|
||||||
|
cat > config/includes.chroot/etc/hosts << EOT
|
||||||
|
127.0.0.1 localhost start
|
||||||
|
::1 localhost start ip6-localhost ip6-loopback
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
|
EOT
|
||||||
|
|
||||||
|
# Bootloaders
|
||||||
|
|
||||||
|
rm -rf config/bootloaders
|
||||||
|
cp -r /usr/share/live/build/bootloaders config/bootloaders
|
||||||
|
|
||||||
|
cat > config/bootloaders/syslinux/syslinux.cfg << EOF
|
||||||
|
include menu.cfg
|
||||||
|
default vesamenu.c32
|
||||||
|
prompt 0
|
||||||
|
timeout 50
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > config/bootloaders/isolinux/isolinux.cfg << EOF
|
||||||
|
include menu.cfg
|
||||||
|
default vesamenu.c32
|
||||||
|
prompt 0
|
||||||
|
timeout 50
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm config/bootloaders/syslinux_common/splash.svg
|
||||||
|
cp $base_dir/splash.png config/bootloaders/syslinux_common/splash.png
|
||||||
|
cp $base_dir/splash.png config/bootloaders/isolinux/splash.png
|
||||||
|
cp $base_dir/splash.png config/bootloaders/grub-pc/splash.png
|
||||||
|
|
||||||
|
sed -i -e '2i set timeout=5' config/bootloaders/grub-pc/config.cfg
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
|
||||||
|
mkdir -p config/archives
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
curl -fsSL https://archive.raspberrypi.org/debian/raspberrypi.gpg.key | gpg --dearmor -o config/archives/raspi.key
|
||||||
|
echo "deb https://archive.raspberrypi.org/debian/ bullseye main" > config/archives/raspi.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IB_SUITE}" = "bullseye" ]; then
|
||||||
|
cat > config/archives/backports.pref <<- EOF
|
||||||
|
Package: *
|
||||||
|
Pin: release a=bullseye-backports
|
||||||
|
Pin-Priority: 500
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "rockchip64" ]; then
|
||||||
|
curl -fsSL https://apt.armbian.com/armbian.key | gpg --dearmor -o config/archives/armbian.key
|
||||||
|
echo "deb https://apt.armbian.com/ ${IB_SUITE} main" > config/archives/armbian.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -fsSL https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc > config/archives/tor.key
|
||||||
|
echo "deb [arch=${IB_TARGET_ARCH} signed-by=/etc/apt/trusted.gpg.d/tor.key.gpg] https://deb.torproject.org/torproject.org ${IB_SUITE} main" > config/archives/tor.list
|
||||||
|
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o config/archives/docker.key
|
||||||
|
echo "deb [arch=${IB_TARGET_ARCH} signed-by=/etc/apt/trusted.gpg.d/docker.key.gpg] https://download.docker.com/linux/debian ${IB_SUITE} stable" > config/archives/docker.list
|
||||||
|
|
||||||
|
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/Release.key | gpg --dearmor -o config/archives/podman.key
|
||||||
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/trusted.gpg.d/podman.key.gpg] https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/Debian_Testing/ /" > config/archives/podman.list
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
## Base dependencies
|
||||||
|
dpkg-deb --fsys-tarfile $base_dir/deb/${IMAGE_BASENAME}.deb | tar --to-stdout -xvf - ./usr/lib/startos/depends > config/package-lists/embassy-depends.list.chroot
|
||||||
|
|
||||||
|
## Firmware
|
||||||
|
if [ "$NON_FREE" = 1 ]; then
|
||||||
|
echo 'firmware-iwlwifi firmware-misc-nonfree firmware-brcm80211 firmware-realtek firmware-atheros firmware-libertas firmware-amd-graphics' > config/package-lists/nonfree.list.chroot
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
echo 'raspberrypi-bootloader rpi-update parted' > config/package-lists/bootloader.list.chroot
|
||||||
|
else
|
||||||
|
echo 'grub-efi grub2-common' > config/package-lists/bootloader.list.chroot
|
||||||
|
fi
|
||||||
|
if [ "${IB_TARGET_ARCH}" = "amd64" ] || [ "${IB_TARGET_ARCH}" = "i386" ]; then
|
||||||
|
echo 'grub-pc-bin' >> config/package-lists/bootloader.list.chroot
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat > config/hooks/normal/9000-install-startos.hook.chroot << EOF
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
apt-get install -y /deb/${IMAGE_BASENAME}.deb
|
||||||
|
rm -rf /deb
|
||||||
|
|
||||||
|
if [ "${IB_SUITE}" = bookworm ]; then
|
||||||
|
echo 'deb https://deb.debian.org/debian/ bullseye main' > /etc/apt/sources.list.d/bullseye.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y postgresql-13
|
||||||
|
rm /etc/apt/sources.list.d/bullseye.list
|
||||||
|
apt-get update
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
for f in /usr/lib/modules/*; do
|
||||||
|
v=\${f#/usr/lib/modules/}
|
||||||
|
echo "Configuring raspi kernel '\$v'"
|
||||||
|
extract-ikconfig "/usr/lib/modules/\$v/kernel/kernel/configs.ko.xz" > /boot/config-\$v
|
||||||
|
update-initramfs -c -k \$v
|
||||||
|
done
|
||||||
|
ln -sf /usr/bin/pi-beep /usr/local/bin/beep
|
||||||
|
fi
|
||||||
|
|
||||||
|
useradd --shell /bin/bash -G embassy -m start9
|
||||||
|
echo start9:embassy | chpasswd
|
||||||
|
usermod -aG sudo start9
|
||||||
|
|
||||||
|
echo "start9 ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee "/etc/sudoers.d/010_start9-nopasswd"
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" != "raspberrypi" ]; then
|
||||||
|
/usr/lib/startos/scripts/enable-kiosk
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ "${IB_OS_ENV}" =~ (^|-)dev($|-) ]]; then
|
||||||
|
passwd -l start9
|
||||||
|
fi
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date '+%s')}"
|
||||||
|
|
||||||
|
lb bootstrap
|
||||||
|
lb chroot
|
||||||
|
lb installer
|
||||||
|
lb binary_chroot
|
||||||
|
lb chroot_prep install all mode-apt-install-binary mode-archives-chroot
|
||||||
|
ln -sf /run/systemd/resolve/stub-resolv.conf chroot/chroot/etc/resolv.conf
|
||||||
|
lb binary_rootfs
|
||||||
|
|
||||||
|
cp $prep_results_dir/binary/live/filesystem.squashfs $RESULTS_DIR/$IMAGE_BASENAME.squashfs
|
||||||
|
|
||||||
|
if [ "${IMAGE_TYPE}" = iso ]; then
|
||||||
|
|
||||||
|
lb binary_manifest
|
||||||
|
lb binary_package-lists
|
||||||
|
lb binary_linux-image
|
||||||
|
lb binary_memtest
|
||||||
|
lb binary_grub-legacy
|
||||||
|
lb binary_grub-pc
|
||||||
|
lb binary_grub_cfg
|
||||||
|
lb binary_syslinux
|
||||||
|
lb binary_disk
|
||||||
|
lb binary_loadlin
|
||||||
|
lb binary_win32-loader
|
||||||
|
lb binary_includes
|
||||||
|
lb binary_grub-efi
|
||||||
|
lb binary_hooks
|
||||||
|
lb binary_checksums
|
||||||
|
find binary -newermt "$(date -d@${SOURCE_DATE_EPOCH} '+%Y-%m-%d %H:%M:%S')" -printf "%y %p\n" -exec touch '{}' -d@${SOURCE_DATE_EPOCH} --no-dereference ';' > binary.modified_timestamps
|
||||||
|
lb binary_iso
|
||||||
|
lb binary_onie
|
||||||
|
lb binary_netboot
|
||||||
|
lb binary_tar
|
||||||
|
lb binary_hdd
|
||||||
|
lb binary_zsync
|
||||||
|
lb chroot_prep remove all mode-archives-chroot
|
||||||
|
lb source
|
||||||
|
|
||||||
|
mv $prep_results_dir/live-image-${IB_TARGET_ARCH}.hybrid.iso $RESULTS_DIR/$IMAGE_BASENAME.iso
|
||||||
|
|
||||||
|
elif [ "${IMAGE_TYPE}" = img ]; then
|
||||||
|
|
||||||
|
function partition_for () {
|
||||||
|
if [[ "$1" =~ [0-9]+$ ]]; then
|
||||||
|
echo "$1p$2"
|
||||||
|
else
|
||||||
|
echo "$1$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ROOT_PART_END=7217792
|
||||||
|
TARGET_NAME=$prep_results_dir/${IMAGE_BASENAME}.img
|
||||||
|
TARGET_SIZE=$[($ROOT_PART_END+1)*512]
|
||||||
|
truncate -s $TARGET_SIZE $TARGET_NAME
|
||||||
|
(
|
||||||
|
echo o
|
||||||
|
echo x
|
||||||
|
echo i
|
||||||
|
echo "0xcb15ae4d"
|
||||||
|
echo r
|
||||||
|
echo n
|
||||||
|
echo p
|
||||||
|
echo 1
|
||||||
|
echo 2048
|
||||||
|
echo 526335
|
||||||
|
echo t
|
||||||
|
echo c
|
||||||
|
echo n
|
||||||
|
echo p
|
||||||
|
echo 2
|
||||||
|
echo 526336
|
||||||
|
echo $ROOT_PART_END
|
||||||
|
echo a
|
||||||
|
echo 1
|
||||||
|
echo w
|
||||||
|
) | fdisk $TARGET_NAME
|
||||||
|
OUTPUT_DEVICE=$(losetup --show -fP $TARGET_NAME)
|
||||||
|
mkfs.ext4 `partition_for ${OUTPUT_DEVICE} 2`
|
||||||
|
mkfs.vfat `partition_for ${OUTPUT_DEVICE} 1`
|
||||||
|
|
||||||
|
TMPDIR=$(mktemp -d)
|
||||||
|
|
||||||
|
mount `partition_for ${OUTPUT_DEVICE} 2` $TMPDIR
|
||||||
|
mkdir $TMPDIR/boot
|
||||||
|
mount `partition_for ${OUTPUT_DEVICE} 1` $TMPDIR/boot
|
||||||
|
unsquashfs -f -d $TMPDIR $prep_results_dir/binary/live/filesystem.squashfs
|
||||||
|
|
||||||
|
if [ "${IB_TARGET_PLATFORM}" = "raspberrypi" ]; then
|
||||||
|
sed -i 's| boot=embassy| init=/usr/lib/startos/scripts/init_resize\.sh|' $TMPDIR/boot/cmdline.txt
|
||||||
|
rsync -a $base_dir/raspberrypi/img/ $TMPDIR/
|
||||||
|
fi
|
||||||
|
|
||||||
|
umount $TMPDIR/boot
|
||||||
|
umount $TMPDIR
|
||||||
|
losetup -d $OUTPUT_DEVICE
|
||||||
|
|
||||||
|
mv $prep_results_dir/${IMAGE_BASENAME}.img $RESULTS_DIR/$IMAGE_BASENAME.iso
|
||||||
|
|
||||||
|
fi
|
||||||
24
image-recipe/prepare.sh
Executable file
24
image-recipe/prepare.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -yq \
|
||||||
|
live-build \
|
||||||
|
procps \
|
||||||
|
systemd \
|
||||||
|
binfmt-support \
|
||||||
|
qemu-utils \
|
||||||
|
qemu-user-static \
|
||||||
|
qemu-system-x86 \
|
||||||
|
qemu-system-aarch64 \
|
||||||
|
xorriso \
|
||||||
|
isolinux \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gpg \
|
||||||
|
fdisk \
|
||||||
|
dosfstools \
|
||||||
|
e2fsprogs \
|
||||||
|
squashfs-tools \
|
||||||
|
rsync
|
||||||
@@ -114,7 +114,7 @@ mount / -o remount,ro
|
|||||||
beep
|
beep
|
||||||
|
|
||||||
if main; then
|
if main; then
|
||||||
sed -i 's| init=/usr/lib/embassy/scripts/init_resize\.sh| boot=embassy|' /boot/cmdline.txt
|
sed -i 's| init=/usr/lib/startos/scripts/init_resize\.sh| boot=embassy|' /boot/cmdline.txt
|
||||||
echo "Resized root filesystem. Rebooting in 5 seconds..."
|
echo "Resized root filesystem. Rebooting in 5 seconds..."
|
||||||
sleep 5
|
sleep 5
|
||||||
else
|
else
|
||||||
1
image-recipe/raspberrypi/squashfs/boot/cmdline.txt
Normal file
1
image-recipe/raspberrypi/squashfs/boot/cmdline.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
usb-storage.quirks=152d:0562:u,14cd:121c:u,0781:cfcb:u console=serial0,115200 console=tty1 root=PARTUUID=cb15ae4d-02 rootfstype=ext4 fsck.repair=yes rootwait cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory quiet boot=embassy
|
||||||
86
image-recipe/raspberrypi/squashfs/boot/config.txt
Normal file
86
image-recipe/raspberrypi/squashfs/boot/config.txt
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# For more options and information see
|
||||||
|
# http://rpf.io/configtxt
|
||||||
|
# Some settings may impact device functionality. See link above for details
|
||||||
|
|
||||||
|
# uncomment if you get no picture on HDMI for a default "safe" mode
|
||||||
|
#hdmi_safe=1
|
||||||
|
|
||||||
|
# uncomment the following to adjust overscan. Use positive numbers if console
|
||||||
|
# goes off screen, and negative if there is too much border
|
||||||
|
#overscan_left=16
|
||||||
|
#overscan_right=16
|
||||||
|
#overscan_top=16
|
||||||
|
#overscan_bottom=16
|
||||||
|
|
||||||
|
# uncomment to force a console size. By default it will be display's size minus
|
||||||
|
# overscan.
|
||||||
|
#framebuffer_width=1280
|
||||||
|
#framebuffer_height=720
|
||||||
|
|
||||||
|
# uncomment if hdmi display is not detected and composite is being output
|
||||||
|
#hdmi_force_hotplug=1
|
||||||
|
|
||||||
|
# uncomment to force a specific HDMI mode (this will force VGA)
|
||||||
|
#hdmi_group=1
|
||||||
|
#hdmi_mode=1
|
||||||
|
|
||||||
|
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
|
||||||
|
# DMT (computer monitor) modes
|
||||||
|
#hdmi_drive=2
|
||||||
|
|
||||||
|
# uncomment to increase signal to HDMI, if you have interference, blanking, or
|
||||||
|
# no display
|
||||||
|
#config_hdmi_boost=4
|
||||||
|
|
||||||
|
# uncomment for composite PAL
|
||||||
|
#sdtv_mode=2
|
||||||
|
|
||||||
|
#uncomment to overclock the arm. 700 MHz is the default.
|
||||||
|
#arm_freq=800
|
||||||
|
|
||||||
|
# Uncomment some or all of these to enable the optional hardware interfaces
|
||||||
|
#dtparam=i2c_arm=on
|
||||||
|
#dtparam=i2s=on
|
||||||
|
#dtparam=spi=on
|
||||||
|
|
||||||
|
# Uncomment this to enable infrared communication.
|
||||||
|
#dtoverlay=gpio-ir,gpio_pin=17
|
||||||
|
#dtoverlay=gpio-ir-tx,gpio_pin=18
|
||||||
|
|
||||||
|
# Additional overlays and parameters are documented /boot/overlays/README
|
||||||
|
|
||||||
|
# Enable audio (loads snd_bcm2835)
|
||||||
|
dtparam=audio=on
|
||||||
|
|
||||||
|
# Automatically load overlays for detected cameras
|
||||||
|
camera_auto_detect=1
|
||||||
|
|
||||||
|
# Automatically load overlays for detected DSI displays
|
||||||
|
display_auto_detect=1
|
||||||
|
|
||||||
|
# Enable DRM VC4 V3D driver
|
||||||
|
dtoverlay=vc4-kms-v3d
|
||||||
|
max_framebuffers=2
|
||||||
|
|
||||||
|
# Run in 64-bit mode
|
||||||
|
arm_64bit=1
|
||||||
|
|
||||||
|
# Disable compensation for displays with overscan
|
||||||
|
disable_overscan=1
|
||||||
|
|
||||||
|
[cm4]
|
||||||
|
# Enable host mode on the 2711 built-in XHCI USB controller.
|
||||||
|
# This line should be removed if the legacy DWC2 controller is required
|
||||||
|
# (e.g. for USB device mode) or if USB support is not required.
|
||||||
|
otg_mode=1
|
||||||
|
|
||||||
|
[all]
|
||||||
|
|
||||||
|
[pi4]
|
||||||
|
# Run as fast as firmware / board allows
|
||||||
|
arm_boost=1
|
||||||
|
|
||||||
|
[all]
|
||||||
|
gpu_mem=16
|
||||||
|
dtoverlay=pwm-2chan,disable-bt
|
||||||
|
initramfs initrd.img-6.1.21-v8+
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
os-partitions:
|
||||||
|
boot: /dev/mmcblk0p1
|
||||||
|
root: /dev/mmcblk0p2
|
||||||
|
ethernet-interface: end0
|
||||||
|
wifi-interface: wlan0
|
||||||
|
disable-encryption: true
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
options cfg80211 ieee80211_regdom=US
|
||||||
69
image-recipe/raspberrypi/squashfs/usr/bin/extract-ikconfig
Executable file
69
image-recipe/raspberrypi/squashfs/usr/bin/extract-ikconfig
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# extract-ikconfig - Extract the .config file from a kernel image
|
||||||
|
#
|
||||||
|
# This will only work when the kernel was compiled with CONFIG_IKCONFIG.
|
||||||
|
#
|
||||||
|
# The obscure use of the "tr" filter is to work around older versions of
|
||||||
|
# "grep" that report the byte offset of the line instead of the pattern.
|
||||||
|
#
|
||||||
|
# (c) 2009,2010 Dick Streefland <dick@streefland.net>
|
||||||
|
# Licensed under the terms of the GNU General Public License.
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
cf1='IKCFG_ST\037\213\010'
|
||||||
|
cf2='0123456789'
|
||||||
|
|
||||||
|
dump_config()
|
||||||
|
{
|
||||||
|
if pos=`tr "$cf1\n$cf2" "\n$cf2=" < "$1" | grep -abo "^$cf2"`
|
||||||
|
then
|
||||||
|
pos=${pos%%:*}
|
||||||
|
tail -c+$(($pos+8)) "$1" | zcat > $tmp1 2> /dev/null
|
||||||
|
if [ $? != 1 ]
|
||||||
|
then # exit status must be 0 or 2 (trailing garbage warning)
|
||||||
|
cat $tmp1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
try_decompress()
|
||||||
|
{
|
||||||
|
for pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
|
||||||
|
do
|
||||||
|
pos=${pos%%:*}
|
||||||
|
tail -c+$pos "$img" | $3 > $tmp2 2> /dev/null
|
||||||
|
dump_config $tmp2
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check invocation:
|
||||||
|
me=${0##*/}
|
||||||
|
img=$1
|
||||||
|
if [ $# -ne 1 -o ! -s "$img" ]
|
||||||
|
then
|
||||||
|
echo "Usage: $me <kernel-image>" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prepare temp files:
|
||||||
|
tmp1=/tmp/ikconfig$$.1
|
||||||
|
tmp2=/tmp/ikconfig$$.2
|
||||||
|
trap "rm -f $tmp1 $tmp2" 0
|
||||||
|
|
||||||
|
# Initial attempt for uncompressed images or objects:
|
||||||
|
dump_config "$img"
|
||||||
|
|
||||||
|
# That didn't work, so retry after decompression.
|
||||||
|
try_decompress '\037\213\010' xy gunzip
|
||||||
|
try_decompress '\3757zXZ\000' abcde unxz
|
||||||
|
try_decompress 'BZh' xy bunzip2
|
||||||
|
try_decompress '\135\0\0\0' xxx unlzma
|
||||||
|
try_decompress '\211\114\132' xy 'lzop -d'
|
||||||
|
try_decompress '\002\041\114\030' xyy 'lz4 -d -l'
|
||||||
|
try_decompress '\050\265\057\375' xxx unzstd
|
||||||
|
|
||||||
|
# Bail out:
|
||||||
|
echo "$me: Cannot find kernel config." >&2
|
||||||
|
exit 1
|
||||||
88
image-recipe/run-local-build.sh
Executable file
88
image-recipe/run-local-build.sh
Executable file
@@ -0,0 +1,88 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DEB_PATH="$(realpath $1)"
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"/..
|
||||||
|
|
||||||
|
BASEDIR="$(pwd -P)"
|
||||||
|
|
||||||
|
VERSION="$(dpkg-deb --fsys-tarfile $DEB_PATH | tar --to-stdout -xvf - ./usr/lib/startos/VERSION.txt)"
|
||||||
|
GIT_HASH="$(dpkg-deb --fsys-tarfile $DEB_PATH | tar --to-stdout -xvf - ./usr/lib/startos/GIT_HASH.txt)"
|
||||||
|
if [[ "$GIT_HASH" =~ ^@ ]]; then
|
||||||
|
GIT_HASH="unknown"
|
||||||
|
else
|
||||||
|
GIT_HASH="$(echo -n "$GIT_HASH" | head -c 7)"
|
||||||
|
fi
|
||||||
|
STARTOS_ENV="$(dpkg-deb --fsys-tarfile $DEB_PATH | tar --to-stdout -xvf - ./usr/lib/startos/ENVIRONMENT.txt)"
|
||||||
|
PLATFORM="$(dpkg-deb --fsys-tarfile $DEB_PATH | tar --to-stdout -xvf - ./usr/lib/startos/PLATFORM.txt)"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
PLATFORM="$(uname -m)"
|
||||||
|
fi
|
||||||
|
if [ "$PLATFORM" = "x86_64" ] || [ "$PLATFORM" = "x86_64-nonfree" ]; then
|
||||||
|
ARCH=amd64
|
||||||
|
QEMU_ARCH=x86_64
|
||||||
|
elif [ "$PLATFORM" = "aarch64" ] || [ "$PLATFORM" = "aarch64-nonfree" ] || [ "$PLATFORM" = "raspberrypi" ] || [ "$PLATFORM" = "rockchip64" ]; then
|
||||||
|
ARCH=arm64
|
||||||
|
QEMU_ARCH=aarch64
|
||||||
|
else
|
||||||
|
ARCH="$PLATFORM"
|
||||||
|
QEMU_ARCH="$PLATFORM"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUITE=bookworm
|
||||||
|
|
||||||
|
debspawn list | grep $SUITE || debspawn create $SUITE
|
||||||
|
|
||||||
|
VERSION_FULL="${VERSION}-${GIT_HASH}"
|
||||||
|
if [ -n "$STARTOS_ENV" ]; then
|
||||||
|
VERSION_FULL="$VERSION_FULL~${STARTOS_ENV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$DSNAME" ]; then
|
||||||
|
DSNAME="$SUITE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$QEMU_ARCH" != "$(uname -m)" ]; then
|
||||||
|
sudo update-binfmts --import qemu-$QEMU_ARCH
|
||||||
|
fi
|
||||||
|
|
||||||
|
imgbuild_fname="$(mktemp /tmp/exec-mkimage.XXXXXX)"
|
||||||
|
cat > $imgbuild_fname <<END
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export IB_SUITE=${SUITE}
|
||||||
|
export IB_TARGET_ARCH=${ARCH}
|
||||||
|
export IB_TARGET_PLATFORM=${PLATFORM}
|
||||||
|
export IB_OS_ENV=${STARTOS_ENV}
|
||||||
|
export VERSION=${VERSION}
|
||||||
|
export VERSION_FULL=${VERSION_FULL}
|
||||||
|
exec ./build.sh
|
||||||
|
END
|
||||||
|
|
||||||
|
prepare_hash=$(sha1sum ${BASEDIR}/image-recipe/prepare.sh | head -c 7)
|
||||||
|
|
||||||
|
mkdir -p ${BASEDIR}/image-recipe/deb
|
||||||
|
cp $DEB_PATH ${BASEDIR}/image-recipe/deb/
|
||||||
|
|
||||||
|
mkdir -p ${BASEDIR}/results
|
||||||
|
set +e
|
||||||
|
debspawn run \
|
||||||
|
-x \
|
||||||
|
--allow=read-kmods,kvm,full-dev \
|
||||||
|
--cachekey="${SUITE}-${prepare_hash}-mkimage" \
|
||||||
|
--init-command="${BASEDIR}/image-recipe/prepare.sh" \
|
||||||
|
--build-dir="${BASEDIR}/image-recipe" \
|
||||||
|
--artifacts-out="${BASEDIR}/results" \
|
||||||
|
--header="StartOS Image Build" \
|
||||||
|
--suite=${SUITE} \
|
||||||
|
${DSNAME} \
|
||||||
|
${imgbuild_fname}
|
||||||
|
|
||||||
|
retval=$?
|
||||||
|
rm $imgbuild_fname
|
||||||
|
if [ $retval -ne 0 ]; then
|
||||||
|
exit $retval
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
BIN
image-recipe/splash.png
Normal file
BIN
image-recipe/splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
29
system-images/compat/Cargo.lock
generated
29
system-images/compat/Cargo.lock
generated
@@ -1648,28 +1648,6 @@ version = "0.27.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793"
|
checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "git-version"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
|
|
||||||
dependencies = [
|
|
||||||
"git-version-macro",
|
|
||||||
"proc-macro-hack",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "git-version-macro"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro-hack",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.107",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpt"
|
name = "gpt"
|
||||||
version = "3.1.0"
|
version = "3.1.0"
|
||||||
@@ -3211,12 +3189,6 @@ dependencies = [
|
|||||||
"toml 0.5.10",
|
"toml 0.5.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro-hack"
|
|
||||||
version = "0.5.20+deprecated"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.67"
|
version = "1.0.67"
|
||||||
@@ -4454,7 +4426,6 @@ dependencies = [
|
|||||||
"emver",
|
"emver",
|
||||||
"fd-lock-rs",
|
"fd-lock-rs",
|
||||||
"futures",
|
"futures",
|
||||||
"git-version",
|
|
||||||
"gpt",
|
"gpt",
|
||||||
"helpers",
|
"helpers",
|
||||||
"hex",
|
"hex",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
COMPAT_SRC := $(shell find ./src) Cargo.toml Cargo.lock
|
COMPAT_SRC := $(shell find ./src) Cargo.toml Cargo.lock
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
@@ -15,7 +15,10 @@ docker-images/aarch64.tar: Dockerfile target/aarch64-unknown-linux-musl/release/
|
|||||||
docker buildx build --build-arg ARCH=aarch64 --tag start9/x_system/compat --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
|
docker buildx build --build-arg ARCH=aarch64 --tag start9/x_system/compat --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
|
||||||
|
|
||||||
docker-images/x86_64.tar: Dockerfile target/x86_64-unknown-linux-musl/release/compat docker-images
|
docker-images/x86_64.tar: Dockerfile target/x86_64-unknown-linux-musl/release/compat docker-images
|
||||||
docker buildx build --build-arg ARCH=aarch64 --tag start9/x_system/compat --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
|
docker buildx build --build-arg ARCH=x86_64 --tag start9/x_system/compat --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
|
||||||
|
|
||||||
target/aarch64-unknown-linux-musl/release/compat target/x86_64-unknown-linux-musl/release/compat: $(COMPAT_SRC) ../../backend/Cargo.lock
|
target/aarch64-unknown-linux-musl/release/compat: $(COMPAT_SRC) ../../backend/Cargo.lock
|
||||||
./build.sh
|
ARCH=aarch64 ./build.sh
|
||||||
|
|
||||||
|
target/x86_64-unknown-linux-musl/release/compat: $(COMPAT_SRC) ../../backend/Cargo.lock
|
||||||
|
ARCH=x86_64 ./build.sh
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
|
|
||||||
if [ -z "$OS_ARCH" ]; then
|
if [ -z "$ARCH" ]; then
|
||||||
>&2 echo '$OS_ARCH is required'
|
ARCH=$(uname -m)
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$0" != "./build.sh" ]; then
|
if [ "$0" != "./build.sh" ]; then
|
||||||
@@ -18,12 +17,10 @@ if tty -s; then
|
|||||||
USE_TTY="-it"
|
USE_TTY="-it"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias 'rust-arm64-musl-builder'='docker run $USE_TTY --rm -e "OS_ARCH=$OS_ARCH" -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src messense/rust-musl-cross:aarch64-musl'
|
alias 'rust-musl-builder'='docker run $USE_TTY --rm -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src messense/rust-musl-cross:${ARCH}-musl'
|
||||||
alias 'rust-x86_64-musl-builder'='docker run $USE_TTY --rm -e "OS_ARCH=$OS_ARCH" -v "$HOME"/.cargo/registry:/root/.cargo/registry -v "$(pwd)":/home/rust/src messense/rust-musl-cross:x86_64-musl'
|
|
||||||
|
|
||||||
cd ../..
|
cd ../..
|
||||||
rust-arm64-musl-builder sh -c "(git config --global --add safe.directory '*'; cd system-images/compat && cargo build --release --target=aarch64-unknown-linux-musl --no-default-features)"
|
rust-musl-builder sh -c "(git config --global --add safe.directory '*'; cd system-images/compat && cargo build --release --target=${ARCH}-unknown-linux-musl --no-default-features)"
|
||||||
rust-x86_64-musl-builder sh -c "(git config --global --add safe.directory '*'; cd system-images/compat && cargo build --release --target=x86_64-unknown-linux-musl --no-default-features)"
|
|
||||||
cd system-images/compat
|
cd system-images/compat
|
||||||
|
|
||||||
sudo chown -R $USER target
|
sudo chown -R $USER target
|
||||||
|
|||||||
Reference in New Issue
Block a user