proxmox/build.sh

37 lines
958 B
Bash
Raw Permalink Normal View History

#!/bin/sh
set -e
export CARGO=/usr/bin/cargo
export RUSTC=/usr/bin/rustc
CRATE=$1
BUILDCMD=${BUILDCMD:-"dpkg-buildpackage -b -uc -us"}
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
BUILDDIR="${BUILDDIR:-"build"}"
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
mkdir -p "${BUILDDIR}"
echo system >"${BUILDDIR}"/rust-toolchain
rm -rf ""${BUILDDIR}"/${CRATE}"
CONTROL="$PWD/${CRATE}/debian/control"
if [ -e "$CONTROL" ]; then
# check but only warn, debcargo fails anyway if crates are missing
dpkg-checkbuilddeps $PWD/${CRATE}/debian/control || true
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
[ "x$NOCONTROL" = 'x' ] && rm -f "$PWD/${CRATE}/debian/control"
fi
debcargo package \
--config "$PWD/${CRATE}/debian/debcargo.toml" \
--changelog-ready \
--no-overlay-write-back \
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
--directory "$PWD/"${BUILDDIR}"/${CRATE}" \
"${CRATE}" \
"$(dpkg-parsechangelog -l "${CRATE}/debian/changelog" -SVersion | sed -e 's/-.*//')"
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
cd ""${BUILDDIR}"/${CRATE}"
rm -f debian/source/format.debcargo.hint
${BUILDCMD}
buildsys: add targets for raw installation and sysexts The following targets should be self-explanatory: # make install $ make DESTDIR=$SOME_PATH install # make proxmox-sys-install $ make DESTDIR=$SOME_PATH proxmox-sys-install # make proxmox-<any other crate name>-install Additionally, these are used as building blocks to create systemd-sysext(8) images: $ make proxmox-sys-sysext builds an `extensions/proxmox-sys.raw` This can be copied/symlinked to `/run/extensions/` and then activated. As root: # ln -s $REPO_DIR/extensions/proxmox-sys.raw /run/extensions/ # systemd-systext refresh For the complete workspace, an `extensions/proxmox-workspace.raw` can be built via $ make sysext This also takes a `CRATES` var to limit the crates which should be included, and takes an optional `NOCLEAN=1` which prevents cleaning out the previously installed to "add" new crates on the go: Assuming there's a symlink like: # ln -s $REPO_DIR/extensions/proxmox-workspace.raw /run/extensions/proxmox-workspace.raw One can modify the installed crates like this: $ make CRATES=proxmox-sys sysext $ sudo systemd-sysext refresh Now only the current proxmox-sys crate is overridden. $ make NOCLEAN=1 CRATES=proxmox-time sysext $ sudo systemd-sysext refresh Now proxmox-sys as well as proxmox-time are installed. To undo the changes, either just do, as root: # systemd-sysext unmerge or remove the files which should specifically be dropped from /run/extensions/ and run as root: # systemd-sysext refresh Another way to temporarily install single crates is to just have the extensions/ folder *be* the `/run/extensions` folder: # rmdir /run/extensions # ln -s $REPO_DIR/extensions /run/extensions Then just build individual extensions: $ make proxmox-sys-sysext $ sudo systemd-sysext refresh $ make proxmox-router-sysext $ sudo systemd-sysext refresh Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 12:24:08 +03:00
[ "x$NOCONTROL" = "x" ] && cp debian/control "$CONTROL"