--- /dev/null
+#!/bin/bash
+
+# we want these files from the package:
+# /usr/share/initramfs-tools/hooks/btrfs
+# /usr/share/initramfs-tools/scripts/local-premount/btrfs
+# everything else, seems better to take from upstream package.
+
+[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
+
+if [[ ! -d $FAI_ROOT ]]; then
+ export FAI_ROOT=/
+fi
+
+### dependencies
+{
+ for f in $(dpkg-query -L btrfs-progs | grep '/man/|^/s?bin/|^/usr/lib/udev') ; do
+ if [[ ! -f $f ]]; then
+ continue
+ fi
+ # use --no-rename so that I don't need to track whether this was the first
+ # btrfs-progs install.
+ $ROOTCMD dpkg-divert --no-rename --local --add $f
+ done
+
+ # from packages listed in .github/workflows/devel.yml
+ # The dumb makefile makes us build docs even if they were already built.
+ if ! type -p sphinx-build &>/dev/null; then
+ $ROOTCMD apt-get -y install python3-sphinx-rtd-theme
+ fi
+
+ if ! type -p curl &>/dev/null; then
+ $ROOTCMD apt-get -y install curl
+ fi
+ if ! type -p wget &>/dev/null; then
+ $ROOTCMD apt-get -y install wget
+ fi
+}
+
+
+## If we need to use a dev version temporarily, this to true
+## and copy it over in fai-redep. See comment there.
+static_ver=false
+if $static_ver; then
+ # The version with the bug fix is really some git version, but this is
+ # what it outputs for --version.
+ ver=6.10
+ bp_dirname=btrfs-progs
+else
+
+ bp_dirname=btrfs-progs-release
+ # latest released version.
+ pre=https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
+ tarball=$(curl -s $pre/sha256sums.asc \
+ | awk '$2 ~ /^btrfs-progs-v/ { print $2 }' | grep -v -- -rc | grep "^btrfs-progs-v.*gz\$" | sort -V | tail -n1)
+ url="$pre/$tarball"
+ dir=${tarball%.tar.gz}
+ ver=${dir#btrfs-progs-}
+fi
+cur_ver=$($ROOTCMD btrfs --version 2>/dev/null | head -n1 | awk '{print $2}') ||:
+
+if [[ $FAI_ROOT == / ]]; then
+ bp_dir=/a/opt/$bp_dirname
+ if [[ ! -d $bp_dir ]]; then
+ bp_dir=/root/$bp_dirname
+ fi
+else
+ bp_dir=$FAI/distro-install-common/$bp_dirname
+fi
+
+last_built_ver=$([[ ! -e $bp_dir/btrfs ]] || $bp_dir/btrfs --version 2>/dev/null | head -n1 | awk '{print $2}')
+
+# todo: this doesn't account for multiple distros versions that require
+# their own builds.
+if [[ $ver != "$cur_ver" ]]; then
+ # Assumes we've pre-built the static_ver version if we are using that.
+ if $static_ver || [[ $ver == "$last_built_ver" ]]; then
+ if ! $ROOTCMD dpkg -s -- build-essential 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
+ $ROOTCMD apt-get -y install build-essential
+ fi
+
+ if [[ $FAI_ROOT == / ]]; then
+ cd $bp_dir
+ make install
+ mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
+ else
+ mkdir -p $target/tmp/bprogs
+ mount -o bind $bp_dir $target/tmp/bprogs
+ # pre-build. in t11:
+ # ./autogen.sh && ./configure --disable-documentation --prefix=/usr && make
+ # in t12, we have the docs prerequisites, so enabled documentation.
+ # We won't have the latest docs in t11, i could install them from the t12
+ # build dir, but meh.
+ $ROOTCMD bash -xe <<EOF
+cd /tmp/bprogs
+make install
+mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
+EOF
+ fi
+ else
+ cd $target/tmp
+ wget $url
+ tar xzf $tarball
+ # if we are in a full install, gotta prevent build-dep from
+ # using repos that are pinned negative, and pulling in uninstallable
+ # packages.
+ #
+ # todo: this isn't considering the chroot, assumes we've built it
+ # outside the chroot and won't get into this case.
+ if [[ -e /b/distro-functions/src/identify-distros ]]; then
+ . /b/distro-functions/src/identify-distros
+ debian_codename=$(debian-codename)
+ p build-dep btrfs-progs/$debian_codename -y
+ else
+ $ROOTCMD apt-get -y build-dep btrfs-progs
+ fi
+ # note: docs requirements are installed when we have a full distro, so
+ # at some point, fix the build for early distro.
+ $ROOTCMD bash -xe <<EOF
+cd /tmp/${tarball%.tar.gz}
+./configure --prefix=/usr
+make
+make install
+mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
+EOF
+ # If our desktop is HOST2, will we btrbk this latest bprogs to other
+ # machines.
+ if [[ -s /a/bin/bash_unpublished/source-state ]]; then
+ source /a/bin/bash_unpublished/source-state
+ fi
+ if [[ $HOST2 == "$HOSTNAME" && $FAI_ROOT != / ]]; then
+ rm -rf $bp_dir
+ chown -R iank:iank $target/tmp/${tarball%.tar.gz}
+ mv $target/tmp/${tarball%.tar.gz} $bp_dir
+ fi
+
+
+ fi
+fi
# own package, so cant use in other init systems. b. it works fine.
chroot $FAI_ROOT bash <<EOF
# in debian bookworm, this service no longer exists by default
-if systemctl cat networkd-dispatcher.service &>/dev/null; then
+if [[ -e networkd-dispatcher.service ]]; then
systemctl disable networkd-dispatcher
systemctl mask networkd-dispatcher
fi
mount -o bind $src $dst
fi
-chmod 700 $target/mnt/root
$FAI/distro-install-common/end
exit 0 # avoid unnecessary stuff in bootstrap vol
fi
+chmod 700 $target/mnt/root
## misc settings
$ROOTCMD bash <<'EOFOUTER'
#### begin btrfs-progs
-# we want these files from the package:
-# /usr/share/initramfs-tools/hooks/btrfs
-# /usr/share/initramfs-tools/scripts/local-premount/btrfs
-# everything else, seems better to take from upstream package.
-for f in $(dpkg-query -L btrfs-progs | grep '/man/|^/s?bin/|^/usr/lib/udev') ; do
- if [[ ! -f $f ]]; then
- continue
- fi
- # use --no-rename so that I don't need to track whether this was the first
- # btrfs-progs install.
- $ROOTCMD dpkg-divert --no-rename --local --add $f
-done
-
-# from packages listed in .github/workflows/devel.yml
-# The dumb makefile makes us build docs even if they were already built.
-if ! type -p sphinx-build &>/dev/null; then
- $ROOTCMD apt-get -y install python3-sphinx-rtd-theme
-fi
-
-if ! type -p curl &>/dev/null; then
- $ROOTCMD apt-get -y install curl
-fi
-if ! type -p wget &>/dev/null; then
- $ROOTCMD apt-get -y install wget
-fi
-
-
-## If we need to use a dev version temporarily, this to true
-## and copy it over in fai-redep. See comment there.
-static_ver=false
-if $static_ver; then
- # The version with the bug fix is really some git version, but this is
- # what it outputs for --version.
- ver=6.10
- bp_dirname=btrfs-progs
-else
-
- bp_dirname=btrfs-progs-release
- # latest released version.
- pre=https://mirrors.edge.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs
- tarball=$(curl -s $pre/sha256sums.asc \
- | awk '$2 ~ /^btrfs-progs-v/ { print $2 }' | grep -v -- -rc | grep "^btrfs-progs-v.*gz\$" | sort -V | tail -n1)
- url="$pre/$tarball"
- dir=${tarball%.tar.gz}
- ver=${dir#btrfs-progs-}
-fi
-cur_ver=$($ROOTCMD btrfs --version 2>/dev/null | head -n1 | awk '{print $2}') ||:
-
-if [[ $FAI_ROOT == / ]]; then
- bp_dir=/a/opt/$bp_dirname
-else
- bp_dir=$FAI/distro-install-common/$bp_dirname
-fi
-
-last_built_ver=$($bp_dir/btrfs --version 2>/dev/null | head -n1 | awk '{print $2}')
-
-# todo: this doesn't account for multiple distros versions that require
-# their own builds.
-if [[ $ver != "$cur_ver" ]]; then
- # Assumes we've pre-built the static_ver version if we are using that.
- if $static_ver || [[ $ver == "$last_built_ver" ]]; then
- if ! $ROOTCMD dpkg -s -- build-essential 2>&1 | grep -Fx "Status: install ok installed" &>/dev/null; then
- $ROOTCMD apt-get -y install build-essential
- fi
-
- if [[ $FAI_ROOT == / ]]; then
- cd $bp_dir
- make install
- mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
- else
- mkdir -p $target/tmp/bprogs
- mount -o bind $bp_dir $target/tmp/bprogs
- # pre-build. in t11:
- # ./autogen.sh && ./configure --disable-documentation --prefix=/usr && make
- # in t12, we have the docs prerequisites, so enabled documentation.
- # We won't have the latest docs in t11, i could install them from the t12
- # build dir, but meh.
- $ROOTCMD bash -xe <<EOF
-cd /tmp/bprogs
-make install
-mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
-EOF
- fi
- else
- cd $target/tmp
- wget $url
- tar xzf $tarball
- # if we are in a full install, gotta prevent build-dep from
- # using repos that are pinned negative, and pulling in uninstallable
- # packages.
- #
- # todo: this isn't considering the chroot, assumes we've built it
- # outside the chroot and won't get into this case.
- if [[ -e /b/distro-functions/src/package-manager-abstractions ]]; then
- . /b/distro-functions/src/package-manager-abstractions
- debian_codename=$(debian-codename)
- p build-dep btrfs-progs/$debian_codename -y
- else
- $ROOTCMD apt-get -y build-dep btrfs-progs
- fi
- # note: docs requirements are installed when we have a full distro, so
- # at some point, fix the build for early distro.
- $ROOTCMD bash -xe <<EOF
-cd /tmp/${tarball%.tar.gz}
-./configure --prefix=/usr
-make
-make install
-mv /usr/bin/{fsck,mkfs}.btrfs /usr/sbin/
-EOF
- # If our desktop is HOST2, will we btrbk this latest bprogs to other
- # machines.
- if [[ -s /a/bin/bash_unpublished/source-state ]]; then
- source /a/bin/bash_unpublished/source-state
- fi
- if [[ $HOST2 == "$HOSTNAME" && $FAI_ROOT != / ]]; then
- rm -rf $bp_dir
- chown -R iank:iank $target/tmp/${tarball%.tar.gz}
- mv $target/tmp/${tarball%.tar.gz} $bp_dir
- fi
+## end get new kernel and btrfs-progs ##
- fi
-fi
-## end get new kernel and btrfs-progs ##
+. $FAI/distro-install-common/new-btrfs-progs
config redirect
- option name temp_webserver
+ option name alt_ssh
option src wan
- option src_dport 8877
+ option src_dport 23
option dest lan
- option dest_ip $l.38
+ option dest_ip $l.34
option proto tcp
config rule
option src wan
option target ACCEPT
- option dest_port 8877
+ option dest_port 23
option proto tcp