Skip to content

Instantly share code, notes, and snippets.

@bao3
Forked from ohmantics/hb-setup.sh
Created May 21, 2024 17:46
Show Gist options
  • Save bao3/b934816be2b8e6cd49614e946f01b626 to your computer and use it in GitHub Desktop.
Save bao3/b934816be2b8e6cd49614e946f01b626 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