Skip to content

Instantly share code, notes, and snippets.

@nakal
Last active Oct 2, 2021
Embed
What would you like to do?
#!/bin/sh
SCRIPTNAME=`basename "$0"`
PORTSTREE="local"
POUDRIERE="/usr/local/bin/poudriere"
URL="https://host.example.org/poudriere/"
poudriere_build() {
for REPO in $REPOS; do
echo "Started $REPO ("`/bin/date | /usr/bin/tr -d '\n'`")"
"$POUDRIERE" bulk -j "$JAIL" -p "$PORTSTREE" -z "$REPO" -f "${JAIL}"-"${PORTSTREE}"-"${REPO}"-pkglist > /dev/null
echo " Cleaning $REPO ("`/bin/date | /usr/bin/tr -d '\n'`")"
"$POUDRIERE" pkgclean -j "$JAIL" -p "$PORTSTREE" -z "$REPO" -f "${JAIL}"-"${PORTSTREE}"-"${REPO}"-pkglist -y > /dev/null
echo " Finished $REPO ("`/bin/date | /usr/bin/tr -d '\n'`")"
done
}
echo "This is a log of poudriere. Details: $URL"
echo ""
echo "[$SCRIPTNAME] Updating ports tree..."
"$POUDRIERE" ports -p "$PORTSTREE" -u > /dev/null
if [ $? -ne 0 ]; then
echo " Error updating ports tree."
exit 1
fi
echo " Ports tree has been updated."
# distribute INDEX-* files for pkg-status (periodic)
# (for remote servers)
# /bin/cp /usr/ports/INDEX-* /jails/jail1/usr/ports/
#/usr/bin/scp /usr/ports/INDEX-* user@server1:/usr/ports/
## for 10.x
#cd /usr/local/etc/poudriere.d
#JAIL="10amd64"
#REPOS="server1 jail1"
#poudriere_build
# for 11.x
JAIL="11amd64"
REPOS="server1 jail1"
poudriere_build
echo "[$SCRIPTNAME] Cleaning distfiles..."
"$POUDRIERE" distclean -p "$PORTSTREE" -y
echo "[$SCRIPTNAME] Finished. ("`/bin/date | /usr/bin/tr -d '\n'`")"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment