Skip to content

Instantly share code, notes, and snippets.

@brav0charlie
Last active July 30, 2023 16:00
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save brav0charlie/d01d09badbeab080ea6cfe077f90fcb1 to your computer and use it in GitHub Desktop.
VyOS Image Build Scripts: Rename to autobuild.sh and isobuild.sh. Clone the vyos/vyos-build repo, change to that directory, then copy these two files into the directory. Run autobuild.sh, sit back and wait.
#!/bin/bash
# VyOS Build Branch (Rolling Release=current, Stable=equuleus, 1.2=crux)
BUILD_BRANCH="current"
# This should be your cloned vyos/vyos-build git repo
PROJECT_DIR="/home/billc/Projects/vyos-build"
# Your home directory
HOME_DIR="/home/billc"
# Final .iso file destination: Set this to where you'd like
ISO_DEST="/home/billc/vyos-iso"
# Check if ISO_DEST exists, if not, then create.
if [ ! -d "$ISO_DEST" ] ; then
mkdir -p $ISO_DEST
fi
##
## Do the Work
##
# Change to $PROJECT_DIR
cd $PROJECT_DIR
# Ensure we have the latest updates to the build scripts
/usr/bin/git pull
# Pull & start the vyos-build:current container, starting isobuild.sh at launch
/usr/bin/docker pull vyos/vyos-build:$BUILD_BRANCH && /usr/bin/docker run --rm -t \
-v "$PROJECT_DIR":/vyos \
-v "$HOME_DIR/.gitconfig":/etc/gitconfig \
-v "$HOME_DIR/.bash_aliases":/home/vyos_bld/.bash_aliases \
-v "$HOME_DIR/.bashrc":/home/vyos_bld/.bashrc \
-w /vyos --privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 \
-e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) \
vyos/vyos-build:$BUILD_BRANCH bash ./isobuild.sh
#!/bin/bash
# Build Information
BUILD_BY="36345117+brav0charlie@users.noreply.github.com"
BUILD_TYPE="release"
VERSION="$(TZ='UTC' date +%Y.%m.%d)-latest"
ARCH="amd64"
BUILD_COMMENT="Integrated packages: bat, dnsutils, git, nano, prometheus-node-exporter"
# Custom Packages
PKG1="bat"
PKG2="dnsutils"
PKG3="git"
PKG4="nano"
# This is where the build process creates the final .iso file
ISO_SOURCE="./build/vyos-*-$ARCH.iso"
# Configure, build & create ISO
sudo ./build-vyos-image \
--build-by "$BUILD_BY" \
--build-type "$BUILD_TYPE" \
--version "$VERSION" \
--architecture "$ARCH" \
--custom-package "$PKG1" \
--custom-package "$PKG2" \
--custom-package "$PKG3" \
--custom-package "$PKG4" \
--build-comment "$BUILD_COMMENT" \
iso
# Copy ISO to ISO_DEST
sudo mv $ISO_SOURCE ./vyos-$VERSION-$ARCH.iso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment