mirror of
https://github.com/blazblue547-afk/ForgeOS.git
synced 2026-12-02 14:34:17 -05:00
Add dependency installer
This commit is contained in:
1 parent
7db7cf1540
commit
6f03ba8068
3 files changed
+206
-2
No files matched your search
@@ -19,11 +19,12 @@ export SECURE_BOOT_CERT ?=
|
|||||||
export GNOME_SUITE ?= trixie
|
export GNOME_SUITE ?= trixie
|
||||||
export GNOME_MIRROR ?= http://deb.debian.org/debian
|
export GNOME_MIRROR ?= http://deb.debian.org/debian
|
||||||
|
|
||||||
.PHONY: help fetch kernel busybox systemd dbus rootfs gnome-rootfs image gnome-image secure-boot-keys run run-image run-desktop run-gnome list-disks install clean distclean
|
.PHONY: help deps fetch kernel busybox systemd dbus rootfs gnome-rootfs image gnome-image secure-boot-keys run run-image run-desktop run-gnome list-disks install clean distclean
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@printf '%s\n' \
|
@printf '%s\n' \
|
||||||
'ForgeOS targets:' \
|
'ForgeOS targets:' \
|
||||||
|
' make deps - install Debian/Ubuntu host deps for rootfs + run' \
|
||||||
' make fetch - download upstream source tarballs' \
|
' make fetch - download upstream source tarballs' \
|
||||||
' make kernel - build the Linux kernel and stage modules' \
|
' make kernel - build the Linux kernel and stage modules' \
|
||||||
' make busybox - build BusyBox rescue utilities' \
|
' make busybox - build BusyBox rescue utilities' \
|
||||||
@@ -44,6 +45,9 @@ help:
|
|||||||
' make clean - remove build, staging, and output artifacts' \
|
' make clean - remove build, staging, and output artifacts' \
|
||||||
' make distclean - also remove downloaded and extracted sources'
|
' make distclean - also remove downloaded and extracted sources'
|
||||||
|
|
||||||
|
deps:
|
||||||
|
@./scripts/install-deps.sh
|
||||||
|
|
||||||
fetch:
|
fetch:
|
||||||
@./scripts/fetch-sources.sh
|
@./scripts/fetch-sources.sh
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,12 @@ As of `2026-06-16`, the project defaults to:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /home/joe/forgeos
|
cd /home/joe/forgeos
|
||||||
|
sudo scripts/install-deps.sh
|
||||||
make rootfs
|
make rootfs
|
||||||
make run
|
make run
|
||||||
```
|
```
|
||||||
|
|
||||||
That path builds the kernel, systemd, D-Bus, BusyBox rescue tools, and a compressed initramfs, then boots it directly in QEMU over serial.
|
That dependency script is for Debian/Ubuntu hosts and installs only the packages needed for the console rootfs plus direct QEMU boot path. The build path then builds the kernel, systemd, D-Bus, BusyBox rescue tools, and a compressed initramfs, then boots it directly in QEMU over serial.
|
||||||
|
|
||||||
To build a UEFI disk image:
|
To build a UEFI disk image:
|
||||||
|
|
||||||
|
|||||||
Executable
+199
@@ -0,0 +1,199 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||||
|
|
||||||
|
APT_UPDATE=1
|
||||||
|
DRY_RUN=0
|
||||||
|
CHECK_ONLY=0
|
||||||
|
|
||||||
|
packages=(
|
||||||
|
build-essential
|
||||||
|
bc
|
||||||
|
bison
|
||||||
|
flex
|
||||||
|
ca-certificates
|
||||||
|
curl
|
||||||
|
tar
|
||||||
|
xz-utils
|
||||||
|
bzip2
|
||||||
|
gzip
|
||||||
|
cpio
|
||||||
|
rsync
|
||||||
|
file
|
||||||
|
pkg-config
|
||||||
|
meson
|
||||||
|
ninja-build
|
||||||
|
gperf
|
||||||
|
python3
|
||||||
|
perl
|
||||||
|
kmod
|
||||||
|
openssl
|
||||||
|
libcap-dev
|
||||||
|
libmount-dev
|
||||||
|
libblkid-dev
|
||||||
|
libexpat1-dev
|
||||||
|
zlib1g-dev
|
||||||
|
libzstd-dev
|
||||||
|
libssl-dev
|
||||||
|
libelf-dev
|
||||||
|
qemu-system-x86
|
||||||
|
)
|
||||||
|
|
||||||
|
required_commands=(
|
||||||
|
bash
|
||||||
|
make
|
||||||
|
gcc
|
||||||
|
curl
|
||||||
|
tar
|
||||||
|
xz
|
||||||
|
bzip2
|
||||||
|
gzip
|
||||||
|
cpio
|
||||||
|
rsync
|
||||||
|
file
|
||||||
|
pkg-config
|
||||||
|
meson
|
||||||
|
ninja
|
||||||
|
gperf
|
||||||
|
python3
|
||||||
|
perl
|
||||||
|
depmod
|
||||||
|
openssl
|
||||||
|
ldd
|
||||||
|
ldconfig
|
||||||
|
install
|
||||||
|
qemu-system-x86_64
|
||||||
|
)
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: scripts/install-deps.sh [options]
|
||||||
|
|
||||||
|
Install Debian/Ubuntu host packages needed for:
|
||||||
|
make rootfs
|
||||||
|
make run
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--check Only verify packages and commands; do not install.
|
||||||
|
--dry-run Print the apt commands that would run; do not install.
|
||||||
|
--no-update Skip apt-get update before installing.
|
||||||
|
--help Show this help.
|
||||||
|
|
||||||
|
This does not install desktop, GNOME, disk-image, installer, or Secure Boot
|
||||||
|
extras. It is intentionally scoped to the console rootfs and direct QEMU run
|
||||||
|
path.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
msg() {
|
||||||
|
printf '==> %s\n' "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf 'error: %s\n' "$*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
--check)
|
||||||
|
CHECK_ONLY=1
|
||||||
|
;;
|
||||||
|
--dry-run)
|
||||||
|
DRY_RUN=1
|
||||||
|
;;
|
||||||
|
--no-update)
|
||||||
|
APT_UPDATE=0
|
||||||
|
;;
|
||||||
|
--help|-h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "unknown option: $1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$(uname -m)" != "x86_64" ]]; then
|
||||||
|
printf 'warning: ForgeOS currently expects a native x86_64 build host; this host is %s\n' "$(uname -m)" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v apt-get >/dev/null 2>&1; then
|
||||||
|
printf 'error: apt-get was not found. Install equivalent packages manually:\n' >&2
|
||||||
|
printf ' %s\n' "${packages[*]}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -r /etc/os-release ]]; then
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
source /etc/os-release
|
||||||
|
os_family="${ID:-} ${ID_LIKE:-}"
|
||||||
|
case " $os_family " in
|
||||||
|
*" debian "*|*" ubuntu "*) ;;
|
||||||
|
*)
|
||||||
|
printf 'warning: this script is tested on Debian/Ubuntu hosts; detected ID=%s ID_LIKE=%s\n' "${ID:-unknown}" "${ID_LIKE:-unknown}" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
missing_packages=()
|
||||||
|
for package in "${packages[@]}"; do
|
||||||
|
if ! dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -qx 'install ok installed'; then
|
||||||
|
missing_packages+=("$package")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$CHECK_ONLY" -eq 1 ]]; then
|
||||||
|
if [[ "${#missing_packages[@]}" -gt 0 ]]; then
|
||||||
|
printf 'missing packages:\n' >&2
|
||||||
|
printf ' %s\n' "${missing_packages[@]}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ "${#missing_packages[@]}" -eq 0 ]]; then
|
||||||
|
msg "all required packages are already installed"
|
||||||
|
else
|
||||||
|
if [[ "$EUID" -eq 0 ]]; then
|
||||||
|
sudo_cmd=()
|
||||||
|
elif command -v sudo >/dev/null 2>&1; then
|
||||||
|
sudo_cmd=(sudo)
|
||||||
|
else
|
||||||
|
die "missing packages require root privileges and sudo is not installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$DRY_RUN" -eq 1 ]]; then
|
||||||
|
[[ "$APT_UPDATE" -eq 1 ]] && printf '%q ' "${sudo_cmd[@]}" apt-get update && printf '\n'
|
||||||
|
printf '%q ' "${sudo_cmd[@]}" apt-get install -y --no-install-recommends "${missing_packages[@]}"
|
||||||
|
printf '\n'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$APT_UPDATE" -eq 1 ]]; then
|
||||||
|
msg "updating apt package indexes"
|
||||||
|
"${sudo_cmd[@]}" apt-get update
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "installing ForgeOS rootfs/run dependencies"
|
||||||
|
"${sudo_cmd[@]}" apt-get install -y --no-install-recommends "${missing_packages[@]}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
missing_commands=()
|
||||||
|
for tool in "${required_commands[@]}"; do
|
||||||
|
if ! command -v "$tool" >/dev/null 2>&1; then
|
||||||
|
missing_commands+=("$tool")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${#missing_commands[@]}" -gt 0 ]]; then
|
||||||
|
printf 'missing commands after dependency check:\n' >&2
|
||||||
|
printf ' %s\n' "${missing_commands[@]}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "host dependencies are ready for make rootfs and make run"
|
||||||
|
msg "project: $ROOT_DIR"
|
||||||
Reference in new issue
Block a user