Skip to content

Instantly share code, notes, and snippets.

@agrajag9
Last active December 31, 2021 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrajag9/51c1522b9e0902060d7dafa8c2221d12 to your computer and use it in GitHub Desktop.
Save agrajag9/51c1522b9e0902060d7dafa8c2221d12 to your computer and use it in GitHub Desktop.
A9Development.com FreeBSD Update Scripts
#!/bin/sh
LIBS="dri/radeonsi_drv_video.so libdrm_amdgpu.so.1 libdrm.so.2 libva-drm.so.2 libva.so.2"
SYS_ROOT="/zroot/iocage/jails/plex/root"
PLEX_PATH="$SYS_ROOT/usr/local/share/plexmediaserver-plexpass/lib"
LIB_PATH="/usr/local/lib"
SYS_PATH="$SYS_ROOT/$LIB_PATH"
iocage restart plex
iocage pkg plex update
iocage pkg plex upgrade -y
iocage pkg plex install -fy graphics/mesa-dri graphics/mesa-gallium-va multimedia/plexmediaserver-plexpass
iocage pkg plex autoremove
iocage stop plex
for SO in $LIBS; do
if [ -e $PLEX_PATH/$SO.dist ]; then
rm -v $PLEX_PATH/$SO.dist
fi
if [ -e $PLEX_PATH/$SO ]; then
mv -v $PLEX_PATH/$SO $PLEX_PATH/$SO.dist
fi
if [ -e $SYS_PATH/$SO ]; then
ln -vs $LIB_PATH/$SO $PLEX_PATH/$SO
fi
done
iocage start plex
iocage exec plex 'su plex -c vainfo'
#!/bin/sh
# 1. Pull code and setup boot environment
cd /usr/src
git pull --ff-only
# 2. Clean and build
make cleanworld
time make -j16 buildworld
git -C /usr/ports pull --ff-only
time make -j16 buildkernel
# 2b. Update PkgBase packages
if [ -e /etc/make.conf ]; then mv -iv /etc/make.conf /etc/make.conf.bak; fi
time make packages
if [ -e /etc/make.conf.bak ]; then mv -iv /etc/make.conf.bak /etc/make.conf; fi
# 3. Create, mount, and chroot into new boot environment
export CURCOMMIT=$( git log --oneline -1 | cut -d' ' -f1 )
export CURCOMMIT_BEPATH="/var/tmp/BE-$CURCOMMIT"
mkdir -pv $CURCOMMIT_BEPATH
bectl create $CURCOMMIT
bectl mount $CURCOMMIT $CURCOMMIT_BEPATH
# 4. Stop jails
export JAILS=$( iocage list -h | grep STABLE | grep -v stable13 | cut -f2 )
service iocage stop
# 5. Install kernel
if [ -e /etc/make.conf ]; then mv -iv /etc/make.conf /etc/make.conf.bak; fi
time make -j4 installkernel DESTDIR=$CURCOMMIT_BEPATH
if [ -e /etc/make.conf.bak ]; then mv -iv /etc/make.conf.bak /etc/make.conf; fi
# 6. etcupdate -p new BE and jails
etcupdate -p -D $CURCOMMIT_BEPATH
for JAIL in $JAILS; do
echo -n etcupdate -p -D /zroot/iocage/jails/$JAIL/root ...
etcupdate -p -D /zroot/iocage/jails/$JAIL/root
echo ' done'
done
# 7. Install world
time make -j4 installworld DESTDIR=$CURCOMMIT_BEPATH
poudriere jail -u -j 13amd64
# 8. etcupdate -B host and jails
etcupdate -B -D $CURCOMMIT_BEPATH
for JAIL in $JAILS; do
echo etcupdate -B -D /zroot/iocage/jails/$JAIL/root ...
etcupdate -B -D /zroot/iocage/jails/$JAIL/root
echo 'done'
done
# 9. check and delete old stuff
make check-old DESTDIR=$CURCOMMIT_BEPATH
yes | make delete-old DESTDIR=$CURCOMMIT_BEPATH
yes | make delete-old-libs DESTDIR=$CURCOMMIT_BEPATH
# 10. Unmount and activate the new BE, and reboot
bectl umount $CURCOMMIT
bectl activate $CURCOMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment