update_ports_tree.sh 711 B

123456789101112131415161718
  1. #!/bin/ksh
  2. cd /usr
  3. if [ ! -d /usr/ports ]; then
  4. echo "INFO: Directory /usr/ports does not exist, downloading ports tree..."
  5. doas ftp https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/ports.tar.gz
  6. doas ftp https://ftp.openbsd.org/pub/OpenBSD/$(uname -r)/SHA256.sig
  7. echo "INFO: Checking downloaded file with signify..."
  8. doas signify -C -p /etc/signify/openbsd-$(uname -r | cut -c 1,3)-base.pub -x SHA256.sig ports.tar.gz
  9. echo "INFO: Extracting downloaded file..."
  10. doas tar xzf ports.tar.gz
  11. doas rm ports.tar.gz SHA256.sig
  12. fi
  13. echo "INFO: Updating ports tree in /usr/ports..."
  14. cd /usr
  15. doas cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -rOPENBSD_$(uname -r | tr . _) -P ports