Skip to content

Instantly share code, notes, and snippets.

@ohmantics
Last active March 25, 2024 15:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ohmantics/11516438b693a91e8bca4edcba7f796b to your computer and use it in GitHub Desktop.
Save ohmantics/11516438b693a91e8bca4edcba7f796b to your computer and use it in GitHub Desktop.
Homebridge in an iocage jail
DATASET=/zroot/apps
# Create the jail
iocage create -n "homebridge" -r 13.1-RELEASE dhcp=1 bpf=1 vnet=1 allow_raw_sockets="1" boot="on"
# switch to Latest
iocage exec homebridge "mkdir -p /usr/local/etc/pkg/repos"
iocage exec homebridge "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
# Install Homebridge and dependencies
iocage exec homebridge "pkg install -y npm-node18 python3 sudo"
iocage exec homebridge "npm install -g --unsafe-perm homebridge homebridge-config-ui-x"
# create homebridge user (somewhat arbitrary unused UID/GID choice from ports list)
iocage exec homebridge "pw groupadd -n homebridge -g 866 -q"
iocage exec homebridge "pw useradd -n homebridge -u 866 -g 866 -q -c 'Homebridge User' -d /nonexistent -s /usr/sbin/nologin"
# Mount storage
mkdir -p $DATASET/homebridge
chown 866:866 $DATASET/homebridge
iocage exec homebridge "mkdir -p /var/lib/homebridge"
iocage fstab -a homebridge $DATASET/homebridge /var/lib/homebridge nullfs rw 0 0
iocage exec homebridge "hb-service install --user homebridge"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment