aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap87
-rwxr-xr-xbuildos3
-rwxr-xr-xinit4
3 files changed, 53 insertions, 41 deletions
diff --git a/bootstrap b/bootstrap
index 380ae5e..4c2834f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -26,13 +26,46 @@
#
usage="usage: $0"
+macaddr="de:ad:be:ef:b8:da" # @@ TMP Mmac address for testing.
+
id="$(id -un)"
btrfs=/btrfs
+root="$btrfs/$id/buildos"
+
+# Source distribution and packages. Base packages are installed on stage 1 via
+# debootstrap. Extra packages are added on stage 4 via apt-get install. The
+# idea is to be able to add extra packages without upgrading the base system.
+# When we do upgrade the base system we normally move the extras to base.
+#
+# Notes:
+#
+# - some packages (such as CPU microcode updates) are in non-free.
+# - systemd-container seems to be required by host systemd-nspawn.
+# - not installing linux-image-amd64 since building custom below
+#
release="unstable"
+components="main,contrib,non-free"
mirror="https://deb.debian.org/debian/"
-macaddr="de:ad:be:ef:b8:da" # Mac address for testing.
-root="$btrfs/$id/buildos"
+base_pkgs="locales,klibc-utils,sudo,systemd-container,udev"
+base_pkgs+=",kmod,linux-base,firmware-linux-free,irqbalance,pciutils,usbutils"
+base_pkgs+=",intel-microcode,amd64-microcode"
+base_pkgs+=",hdparm,btrfs-progs"
+
+base_pkgs+=",net-tools,iproute2,iptables,isc-dhcp-client"
+base_pkgs+=",ifupdown,bridge-utils,dnsmasq,ntp,postfix"
+base_pkgs+=",iputils-ping,wget,curl"
+base_pkgs+=",openssh-client,openssh-server"
+base_pkgs+=",tftp-hpa,tftpd-hpa"
+
+base_pkgs+=",bzip2,xz-utils"
+base_pkgs+=",less,nano"
+
+base_pkgs+=",qemu-kvm,qemu-utils,socat"
+
+base_pkgs+=",g++,make,pkg-config"
+
+extra_pkgs="lm-sensors"
owd="$(pwd)"
trap "{ cd '$owd'; exit 1; }" ERR
@@ -149,46 +182,13 @@ if [ "$stage" -eq "1" ]; then
subvol_create "$root"
- # Notes:
- #
- # - some packages (such as CPU microcode updates) are in non-free.
- #
- # - systemd-container seems to be required by host systemd-nspawn.
- #
- # - no linux-image-amd64 since building custom below
- #
- comps="main,contrib,non-free"
-
- pkgs="locales,klibc-utils,sudo,systemd-container,udev"
-
- pkgs+=",kmod,linux-base,firmware-linux-free,irqbalance,pciutils,usbutils"
-
- pkgs+=",intel-microcode,amd64-microcode"
-
- #pkgs+=",lsof,auditd"
-
- pkgs+=",hdparm,btrfs-progs"
-
- pkgs+=",net-tools,iproute2,iptables,isc-dhcp-client"
- pkgs+=",ifupdown,bridge-utils,dnsmasq,ntp,postfix"
- pkgs+=",iputils-ping,wget,curl"
- pkgs+=",openssh-client,openssh-server"
- pkgs+=",tftp-hpa,tftpd-hpa"
-
- pkgs+=",bzip2,xz-utils"
- pkgs+=",less,nano"
-
- pkgs+=",qemu-kvm,qemu-utils,socat"
-
- pkgs+=",g++,make,pkg-config"
-
sudo debootstrap \
--foreign \
--arch=amd64 \
--merged-usr \
--variant=minbase \
- --components="$comps" \
- --include="$pkgs" \
+ --components="$components" \
+ --include="$base_pkgs" \
"$release" "$root" "$mirror"
# Post-phase 1 fixups.
@@ -364,7 +364,7 @@ cd linux
# Adjust kernel command line size limit.
#
-sed -i -re 's/^(#define COMMAND_LINE_SIZE ).+$/\1 4096/' arch/x86/include/asm/setup.h
+sed -i -re 's/^(#define COMMAND_LINE_SIZE ).+\$/\1 4096/' arch/x86/include/asm/setup.h
make oldconfig
scripts/config --disable DEBUG_INFO
@@ -413,8 +413,8 @@ fi
#
if [ "$stage" -le "4" ]; then
- # Write the setup script (the service is already there from stage 3) that
- # will finish the setup.
+ # Write the setup script that will finish the setup (the service is already
+ # there from stage 3).
#
write <<EOF /bootstrap/setup
#!/bin/bash
@@ -422,6 +422,13 @@ if [ "$stage" -le "4" ]; then
trap "exit 1" ERR
set -x
+# Install extra packages.
+#
+apt-get update
+for p in \$(sed -e 's/,/ /g' <<<"$extra_pkgs"); do
+ apt-get install -y --no-install-recommends "\$p"
+done
+
# Create the build user, /build home directory. Make a password-less sudo'er.
#
# Note that we force UID/GID to specific numbers to make sure they are
diff --git a/buildos b/buildos
index 875733f..80ef375 100755
--- a/buildos
+++ b/buildos
@@ -1127,6 +1127,7 @@ EOF
fi
fi
+ sensors -A
info "monitoring..."
- sleep 20
+ sleep 60
done
diff --git a/init b/init
index bbc0343..4c02280 100755
--- a/init
+++ b/init
@@ -66,6 +66,10 @@ udevadm trigger --type=subsystems --action=add
udevadm trigger --type=devices --action=add
udevadm settle || true
+# Detect hardware sensors.
+#
+sensors-detect --auto
+
# Initialize KVM.
#
#if ! (modprobe kvm_intel || modprobe kvm_amd); then